]> granicus.if.org Git - procps-ng/commitdiff
watch: interpret esc[m sequence
authorCraig Small <csmall@enc.com.au>
Wed, 18 Nov 2015 11:48:09 +0000 (22:48 +1100)
committerCraig Small <csmall@enc.com.au>
Wed, 18 Nov 2015 11:48:09 +0000 (22:48 +1100)
Commit 99fa7f removed watch crashing from having the null ANSI
sequence. However it just ignored that sequence instead of fixing it.

This change correctly checks buf (not undefined endptr) and sends
the reset attribute if found.

Closes: #12
watch.c

diff --git a/watch.c b/watch.c
index 58b4dbc824dc2e93a64ed1f0ab98b5ece50aadfb..60e653417f234cf0f3c6c6df01fb22e00570bfcc 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -228,6 +228,9 @@ static void process_ansi(FILE * fp)
         * attributes to apply, but typically there are between 1 and 3.
         */
 
+    /* Special case of <ESC>[m */
+    if (buf[0] == '\0')
+        set_ansi_attribute(0);
 
        for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) {
                set_ansi_attribute(strtol(numstart, &endptr, 10));