diff options
Diffstat (limited to 'src/_usage.c')
-rw-r--r-- | src/_usage.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/_usage.c b/src/_usage.c new file mode 100644 index 00000000..89258185 --- /dev/null +++ b/src/_usage.c @@ -0,0 +1,26 @@ +/* + * @file _usage.c + * @brief standardize help/usage output across all our programs + * @internal + * + * Copyright 2007 Gentoo Foundation + * Released under the GPLv2 + */ + +#ifndef APPLET +# error you forgot to define APPLET +#endif + +static void usage (int exit_status) +{ + int i; + printf ("Usage: " APPLET " [options]\n\n"); + printf ("Options: [" getoptstring "]\n"); + for (i = 0; longopts[i].name; ++i) + printf (" -%c, --%s\n", longopts[i].val, longopts[i].name); + exit (exit_status); +} + +#define case_RC_COMMON_GETOPT \ + case 'h': usage (EXIT_SUCCESS); \ + default: usage (EXIT_FAILURE); |