mirror of https://github.com/mkerrisk/man-pages
223 lines
6.0 KiB
Groff
223 lines
6.0 KiB
Groff
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
|
||
|
.TH "STRINGS" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
||
|
.\" strings
|
||
|
.SH NAME
|
||
|
strings \- find printable strings in files
|
||
|
.SH SYNOPSIS
|
||
|
.LP
|
||
|
\fBstrings\fP \fB[\fP\fB-a\fP\fB][\fP\fB-t\fP \fIformat\fP\fB][\fP\fB-n\fP
|
||
|
\fInumber\fP\fB][\fP\fIfile\fP\fB...\fP\fB]\fP\fB\fP
|
||
|
.SH DESCRIPTION
|
||
|
.LP
|
||
|
The \fIstrings\fP utility shall look for printable strings in regular
|
||
|
files and shall write those strings to standard output. A
|
||
|
printable string is any sequence of four (by default) or more printable
|
||
|
characters terminated by a <newline> or NUL
|
||
|
character. Additional implementation-defined strings may be written;
|
||
|
see \fIlocaledef\fP.
|
||
|
.SH OPTIONS
|
||
|
.LP
|
||
|
The \fIstrings\fP utility shall conform to the Base Definitions volume
|
||
|
of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
|
||
|
.LP
|
||
|
The following options shall be supported:
|
||
|
.TP 7
|
||
|
\fB-a\fP
|
||
|
Scan files in their entirety. If \fB-a\fP is not specified, it is
|
||
|
implementation-defined what portion of each file is scanned
|
||
|
for strings.
|
||
|
.TP 7
|
||
|
\fB-n\ \fP \fInumber\fP
|
||
|
Specify the minimum string length, where the \fInumber\fP argument
|
||
|
is a positive decimal integer. The default shall be 4.
|
||
|
.TP 7
|
||
|
\fB-t\ \fP \fIformat\fP
|
||
|
Write each string preceded by its byte offset from the start of the
|
||
|
file. The format shall be dependent on the single character
|
||
|
used as the \fIformat\fP option-argument:
|
||
|
.TP 7
|
||
|
\fBd\fP
|
||
|
.RS
|
||
|
The offset shall be written in decimal.
|
||
|
.RE
|
||
|
.TP 7
|
||
|
\fBo\fP
|
||
|
.RS
|
||
|
The offset shall be written in octal.
|
||
|
.RE
|
||
|
.TP 7
|
||
|
\fBx\fP
|
||
|
.RS
|
||
|
The offset shall be written in hexadecimal.
|
||
|
.RE
|
||
|
.sp
|
||
|
.sp
|
||
|
.SH OPERANDS
|
||
|
.LP
|
||
|
The following operand shall be supported:
|
||
|
.TP 7
|
||
|
\fIfile\fP
|
||
|
A pathname of a regular file to be used as input. If no \fIfile\fP
|
||
|
operand is specified, the \fIstrings\fP utility shall read
|
||
|
from the standard input.
|
||
|
.sp
|
||
|
.SH STDIN
|
||
|
.LP
|
||
|
See the INPUT FILES section.
|
||
|
.SH INPUT FILES
|
||
|
.LP
|
||
|
The input files named by the utility arguments or the standard input
|
||
|
shall be regular files of any format.
|
||
|
.SH ENVIRONMENT VARIABLES
|
||
|
.LP
|
||
|
The following environment variables shall affect the execution of
|
||
|
\fIstrings\fP:
|
||
|
.TP 7
|
||
|
\fILANG\fP
|
||
|
Provide a default value for the internationalization variables that
|
||
|
are unset or null. (See the Base Definitions volume of
|
||
|
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
|
||
|
for
|
||
|
the precedence of internationalization variables used to determine
|
||
|
the values of locale categories.)
|
||
|
.TP 7
|
||
|
\fILC_ALL\fP
|
||
|
If set to a non-empty string value, override the values of all the
|
||
|
other internationalization variables.
|
||
|
.TP 7
|
||
|
\fILC_CTYPE\fP
|
||
|
Determine the locale for the interpretation of sequences of bytes
|
||
|
of text data as characters (for example, single-byte as
|
||
|
opposed to multi-byte characters in arguments and input files) and
|
||
|
to identify printable strings.
|
||
|
.TP 7
|
||
|
\fILC_MESSAGES\fP
|
||
|
Determine the locale that should be used to affect the format and
|
||
|
contents of diagnostic messages written to standard
|
||
|
error.
|
||
|
.TP 7
|
||
|
\fINLSPATH\fP
|
||
|
Determine the location of message catalogs for the processing of \fILC_MESSAGES
|
||
|
\&.\fP
|
||
|
.sp
|
||
|
.SH ASYNCHRONOUS EVENTS
|
||
|
.LP
|
||
|
Default.
|
||
|
.SH STDOUT
|
||
|
.LP
|
||
|
Strings found shall be written to the standard output, one per line.
|
||
|
.LP
|
||
|
When the \fB-t\fP option is not specified, the format of the output
|
||
|
shall be:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fB"%s", <\fP\fIstring\fP\fB>
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
With the \fB-t\ o\fP option, the format of the output shall be:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fB"%o %s", <\fP\fIbyte offset\fP\fB>, <\fP\fIstring\fP\fB>
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
With the \fB-t\ x\fP option, the format of the output shall be:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fB"%x %s", <\fP\fIbyte offset\fP\fB>, <\fP\fIstring\fP\fB>
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.LP
|
||
|
With the \fB-t\ d\fP option, the format of the output shall be:
|
||
|
.sp
|
||
|
.RS
|
||
|
.nf
|
||
|
|
||
|
\fB"%d %s", <\fP\fIbyte offset\fP\fB>, <\fP\fIstring\fP\fB>
|
||
|
\fP
|
||
|
.fi
|
||
|
.RE
|
||
|
.SH STDERR
|
||
|
.LP
|
||
|
The standard error shall be used only for diagnostic messages.
|
||
|
.SH OUTPUT FILES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXTENDED DESCRIPTION
|
||
|
.LP
|
||
|
None.
|
||
|
.SH EXIT STATUS
|
||
|
.LP
|
||
|
The following exit values shall be returned:
|
||
|
.TP 7
|
||
|
\ 0
|
||
|
Successful completion.
|
||
|
.TP 7
|
||
|
>0
|
||
|
An error occurred.
|
||
|
.sp
|
||
|
.SH CONSEQUENCES OF ERRORS
|
||
|
.LP
|
||
|
Default.
|
||
|
.LP
|
||
|
\fIThe following sections are informative.\fP
|
||
|
.SH APPLICATION USAGE
|
||
|
.LP
|
||
|
By default the data area (as opposed to the text, "bss", or header
|
||
|
areas) of a binary executable file is scanned.
|
||
|
Implementations document which areas are scanned.
|
||
|
.LP
|
||
|
Some historical implementations do not require NUL or <newline> terminators
|
||
|
for strings to permit those languages that do
|
||
|
not use NUL as a string terminator to have their strings written.
|
||
|
.SH EXAMPLES
|
||
|
.LP
|
||
|
None.
|
||
|
.SH RATIONALE
|
||
|
.LP
|
||
|
Apart from rationalizing the option syntax and slight difficulties
|
||
|
with object and executable binary files, \fIstrings\fP is
|
||
|
specified to match historical practice closely. The \fB-a\fP and \fB-n\fP
|
||
|
options were introduced to replace the non-conforming
|
||
|
\fB-\fP and \fB-\fP \fInumber\fP options.
|
||
|
.LP
|
||
|
The \fB-o\fP option historically means different things on different
|
||
|
implementations. Some use it to mean " \fIoffset\fP in
|
||
|
decimal", while others use it as " \fIoffset\fP in octal". Instead
|
||
|
of trying to decide which way would be least objectionable,
|
||
|
the \fB-t\fP option was added. It was originally named \fB-O\fP to
|
||
|
mean "offset", but was changed to \fB-t\fP to be consistent
|
||
|
with \fIod\fP.
|
||
|
.LP
|
||
|
The ISO\ C standard function \fIisprint\fP() is restricted to a domain
|
||
|
of
|
||
|
\fBunsigned char\fP. This volume of IEEE\ Std\ 1003.1-2001 requires
|
||
|
implementations to write strings as defined by the
|
||
|
current locale.
|
||
|
.SH FUTURE DIRECTIONS
|
||
|
.LP
|
||
|
None.
|
||
|
.SH SEE ALSO
|
||
|
.LP
|
||
|
\fIlocaledef\fP , \fInm\fP
|
||
|
.SH COPYRIGHT
|
||
|
Portions of this text are reprinted and reproduced in electronic form
|
||
|
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
|
||
|
-- Portable Operating System Interface (POSIX), The Open Group Base
|
||
|
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
|
||
|
Electrical and Electronics Engineers, Inc and The Open Group. In the
|
||
|
event of any discrepancy between this version and the original IEEE and
|
||
|
The Open Group Standard, the original IEEE and The Open Group Standard
|
||
|
is the referee document. The original Standard can be obtained online at
|
||
|
http://www.opengroup.org/unix/online.html .
|