Hi tech@,

I only have a very loose idea of what gets accepted or not when the tree
is "locked", so apologies if this should have been sent at a different
time.

If I launch worm(6) with an invalid argument, my terminal flashes once
before the strtonum error message is shown.  I assume this is because
various curses functions are called prior to the strtonum block, so the
patch below makes worm(6) quit sooner if an invalid argument is given.

I can reproduce this in st(1) if it's full-screened, as well as in xterm
(although it's less pronounced, not sure why).

Regards,
Michael

Index: worm.c
===================================================================
RCS file: /cvs/src/games/worm/worm.c,v
retrieving revision 1.28
diff -u -p -r1.28 worm.c
--- worm.c      9 Mar 2015 19:52:02 -0000       1.28
+++ worm.c      10 Aug 2015 19:06:06 -0000
@@ -93,6 +93,14 @@ main(int argc, char **argv)
        struct pollfd pfd[1];
        const char *errstr;
 
+       if (argc >= 2) {
+               start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
+                   &errstr);
+               if (errstr) {
+                       endwin();
+                       errx(1, "length argument is %s.", errstr);
+               }
+       }
        setbuf(stdout, outbuf);
        signal(SIGINT, leave);
        signal(SIGQUIT, leave);
@@ -110,14 +118,6 @@ main(int argc, char **argv)
        growthscale = COLS * LINES / 2000;
        if (growthscale == 0)
                growthscale = 1;
-       if (argc >= 2) {
-               start_len = strtonum(argv[1], 1, ((LINES-3) * (COLS-2)) / 3,
-                   &errstr);
-               if (errstr) {
-                       endwin();
-                       errx(1, "length argument is %s.", errstr);
-               }
-       }
        stw = newwin(1, COLS-1, 0, 0);
        tv = newwin(LINES-1, COLS-1, 1, 0);
        box(tv, '*', '*');

Reply via email to