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

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

commit 8d74095d07e169847dc0cf5af92efb15c6673653
Author: FRIGN <dev_AT_frign.de>
Date: Tue Mar 17 23:05:50 2015 +0100

    Audit strings(1)
    
    Only smaller style-changes. I already refactored the underlying
    logic a while ago.

diff --git a/README b/README
index 9ca1c74..183e433 100644
--- a/README
+++ b/README
_AT_@ -69,7 +69,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
     sort no -m, -o, -d, -f, -i
 =*| split yes none
 =*| sponge non-posix none
-#* strings yes none
+#*| strings yes none
 =* sync non-posix none
 =* tail yes none
 =* tar non-posix none
diff --git a/strings.c b/strings.c
index 4a7f685..8c6c094 100644
--- a/strings.c
+++ b/strings.c
_AT_@ -75,18 +75,19 @@ main(int argc, char *argv[])
                 usage();
         } ARGEND;
 
- if (argc == 0) {
+ if (!argc) {
                 strings(stdin, "<stdin>", len);
         } else {
- for (; argc > 0; argc--, argv++) {
- if (!(fp = fopen(argv[0], "r"))) {
- weprintf("fopen %s:", argv[0]);
+ for (; *argv; argc--, argv++) {
+ if (!(fp = fopen(*argv, "r"))) {
+ weprintf("fopen %s:", *argv);
                                 ret = 1;
                                 continue;
                         }
- strings(fp, argv[0], len);
+ strings(fp, *argv, len);
                         fclose(fp);
                 }
         }
+
         return ret;
 }
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:25 CET