Audit touch(1)

Only minor things, as I already worked heavily on this tool a while
ago.
Fix style in the main loop and wording in the manpage.
This commit is contained in:
FRIGN 2015-03-17 23:38:09 +01:00
parent 99ded174b2
commit 95fb7364a8
3 changed files with 6 additions and 6 deletions

2
README
View File

@ -76,7 +76,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
=*| tee yes none =*| tee yes none
=*| test yes none =*| test yes none
=*| time yes none =*| time yes none
=* touch yes none =*| touch yes none
#* tr yes none #* tr yes none
=*| true yes none =*| true yes none
=*| tty yes none =*| tty yes none

View File

@ -63,4 +63,4 @@ argument.
.Pp .Pp
The The
.Op Fl T .Op Fl T
flag is an extension to this specification. flag is an extension to that specification.

View File

@ -29,7 +29,7 @@ touch(const char *file)
eprintf("stat %s:", file); eprintf("stat %s:", file);
if (cflag) if (cflag)
return; return;
} else if (r == 0) { } else if (!r) {
ut.actime = aflag ? t : st.st_atime; ut.actime = aflag ? t : st.st_atime;
ut.modtime = mflag ? t : st.st_mtime; ut.modtime = mflag ? t : st.st_mtime;
if (utime(file, &ut) < 0) if (utime(file, &ut) < 0)
@ -149,13 +149,13 @@ main(int argc, char *argv[])
usage(); usage();
} ARGEND; } ARGEND;
if (argc < 1) if (!argc)
usage(); usage();
if (!aflag && !mflag) if (!aflag && !mflag)
aflag = mflag = 1; aflag = mflag = 1;
for (; argc > 0; argc--, argv++) for (; *argv; argc--, argv++)
touch(argv[0]); touch(*argv);
return 0; return 0;
} }