diff --git a/Makefile.am b/Makefile.am index f1bd6b98..fe1f12f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,7 +96,7 @@ dist_man_MANS += \ slabtop_SOURCES = slabtop.c lib/strutils.c lib/fileutils.c slabtop_LDADD = $(LDADD) @NCURSES_LIBS@ watch_SOURCES = watch.c lib/strutils.c lib/fileutils.c -watch_LDADD = $(LDADD) @WATCH_NCURSES_LIBS@ +watch_LDADD = @WATCH_NCURSES_LIBS@ top_top_SOURCES = \ top/top.h \ top/top.c \ diff --git a/watch.c b/watch.c index de46730c..58b4dbc8 100644 --- a/watch.c +++ b/watch.c @@ -228,10 +228,12 @@ static void process_ansi(FILE * fp) * attributes to apply, but typically there are between 1 and 3. */ - if (*endptr == '\0') set_ansi_attribute(0); /* [m treated as [0m */ - for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) + for (endptr = numstart = buf; *endptr != '\0'; numstart = endptr + 1) { set_ansi_attribute(strtol(numstart, &endptr, 10)); + if (numstart == endptr) + set_ansi_attribute(0); /* [m treated as [0m */ + } } static void __attribute__ ((__noreturn__)) do_exit(int status)