mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
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: Kir Kolyshkin <kir@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
b73feb98db
commit
9fa2cda2cd
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user