sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 32b9d76747e52b84d33a508de08a5e35c0f9dcc9
parent 3725d501b39f7c3e8e5cbb681bf74df3ad47fd56
Author: FRIGN <dev@frign.de>
Date:   Tue, 17 Mar 2015 23:05:50 +0100

Audit strings(1)

Only smaller style-changes. I already refactored the underlying
logic a while ago.

Diffstat:
MREADME | 2+-
Mstrings.c | 11++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/README b/README @@ -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 @@ -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; }