mirror of https://github.com/dirtbags/moth.git
printf working
This commit is contained in:
parent
d6ca3625a6
commit
55d01310e7
|
@ -7,6 +7,7 @@ printf-install: printf-build
|
|||
$(MAKE) -C packages/printf/src install DESTDIR=$(CURDIR)/$(PRINTF_PKGDIR)
|
||||
|
||||
$(call COPYTREE, packages/printf/service, $(PRINTF_PKGDIR)/service)
|
||||
cp packages/printf/tokens.txt $(PRINTF_PKGDIR)/
|
||||
|
||||
printf-clean:
|
||||
rm -rf $(PRINTF_PKGDIR)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /bin/sh
|
||||
|
||||
exec chpst -u 9001 -/ /opt/printf/bin ./printf
|
||||
exec chpst -u 9001 -/ /opt/printf/bin ./printf 3</opt/printf/tokens.txt
|
||||
|
|
|
@ -19,13 +19,7 @@ record(char *buf) {
|
|||
}
|
||||
|
||||
/* Storage space for tokens */
|
||||
char *token[5] = {
|
||||
"printf:xylep-radar-nanox",
|
||||
"printf:xylep-radar-nanox",
|
||||
"printf:xylep-radar-nanox",
|
||||
"printf:xylep-radar-nanox",
|
||||
"printf:xylep-radar-nanox"
|
||||
};
|
||||
char token[5][100];
|
||||
|
||||
/* Make this global so the stack isn't gigantic */
|
||||
char global_fmt[8000] = {0};
|
||||
|
@ -41,6 +35,29 @@ main(int argc, char *argv[], char *env[])
|
|||
int token4_flag = 0;
|
||||
int i;
|
||||
|
||||
/* Read in tokens */
|
||||
{
|
||||
FILE *tf = fdopen(3, "r");
|
||||
|
||||
if (! tf) {
|
||||
fprintf(stderr, "No tokens on fd3\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i += 1) {
|
||||
char *p = fgets(token[i], sizeof(token[i]), tf);
|
||||
|
||||
if (! p) {
|
||||
fprintf(stderr, "Cannot read token %d\n", i);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Replace newline with null */
|
||||
for (; *p && (*p != '\n'); p += 1);
|
||||
*p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make stderr buffer until lines */
|
||||
setlinebuf(stderr);
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
net:xenid-divik-vyhux
|
||||
net:xodib-recop-zycux
|
||||
net:xugep-zanuc-fetux
|
||||
net:ximac-pucaz-zonox
|
||||
net:xetab-kozyl-megex
|
Loading…
Reference in New Issue