aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-28 19:59:29 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2019-03-28 19:59:29 +0100
commit42b215a865c2645dcbffc641e9cac1505a1b4cee (patch)
treea281b0f938c9218f72d7b41b6db90ab73a099eb8
parent81acc30ee998ce7eb05df0e4216b3d994a5b30f2 (diff)
downloadblogc-42b215a865c2645dcbffc641e9cac1505a1b4cee.tar.gz
blogc-42b215a865c2645dcbffc641e9cac1505a1b4cee.tar.bz2
blogc-42b215a865c2645dcbffc641e9cac1505a1b4cee.zip
blogc: exit 1 on error
-rw-r--r--src/blogc/main.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/blogc/main.c b/src/blogc/main.c
index 1ca0e82..7416994 100644
--- a/src/blogc/main.c
+++ b/src/blogc/main.c
@@ -217,7 +217,7 @@ main(int argc, char **argv)
fprintf(stderr, "blogc: error: invalid value for "
"-D (must have an '='): %s\n", tmp);
bc_strv_free(pieces);
- rv = 3;
+ rv = 1;
goto cleanup;
}
for (size_t j = 0; pieces[0][j] != '\0'; j++) {
@@ -228,7 +228,7 @@ main(int argc, char **argv)
"for -D (configuration key must be uppercase "
"with '_'): %s\n", pieces[0]);
bc_strv_free(pieces);
- rv = 3;
+ rv = 1;
goto cleanup;
}
}
@@ -246,7 +246,7 @@ main(int argc, char **argv)
blogc_print_usage();
fprintf(stderr, "blogc: error: invalid argument: -%c\n",
argv[i][1]);
- rv = 3;
+ rv = 1;
goto cleanup;
}
}
@@ -269,7 +269,7 @@ main(int argc, char **argv)
if (!listing && bc_slist_length(sources) == 0) {
blogc_print_usage();
fprintf(stderr, "blogc: error: one source file is required\n");
- rv = 3;
+ rv = 1;
goto cleanup;
}
@@ -277,7 +277,7 @@ main(int argc, char **argv)
blogc_print_usage();
fprintf(stderr, "blogc: error: only one source file should be provided, "
"if running without '-l'\n");
- rv = 3;
+ rv = 1;
goto cleanup;
}
@@ -286,7 +286,7 @@ main(int argc, char **argv)
bc_slist_t *s = blogc_source_parse_from_files(config, sources, &err);
if (err != NULL) {
bc_error_print(err, "blogc");
- rv = 3;
+ rv = 1;
goto cleanup2;
}
@@ -301,7 +301,7 @@ main(int argc, char **argv)
if (val == NULL) {
fprintf(stderr, "blogc: error: variable not found: %s\n",
print);
- rv = 3;
+ rv = 1;
}
else {
printf("%s\n", val);
@@ -312,14 +312,14 @@ main(int argc, char **argv)
if (template == NULL) {
blogc_print_usage();
fprintf(stderr, "blogc: error: argument -t is required when rendering content\n");
- rv = 3;
+ rv = 1;
goto cleanup2;
}
bc_slist_t* l = blogc_template_parse_from_file(template, &err);
if (err != NULL) {
bc_error_print(err, "blogc");
- rv = 3;
+ rv = 1;
goto cleanup3;
}
@@ -337,7 +337,7 @@ main(int argc, char **argv)
if (fp == NULL) {
fprintf(stderr, "blogc: error: failed to open output file (%s): %s\n",
output, strerror(errno));
- rv = 3;
+ rv = 1;
goto cleanup4;
}
}