From d09ba0c7af0f6aa513a3f05fa3c5e0a24729178d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 25 Jun 2013 16:48:13 -0700 Subject: [PATCH] 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. --- fips.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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} -- 2.43.0