[hackers] [sbase] Respect exit status in strings(1) and update manpage || sin
commit aabcb69991ede9cb2fead853df548df5a572a117
Author: sin <sin_AT_2f30.org>
Date: Sun Nov 23 12:44:07 2014 +0000
Respect exit status in strings(1) and update manpage
diff --git a/strings.1 b/strings.1
index 3d8cdff..c930089 100644
--- a/strings.1
+++ b/strings.1
_AT_@ -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
index f4775ed..8f071c2 100644
--- a/strings.c
+++ b/strings.c
_AT_@ -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:
_AT_@ -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
Received on Sun Nov 23 2014 - 13:44:46 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 23 2014 - 13:48:09 CET