[hackers] [sbase] Audit touch(1) || FRIGN

From: <git_AT_suckless.org>
Date: Thu, 19 Mar 2015 11:13:24 +0100 (CET)

commit c1e2e3d948467760df0a0db810d882a8812c4791
Author: FRIGN <dev_AT_frign.de>
Date: Tue Mar 17 23:38:09 2015 +0100

    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.

diff --git a/README b/README
index bad461d..7915370 100644
--- a/README
+++ b/README
_AT_@ -76,7 +76,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
 =*| tee yes none
 =*| test yes none
 =*| time yes none
-=* touch yes none
+=*| touch yes none
 #* tr yes none
 =*| true yes none
 =*| tty yes none
diff --git a/touch.1 b/touch.1
index 3230b18..e820da6 100644
--- a/touch.1
+++ b/touch.1
_AT_@ -63,4 +63,4 @@ argument.
 .Pp
 The
 .Op Fl T
-flag is an extension to this specification.
+flag is an extension to that specification.
diff --git a/touch.c b/touch.c
index ed87253..563f919 100644
--- a/touch.c
+++ b/touch.c
_AT_@ -29,7 +29,7 @@ touch(const char *file)
                         eprintf("stat %s:", file);
                 if (cflag)
                         return;
- } else if (r == 0) {
+ } else if (!r) {
                 ut.actime = aflag ? t : st.st_atime;
                 ut.modtime = mflag ? t : st.st_mtime;
                 if (utime(file, &ut) < 0)
_AT_@ -149,13 +149,13 @@ main(int argc, char *argv[])
                 usage();
         } ARGEND;
 
- if (argc < 1)
+ if (!argc)
                 usage();
         if (!aflag && !mflag)
                 aflag = mflag = 1;
 
- for (; argc > 0; argc--, argv++)
- touch(argv[0]);
+ for (; *argv; argc--, argv++)
+ touch(*argv);
 
         return 0;
 }
Received on Thu Mar 19 2015 - 11:13:24 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 19 2015 - 11:24:31 CET