aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/main.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
committerLouis Burda <quent.burda@gmail.com>2021-05-29 14:24:31 +0200
commit13b65f01132c41be9ab8d9f92c2c5ca605c366d8 (patch)
tree74bd5b4dee779e4600d416adf4abcd4f621addab /service/src/main.c
parent62d99253144a14648c4da1c2a60c01e7b06ef02c (diff)
downloadenowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.tar.gz
enowars5-service-stldoctor-13b65f01132c41be9ab8d9f92c2c5ca605c366d8.zip
changed repo structure and commited releease files such that default docker-compose worklow commands work in testvm
Diffstat (limited to 'service/src/main.c')
-rw-r--r--service/src/main.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/service/src/main.c b/service/src/main.c
index de2bd48..d76ceb8 100644
--- a/service/src/main.c
+++ b/service/src/main.c
@@ -144,21 +144,21 @@ upload_cmd(const char *arg)
bufp = ask("How large is your file? ");
len = strtoul(bufp, &end, 10);
if (len <= 0 || len >= MAXFILESIZE || *end) {
- fprintf(stderr, "Invalid file length!\n");
+ printf("Invalid file length!\n");
return;
}
printf("Ok! Im listening..\n");
contents = checkp(malloc(len + 1));
if (fread(contents, 1, len, stdin) != len) {
- fprintf(stderr, "Hm, I'm missing some bytes.. try again!\n");
+ printf("Hm, I'm missing some bytes.. try again!\n");
goto cleanup;
}
contents[len] = '\0';
if ((cached.valid = parse_file(&cached, contents, len))) {
if (save_submission(&cached, contents, len) != OK)
- fprintf(stderr, "Failed to save your submission!\n");
+ printf("Failed to save your submission!\n");
else
printf("Your file was saved with ID %s!\n", cached.hash);
}
@@ -180,7 +180,7 @@ search_cmd(const char *arg)
if (arg && !strcmp(arg, "last")) {
if (!cached.valid) {
- fprintf(stderr, "No cached info report available\n");
+ printf("No cached info report available\n");
return;
}
hash = cached.hash;
@@ -201,12 +201,12 @@ search_cmd(const char *arg)
}
if (i == 0) {
- fprintf(stderr, "Sorry, couldnt find a matching scan result!\n");
+ printf("Sorry, couldnt find a matching scan result!\n");
goto cleanup;
} else {
which = strtoul(ask("Which of these results? "), &end, 10);
if (which >= i || which < 0 || *end) {
- fprintf(stderr, "Invalid index!\n");
+ printf("Invalid index!\n");
goto cleanup;
}
}
@@ -224,9 +224,8 @@ search_cmd(const char *arg)
}
}
- /* file got cleaned up during race condition by background task */
if (!scandir) {
- fprintf(stderr, "Selected result spontaneously combusted!\n");
+ printf("Selected result spontaneously combusted!\n");
goto cleanup;
}
@@ -271,7 +270,7 @@ list_cmd(const char *arg)
DIR *d;
if (!loggedin) {
- fprintf(stderr, "Not logged in!\n");
+ printf("Not logged in!\n");
return;
}
@@ -283,7 +282,7 @@ list_cmd(const char *arg)
path = aprintf("%s/%s/info", resultdir, de->d_name);
if ((f = fopen(path, "r"))) {
if (load_info(&info, f) != OK)
- fprintf(stderr, "Failed to read saved file info!\n");
+ printf("Failed to read saved file info!\n");
else
print_info(&info);
fclose(f);
@@ -301,7 +300,7 @@ auth_cmd(const char *arg)
int ret;
if (loggedin) {
- fprintf(stderr, "Already logged in!\n");
+ printf("Already logged in!\n");
return;
}
@@ -313,7 +312,7 @@ auth_cmd(const char *arg)
} else if (ret && errno == EEXIST) {
printf("Success!\nWelcome back!\n");
} else {
- fprintf(stderr, "Auth failed!\n");
+ printf("Auth failed!\n");
return;
}
@@ -339,7 +338,7 @@ main()
int exit, i, cmdlen;
if (!(resultdir = checkp(strdup(getenv("RESULTDIR"))))) {
- fprintf(stderr, "RESULTDIR not defined\n");
+ printf("RESULTDIR not defined\n");
return 1;
}
@@ -371,6 +370,6 @@ main()
}
if (i == ARRSIZE(commands) && strlen(cmd) != 0)
- fprintf(stderr, "No such command!\n");
+ printf("No such command!\n");
}
}