From 12e10799eee982f28b95dc02a43992cd763f0378 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Tue, 30 Oct 2018 14:08:43 -0500
Subject: Use % for -n and shut up gcc's broken "may be used uninitialized"
 warnings.

(Alas, llvm doesn't understand -Wno-maybe-uninitialized yet.)
---
 toys/pending/watch.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/toys/pending/watch.c b/toys/pending/watch.c
index 41fb020e..42dc25c2 100644
--- a/toys/pending/watch.c
+++ b/toys/pending/watch.c
@@ -6,7 +6,7 @@
  * No standard. See http://man7.org/linux/man-pages/man1/watch.1.html
  *
  * TODO: add 
-USE_WATCH(NEWTOY(watch, "^<1n#<100=2000tebx", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
+USE_WATCH(NEWTOY(watch, "^<1n%<100=2000tebx", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE))
 
 config WATCH
   bool "watch"
@@ -67,7 +67,7 @@ void watch_main(void)
 {
   char *cmdv[] = {"/bin/sh", "-c", 0, 0}, *cmd, *ss;
   long long now, then = millitime();
-  unsigned width, height, xx, yy, i, cmdlen, len, active;
+  unsigned width, height, i, cmdlen, len, xx = xx, yy = yy, active = active;
   struct pollfd pfd[2];
   pid_t pid = 0;
   int fds[2], cc;
@@ -168,10 +168,9 @@ void watch_main(void)
       cc = *ss++;
       if (cc==27) continue; // TODO
 
-      // Handle BEL BS HT LF VT FF CR 
+      // Handle BEL BS HT LF VT FF CR
       if (cc>=10 && cc<=12) {
         if (++yy>=height) break;
-
         if (cc=='\n') putchar('\r'), xx = 0;
       }
       putchar(cc);
-- 
cgit v1.2.3