Merge remote-tracking branch 'toybox/master' into HEAD
diff --git a/tests/touch.test b/tests/touch.test
index 263e9a0..da6fe99 100755
--- a/tests/touch.test
+++ b/tests/touch.test
@@ -64,9 +64,15 @@
   "touch -t 2101231234 input && date +%Y-%m-%d:%H-%M-%S -r input" \
   "$(date +%C)21-01-23:12-34-00\n" "" ""
 
+testing "-a" "touch -t 197101020304 walrus &&
+    touch -t 197203040506 -a walrus && stat -c '%X %Y' walrus" \
+    "68562360 31662240\n" "" ""
+testing "-m" "touch -t 197101020304  walrus &&
+    touch -t 197203040506 -m walrus && stat -c '%X %Y' walrus" \
+    "31662240 68562360\n" "" ""
+testing "-am" "touch -t 197101020304 walrus &&
+    touch -t 197203040506 -am walrus && stat -c '%X %Y' walrus" \
+    "68562360 68562360\n" "" ""
 
-#testing "-a"
-#testing "-m"
-#testing "-am"
 #testing "-t"
 rm walrus walrus2
diff --git a/tests/uudecode.test b/tests/uudecode.test
index 2c3bba6..966359e 100755
--- a/tests/uudecode.test
+++ b/tests/uudecode.test
@@ -4,24 +4,23 @@
 
 #testing "name" "command" "result" "infile" "stdin"
 
-testing "uu empty file" "uudecode -o /dev/stdout && echo yes" \
+testing "uu empty file" "uudecode -o - && echo yes" \
 	"yes\n" "" "begin 744 test\n\`\nend\n"
-testing "uu 1-char" "uudecode -o /dev/stdout" "a" "" \
+testing "uu 1-char" "uudecode -o -" "a" "" \
 	"begin 744 test\n!80  \n\`\nend\n"
-testing "uu 2-char" "uudecode -o /dev/stdout" "ab" "" \
+testing "uu 2-char" "uudecode -o -" "ab" "" \
 	"begin 744 test\n\"86( \n\`\nend\n"
-testing "uu 3-char" "uudecode -o /dev/stdout" "abc" "" \
+testing "uu 3-char" "uudecode -o -" "abc" "" \
 	"begin 744 test\n#86)C\n\`\nend\n" 
 
-testing "b64 empty file" "uudecode -o /dev/stdout && echo yes" \
+testing "b64 empty file" "uudecode -o - && echo yes" \
         "yes\n" "" "begin-base64 744 test\n====\n" 
-testing "b64 1-char" "uudecode -o /dev/stdout" "a" "" \
+testing "b64 1-char" "uudecode -o -" "a" "" \
 	"begin-base64 744 test\nYQ==\n====\n"
-testing "b64 2-char" "uudecode -o /dev/stdout" "ab" "" \
+testing "b64 2-char" "uudecode -o -" "ab" "" \
 	"begin-base64 744 test\nYWI=\n====\n"
-testing "b64 3-char" "uudecode -o /dev/stdout" "abc" "" \
+testing "b64 3-char" "uudecode -o -" "abc" "" \
 	"begin-base64 744 test\nYWJj\n====\n"
 
-testing "filename" "uudecode && echo -ne 'abc' | cmp uudecode-fn-test /dev/stdin && echo -ne yes && rm uudecode-fn-test" \
+testing "filename" "uudecode && echo -ne 'abc' | cmp uudecode-fn-test - && echo -ne yes && rm uudecode-fn-test" \
 	"yes" "" "begin-base64 744 uudecode-fn-test\nYWJj\n====\n"
-
diff --git a/toys/pending/fdisk.c b/toys/pending/fdisk.c
index d000c05..08cfa71 100644
--- a/toys/pending/fdisk.c
+++ b/toys/pending/fdisk.c
@@ -1486,7 +1486,7 @@
     toys.exitval = 0;
     return;
   } else {
-    if (toys.optc != 1) help_exit(stdout);
+    if (toys.optc != 1) help_exit(0);
     if (read_mbr(toys.optargs[0], 1)) return;
     while (1) {
       xputc('\n');
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index 9846c6c..610e953 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -388,7 +388,6 @@
   }
 
   // Loop through again to produce output.
-  memset(toybuf, ' ', 256);
   width = 0;
   for (ul = 0; ul<dtlen; ul++) {
     int ii;
@@ -405,15 +404,17 @@
     // Handle padding and wrapping for display purposes
     entrylen(sort[next], len);
     if (ul) {
-      if (flags & FLAG_m) xputc(',');
+      int mm = !!(flags & FLAG_m);
+
+      if (mm) xputc(',');
       if (flags & (FLAG_C|FLAG_x)) {
         if (!curcol) xputc('\n');
-      } else if ((flags & FLAG_1) || width+2+*len > TT.screen_width) {
+      } else if ((flags & FLAG_1) || width+1+*len > TT.screen_width) {
         xputc('\n');
         width = 0;
       } else {
-        printf("  ");
-        width += 2;
+        printf("  "+mm, 0); // shut up the stupid compiler
+        width += 2-mm;
       }
     }
     width += *len;
@@ -498,7 +499,7 @@
     // Pad columns
     if (flags & (FLAG_C|FLAG_x)) {
       curcol = colsizes[curcol]-(*len)-totpad;
-      if (curcol < 255) printf("%s", toybuf+255-curcol);
+      if (curcol < 255) printf("%*c", curcol, ' ');
     }
   }
 
diff --git a/toys/posix/touch.c b/toys/posix/touch.c
index 79eba17..214d6cf 100644
--- a/toys/posix/touch.c
+++ b/toys/posix/touch.c
@@ -111,7 +111,7 @@
 
   // Which time(s) should we actually change?
   i = toys.optflags & (FLAG_a|FLAG_m);
-  if (i && i!=(FLAG_a|FLAG_m)) ts[i==FLAG_m].tv_nsec = UTIME_OMIT;
+  if (i && i!=(FLAG_a|FLAG_m)) ts[i!=FLAG_m].tv_nsec = UTIME_OMIT;
 
   // Loop through files on command line
   for (ss = toys.optargs; *ss;) {
diff --git a/toys/posix/uudecode.c b/toys/posix/uudecode.c
index 238e27e..4d2861a 100644
--- a/toys/posix/uudecode.c
+++ b/toys/posix/uudecode.c
@@ -41,7 +41,8 @@
     }
   }
 
-  ofd = xcreate(TT.o ? TT.o : line+idx, O_WRONLY|O_CREAT|O_TRUNC,
+  if (TT.o && !strcmp(TT.o, "-")) ofd = 1;
+  else ofd = xcreate(TT.o ? TT.o : line+idx, O_WRONLY|O_CREAT|O_TRUNC,
     string_to_mode(mode, 0777^toys.old_umask));
 
   for(;;) {