Respect exit status in strings(1) and update manpage

This commit is contained in:
sin 2014-11-23 12:44:07 +00:00
parent d0604cc474
commit aabcb69991
2 changed files with 15 additions and 11 deletions

View File

@ -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.

View File

@ -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