aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-06-27 14:57:28 -0500
committerRob Landley <rob@landley.net>2017-06-27 14:57:28 -0500
commitb8e0920c180f81f86f0888804445f67a2a76fe2b (patch)
treeb5e46141eaa1c50abdbbe7d217e520bc79fdd9bd /toys
parent77997b8e774318631b373a443dc073d3b38b5d84 (diff)
downloadtoybox-b8e0920c180f81f86f0888804445f67a2a76fe2b.tar.gz
whitespace/comment tweaks.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/head.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/posix/head.c b/toys/posix/head.c
index 6153b42f..ea4bbbc6 100644
--- a/toys/posix/head.c
+++ b/toys/posix/head.c
@@ -3,7 +3,8 @@
* Copyright 2006 Timothy Elliott <tle@holymonkey.com>
*
* See http://opengroup.org/onlinepubs/9699919799/utilities/head.html
- * See http://man7.org/linux/man-pages/man1/head.1.html
+ *
+ * Deviations from posix: -c
USE_HEAD(NEWTOY(head, "?n#<0=10c#<0qv[-nc]", TOYFLAG_USR|TOYFLAG_BIN))
@@ -42,7 +43,7 @@ static void do_head(int fd, char *name)
xflush();
}
- while (toys.optflags & FLAG_c ? bytes : lines) {
+ while ((toys.optflags&FLAG_c) ? bytes : lines) {
len = read(fd, toybuf, sizeof(toybuf));
if (len<0) perror_msg_raw(name);
if (len<1) break;
@@ -50,8 +51,7 @@ static void do_head(int fd, char *name)
if (bytes) {
i = bytes >= len ? len : bytes;
bytes -= i;
- } else
- for(i=0; i<len;) if (toybuf[i++] == '\n' && !--lines) break;
+ } else for(i=0; i<len;) if (toybuf[i++] == '\n' && !--lines) break;
xwrite(1, toybuf, i);
}