e5b5497773
Previously, the string-length was limited to BUFSIZ, which is an obvious deficiency. Now the buffer only needs to be as long as the user specifies the minimal string length. I added UTF-8-support, because that's how POSIX wants it and there are cases where you need this. It doesn't add ELF-barf compared to the previous implementation. The t-flag is also pretty important for POSIX-compliance, so I added it. The only trouble previously was the a-flag, but given that POSIX leaves undefined what the a-flag actually does, we set it as default and don't care about parsing ELF-headers, which has already turned out to be a security issue in GNU coreutils[0]. [0]: http://lcamtuf.blogspot.ro/2014/10/psa-dont-run-strings-on-untrusted-files.html
53 lines
868 B
Groff
53 lines
868 B
Groff
.Dd Februrary 17, 2015
|
|
.Dt STRINGS 1
|
|
.Os sbase
|
|
.Sh NAME
|
|
.Nm strings
|
|
.Nd print strings of printable characters in files
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl a
|
|
.Op Fl n Ar num
|
|
.Op Fl t Ar format
|
|
.Op Ar file ...
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
writes sequences of at least 4 printable characters in each
|
|
.Ar file
|
|
to stdout.
|
|
If no
|
|
.Ar file
|
|
is given,
|
|
.Nm
|
|
reads from stdin.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width Ds
|
|
.It Fl a
|
|
Scan each
|
|
.Ar file
|
|
entirely. This is the default.
|
|
.It Fl n Ar num
|
|
Print sequences of at least
|
|
.Ar num
|
|
characters. The default is 4.
|
|
.It Fl t Ar format
|
|
Prepend each string with its byte offset, with
|
|
.Ar format
|
|
being one of
|
|
.Sy d , o , x
|
|
for decimal, octal or hexadecimal numbers.
|
|
.El
|
|
.Sh STANDARDS
|
|
The
|
|
.Nm
|
|
utility is compliant with the
|
|
.St -p1003.1-2008
|
|
specification.
|
|
.Pp
|
|
The
|
|
.Op Fl t
|
|
output format has been changed from "%F %s" to "%8lF: %s", with
|
|
.Sy F
|
|
being one of
|
|
.Sy d , o , x .
|