diff --git a/cmd/ifquery.c b/cmd/ifquery.c index 8b68b15..2778dea 100644 --- a/cmd/ifquery.c +++ b/cmd/ifquery.c @@ -164,7 +164,7 @@ print_interface_property(struct lif_interface *iface, const char *property) } void -ifquery_usage(void) +ifquery_usage(int status) { fprintf(stderr, "usage: ifquery [options] \n"); fprintf(stderr, " ifquery [options] --list\n"); @@ -183,7 +183,7 @@ ifquery_usage(void) fprintf(stderr, " -D, --dot generate a dependency graph\n"); fprintf(stderr, " -p, --property PROPERTY print values of properties matching PROPERTY\n"); - exit(1); + exit(status); } struct match_options { @@ -289,7 +289,7 @@ ifquery_main(int argc, char *argv[]) switch (c) { case 'h': - ifquery_usage(); + ifquery_usage(EXIT_SUCCESS); break; case 'V': lif_common_version(); @@ -344,7 +344,7 @@ ifquery_main(int argc, char *argv[]) /* --list --state is not allowed */ if (listing && listing_stat) - ifquery_usage(); + ifquery_usage(EXIT_FAILURE); if (listing) { @@ -358,7 +358,7 @@ ifquery_main(int argc, char *argv[]) } if (optind >= argc) - ifquery_usage(); + ifquery_usage(EXIT_FAILURE); int idx = optind; for (; idx < argc; idx++) diff --git a/cmd/ifupdown.c b/cmd/ifupdown.c index 94259c1..9a9aada 100644 --- a/cmd/ifupdown.c +++ b/cmd/ifupdown.c @@ -38,7 +38,7 @@ static struct lif_execute_opts exec_opts = { }; void -ifupdown_usage(void) +ifupdown_usage(int status) { fprintf(stderr, "usage: %s [options] \n", argv0); @@ -56,7 +56,7 @@ ifupdown_usage(void) fprintf(stderr, " -f, --force force (de)configuration\n"); fprintf(stderr, " -L, --no-lock do not use a lockfile to serialize state changes\n"); - exit(1); + exit(status); } bool @@ -220,7 +220,7 @@ ifupdown_main(int argc, char *argv[]) switch (c) { case 'h': - ifupdown_usage(); + ifupdown_usage(EXIT_SUCCESS); break; case 'V': lif_common_version(); @@ -284,7 +284,7 @@ ifupdown_main(int argc, char *argv[]) return EXIT_SUCCESS; } else if (optind >= argc) - ifupdown_usage(); + ifupdown_usage(EXIT_FAILURE); int idx = optind; for (; idx < argc; idx++) diff --git a/cmd/multicall.c b/cmd/multicall.c index 0eff1bb..c6ae3d4 100644 --- a/cmd/multicall.c +++ b/cmd/multicall.c @@ -44,7 +44,7 @@ applet_cmp(const void *a, const void *b) return strcmp(key, applet->name); } -void multicall_usage(void) __attribute__((noreturn)); +void multicall_usage(int status) __attribute__((noreturn)); int main(int argc, char *argv[]) @@ -59,7 +59,7 @@ main(int argc, char *argv[]) if (app == NULL) { fprintf(stderr, "%s: applet not found\n", argv0); - multicall_usage(); + multicall_usage(EXIT_FAILURE); } return (*app)->main(argc, argv); @@ -69,13 +69,13 @@ int multicall_main(int argc, char *argv[]) { if (argc < 2) - multicall_usage(); + multicall_usage(EXIT_FAILURE); return main(argc - 1, argv + 1); } void -multicall_usage(void) +multicall_usage(int status) { fprintf(stderr, "usage: ifupdown [options]\n"); @@ -90,7 +90,7 @@ multicall_usage(void) fprintf(stderr, "\n"); - exit(EXIT_FAILURE); + exit(status); } struct if_applet ifupdown_applet = { diff --git a/cmd/multicall.h b/cmd/multicall.h index 48bd1ea..6fb26a4 100644 --- a/cmd/multicall.h +++ b/cmd/multicall.h @@ -21,7 +21,7 @@ struct if_applet { const char *name; int (*const main)(int argc, char *argv[]); - void (*const usage)(void); + void (*const usage)(int status); }; extern char *argv0;