diff options
Diffstat (limited to 'service/src/printdoc.c')
| -rw-r--r-- | service/src/printdoc.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/service/src/printdoc.c b/service/src/printdoc.c index b01ddfb..d7a4131 100644 --- a/service/src/printdoc.c +++ b/service/src/printdoc.c @@ -73,7 +73,7 @@ search_cmd(char *arg) DIR *d = NULL; if (lastrun.valid) - hash = lastrun.namehash; + hash = lastrun.hash; else hash = mhash(ask("What is the model name?\n"), -1); @@ -126,7 +126,7 @@ submit_cmd(char *arg) bufp = ask("How large is your file?\n"); len = strtoul(bufp, &end, 10); - if (len <= 0 || len >= 7000 || *end) { + if (len <= 0 || len >= 10000 || *end) { fprintf(stderr, "Invalid file length!\n"); return; } @@ -138,7 +138,12 @@ submit_cmd(char *arg) lastrun.valid = parse_file(&lastrun, contents, len); - if (lastrun.valid && lastrun.infopath) dump(lastrun.infopath); + if (lastrun.valid) { + print_info(&lastrun); + save_info(&lastrun, resultdir); + printf("Your file was saved with ID %s!\n", lastrun.hash); + printf("You may retrieve your results via the 'search' function\n"); + } free(contents); } @@ -169,8 +174,6 @@ main() char linebuf[256], *cp, *arg; int exit, i; - setvbuf(stdin, NULL, _IONBF, 0); - if (!(resultdir = getenv("RESULTDIR"))) resultdir = "/data"; @@ -178,7 +181,7 @@ main() exit = 0; while (!exit) { - memset(linebuf, ' ', sizeof(linebuf)); + memset(linebuf, '\0', sizeof(linebuf)); printf("$ "); exit = !fgets(linebuf, sizeof(linebuf), stdin); |
