On Mon, Nov 26, 2018 at 06:40:05PM +0100, Klemens Nanni wrote:
> On Sun, Nov 11, 2018 at 06:07:10PM +0100, Klemens Nanni wrote:
> > There's no point in parsing `-display' separately, just do it once and
> > simplify the code while here.
> > 
> > This addresses two of cheloha's comments from my strtonum diff.
> Ping.
> 
> Feedback? OK?
Found this X diff I still want to get rid of;  one last try but with all
the churn removed this time.

Any takers?

Index: xidle.c
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.c,v
retrieving revision 1.8
diff -u -p -r1.8 xidle.c
--- xidle.c     11 Nov 2018 16:10:37 -0000      1.8
+++ xidle.c     1 Apr 2019 11:20:07 -0000
@@ -76,12 +76,9 @@ struct xinfo {
 struct xinfo x;
 
 static XrmOptionDescRec fopts[] = {
-       { "-display",   ".display",     XrmoptionSepArg,        (caddr_t)NULL },
-};
-
-static XrmOptionDescRec opts[] = {
        { "-area",      ".area",        XrmoptionSepArg,        (caddr_t)NULL },
        { "-delay",     ".delay",       XrmoptionSepArg,        (caddr_t)NULL },
+       { "-display",   ".display",     XrmoptionSepArg,        (caddr_t)NULL },
        { "-program",   ".program",     XrmoptionSepArg,        (caddr_t)NULL },
        { "-timeout",   ".timeout",     XrmoptionSepArg,        (caddr_t)NULL },
 
@@ -263,9 +260,11 @@ parse_opts(int argc, char **argv, Displa
 
        XrmInitialize();
 
-       /* Get display to open. */
+       /* Get command line values. */
        XrmParseCommand(&rdb, fopts, sizeof(fopts) / sizeof(fopts[0]),
            __progname, &argc, argv);
+       if (argc > 1)
+               usage();
 
        display = (getres(&value, rdb, "display", "Display") == True) ?
            (char *)value.addr : NULL;
@@ -288,12 +287,6 @@ parse_opts(int argc, char **argv, Displa
                XrmMergeDatabases(tdb, &rdb);
        }
 
-       /* Get remaining command line values. */
-       XrmParseCommand(&rdb, opts, sizeof(opts) / sizeof(opts[0]),
-           __progname, &argc, argv);
-       if (argc > 1) {
-               usage();
-       }
        if (getres(&value, rdb, "area", "Area")) {
                *area = strtonum(value.addr, 1, INT_MAX, &errstr);
                if (errstr)
===================================================================
Stats: --- 11 lines 293 chars
Stats: +++ 4 lines 119 chars
Stats: -7 lines
Stats: -174 chars

Reply via email to