It seems that x11spice is more X11 complaint than getopt_long so I don't see the --config=/-config= mandatory. Giving that -config is not GNU convention (they are 5 options!) I would avoid the mix. > > Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx> > --- > src/options.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/src/options.c b/src/options.c > index b7f487c5..0d3138d0 100644 > --- a/src/options.c > +++ b/src/options.c > @@ -213,14 +213,34 @@ void options_handle_ssl_file_options(options_t > *options, > options->ssl.ciphersuite = string_option(userkey, systemkey, "ssl", > "ciphersuite"); > } > > +/* In general, we want to parse the config file options before the command > line > +** arguments. However, the command line argument to specify a config file > is > +** the exception. We manually parse this out now, so we can simplify the > +** flow of control later. */ > void options_handle_user_config(int argc, char *argv[], options_t *options) > { > int i; > - for (i = 1; i < argc - 1; i++) > - if (strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-config") > == 0) { > + char *p, *q; > + > + /* getopt long is complex; it supports [-]-config[=]filename */ > + for (i = 1; i < argc; i++) { > + p = strstr(argv[i], "--config"); > + if (p != argv[i]) { strncmp instead ? > + p = strstr(argv[i], "-config"); > + } > + if (p != argv[i]) { > + continue; > + } > + q = strstr(p, "="); This will also accept "-config-whatever=value" > + if (q) { > + options->user_config_file = strdup(q + 1); > + continue; > + } > + if (i < argc - 1) { > options->user_config_file = strdup(argv[i + 1]); > i++; > } > + } > } > > int options_parse_arguments(int argc, char *argv[], options_t *options) Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel