From: Carl Worth Date: Tue, 25 Jun 2013 23:48:13 +0000 (-0700) Subject: Stop processing command-line options at first non-option argument X-Git-Url: https://git.cworth.org/git?p=fips;a=commitdiff_plain;h=d09ba0c7af0f6aa513a3f05fa3c5e0a24729178d Stop processing command-line options at first non-option argument This makes it much easier to pass options to the program being executed by fips. The options can be passed directly, such as: fips glxgears -fullscreen Previous, to this commit, one would have to use a syntax such as: fips -- glxgears -fullscreen to prevent fips from trying to interpret the "-fullscreen" argument as options to fips itself. --- diff --git a/fips.c b/fips.c index 02f67bb..fca2da8 100644 --- a/fips.c +++ b/fips.c @@ -43,7 +43,17 @@ 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 = "+h"; const struct option long_options[] = { {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}