X-Git-Url: https://git.cworth.org/git?p=fips;a=blobdiff_plain;f=fips.c;h=7276ce9fb28fa24f8e41abaf5bd2fc8bbd9734b3;hp=370a2eefab16d28c25b74eb87b645cee2d3c1a9b;hb=dfb96c9b64def8674a38dda2bc2276d4e2cdd58e;hpb=b32aa136d3e51a250e58c0fc28162b5e5fd52f67 diff --git a/fips.c b/fips.c index 370a2ee..7276ce9 100644 --- a/fips.c +++ b/fips.c @@ -19,8 +19,8 @@ * THE SOFTWARE. */ -#include -#include +#include "fips.h" + #include #include @@ -35,6 +35,7 @@ usage (void) "\n" "Options:\n" " -h, --help show this help message\n" + " -v, --verbose print verbose messages about fips activity" "\n"); } @@ -43,9 +44,20 @@ main (int argc, char *argv[]) { int opt, ret; - const char *short_options = "h"; + /* The initial '+' means that getopt will stop looking for + * options after the first non-option argument. This means + * that a command such as: + * + * fips glxgears -fullscreen + * + * Will do what is intended, (namely, have fips invoke + * "glxgears -fullscreen" rather than trying to interpret + * -fullscreen as options to fips itself. + */ + const char *short_options = "+hv"; const struct option long_options[] = { {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0} }; @@ -59,10 +71,13 @@ main (int argc, char *argv[]) case 'h': usage (); return 0; + case 'v': + setenv ("FIPS_VERBOSE", "1", 1); + break; case '?': break; default: - fprintf(stderr, "Internal error: " + fprintf(stderr, "fips: Internal error: " "unexpected getopt value: %d\n", opt); exit (1); }