Commit 9fa2cda2 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel: tell user what's wrong with usage

In case our command line is not good, it's not enough to just show
usage info -- it is much better to explicitly say what's wrong.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent b73feb98
......@@ -163,6 +163,8 @@ int main(int argc, char *argv[])
}
}
if (!current_cflags) {
fprintf(stderr, "Error: unknown arch '%s'\n",
optarg);
return usage(1);
}
break;
......@@ -205,12 +207,14 @@ int main(int argc, char *argv[])
}
if (optind >= argc) {
fprintf(stderr, "Error: action argument required\n");
return usage(1);
}
action = argv[optind++];
if (!strcmp(action, "cflags")) {
if (!current_cflags) {
fprintf(stderr, "Error: option --arch required\n");
return usage(1);
}
printf("%s", current_cflags);
......@@ -224,14 +228,17 @@ int main(int argc, char *argv[])
if (!strcmp(action, "hgen")) {
if (!opts.input_filename) {
fprintf(stderr, "Error: option --file required\n");
return usage(1);
}
if (!opts.output_filename) {
fprintf(stderr, "Error: option --output required\n");
return usage(1);
}
compel_log_init(&cli_log, log_level);
return piegen();
}
fprintf(stderr, "Error: unknown action '%s'\n", action);
return usage(1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment