aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-10-30 14:08:43 -0500
committerRob Landley <rob@landley.net>2018-10-30 14:08:43 -0500
commit12e10799eee982f28b95dc02a43992cd763f0378 (patch)
treee37e980f1b672a75f7be6bda56d2fc0538b54dc7 /toys
parent852b24fd1b59a54cd761c2bc861cacc951f69bd0 (diff)
downloadtoybox-12e10799eee982f28b95dc02a43992cd763f0378.tar.gz
Use % for -n and shut up gcc's broken "may be used uninitialized" warnings.
(Alas, llvm doesn't understand -Wno-maybe-uninitialized yet.)
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/watch.c7
1 files 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);