changeset 1061:ed2694ccf2ae draft

Minor cosmetic tweaks to expand. Working my way through the to-review list that predates the "pending" directory. This gets expand off my to-review list. (Proof that "need to review" doesn't mean it's in bad shape, this command was fine. Changed capitalization in the help text because I'm trying to have "user supplies this value" be all caps, switched a read() to readall() although I'm not sure modern kernels actually allow -EINTR to generate zero length reads anymore, and since most of the loopfiles() target functions are called do_commandname() changed the name to that just so it's regular. None of the changes are actually important. :)
author Rob Landley <rob@landley.net>
date Mon, 09 Sep 2013 05:52:49 -0500
parents c2663b7eca78
children 3c744d5f0765
files toys/posix/expand.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/expand.c	Mon Sep 09 05:26:52 2013 -0500
+++ b/toys/posix/expand.c	Mon Sep 09 05:52:49 2013 -0500
@@ -10,16 +10,16 @@
   bool "expand"
   default y
   help
-    usage: expand [-t tablist] [file...]
+    usage: expand [-t TABLIST] [FILE...]
 
     Expand tabs to spaces according to tabstops.
 
-    -t	tablist
+    -t	TABLIST
 
-      Specify tab stops, either a single number instead of the default 8,
-      or a comma separated list of increasing numbers representing tabstop
-      positions (absolute, not increments) with each additional tab beyound
-      that becoming one space.
+    Specify tab stops, either a single number instead of the default 8,
+    or a comma separated list of increasing numbers representing tabstop
+    positions (absolute, not increments) with each additional tab beyound
+    that becoming one space.
 */
 
 #define FOR_expand
@@ -31,12 +31,12 @@
   unsigned tabcount, *tab;
 )
 
-static void expand_file(int fd, char *name)
+static void do_expand(int fd, char *name)
 {
   int i, len, x=0, stop = 0;
 
   for (;;) {
-    len = read(fd, toybuf, sizeof(toybuf));
+    len = readall(fd, toybuf, sizeof(toybuf));
     if (len<0) {
       perror_msg("%s", name);
       return;
@@ -123,6 +123,6 @@
     parse_tablist(TT.tab);
   }
 
-  loopfiles(toys.optargs, expand_file);
+  loopfiles(toys.optargs, do_expand);
   if (CFG_TOYBOX_FREE) free(TT.tab);
 }