sbase

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

commit aabcb69991ede9cb2fead853df548df5a572a117
parent d0604cc474fc8de5de45ae087b966cd991c9c0ff
Author: sin <sin@2f30.org>
Date:   Sun Nov 23 12:44:07 +0000

Respect exit status in strings(1) and update manpage

Diffstat:
strings.1 | 19+++++++++++--------
strings.c | 7++++---
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/strings.1 b/strings.1 @@ -1,10 +1,13 @@ -.TH STRINGS 1 sbase\-VERSION -.SH NAME -strings \- print the strings of printable characters in files -.SH SYNOPSIS -.B strings -.IR file... -.SH DESCRIPTION -.B strings +.Dd November 23, 2014 +.Dt STRINGS 1 sbase\-VERSION +.Os +.Sh NAME +.Nm strings +.Nd print the strings of pritable characters in files +.Sh SYNOPSIS +.Nm strings +.Op Ar file ... +.Sh DESCRIPTION +.Nm prints the printable character sequences that are at least 6 characters long. If no files are given then it uses stdin. diff --git a/strings.c b/strings.c @@ -10,13 +10,14 @@ static void dostrings(FILE *fp, const char *fname); static void usage(void) { - eprintf("usage: %s file...\n", argv0); + eprintf("usage: %s [file ...]\n", argv0); } int main(int argc, char *argv[]) { FILE *fp; + int ret = 0; ARGBEGIN { default: @@ -29,14 +30,14 @@ main(int argc, char *argv[]) for (; argc > 0; argc--, argv++) { if (!(fp = fopen(argv[0], "r"))) { weprintf("fopen %s:", argv[0]); + ret = 1; continue; } dostrings(fp, argv[0]); fclose(fp); } } - - return 0; + return ret; } static void