mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-06 01:05:29 +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) {
|
if (!current_cflags) {
|
||||||
|
fprintf(stderr, "Error: unknown arch '%s'\n",
|
||||||
|
optarg);
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -205,12 +207,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (optind >= argc) {
|
if (optind >= argc) {
|
||||||
|
fprintf(stderr, "Error: action argument required\n");
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
action = argv[optind++];
|
action = argv[optind++];
|
||||||
|
|
||||||
if (!strcmp(action, "cflags")) {
|
if (!strcmp(action, "cflags")) {
|
||||||
if (!current_cflags) {
|
if (!current_cflags) {
|
||||||
|
fprintf(stderr, "Error: option --arch required\n");
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
printf("%s", current_cflags);
|
printf("%s", current_cflags);
|
||||||
@@ -224,14 +228,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!strcmp(action, "hgen")) {
|
if (!strcmp(action, "hgen")) {
|
||||||
if (!opts.input_filename) {
|
if (!opts.input_filename) {
|
||||||
|
fprintf(stderr, "Error: option --file required\n");
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
if (!opts.output_filename) {
|
if (!opts.output_filename) {
|
||||||
|
fprintf(stderr, "Error: option --output required\n");
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
compel_log_init(&cli_log, log_level);
|
compel_log_init(&cli_log, log_level);
|
||||||
return piegen();
|
return piegen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "Error: unknown action '%s'\n", action);
|
||||||
return usage(1);
|
return usage(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user