diff options
author | Assaf Gordon <assafgordon@gmail.com> | 2016-11-04 21:29:51 -0400 |
---|---|---|
committer | Assaf Gordon <assafgordon@gmail.com> | 2016-11-04 21:29:51 -0400 |
commit | 9796bdd2d6d76ad2a84599546be7b62289454c1a (patch) | |
tree | 7ef6f7a45035a8efd3000a976192cfd23877f10a /doc/sed-in.texi | |
parent | 50d2687936e66aca03c4e46170f9d5b64a79fa2e (diff) | |
download | sed-9796bdd2d6d76ad2a84599546be7b62289454c1a.tar.gz |
sed: standardize exit code values
Use exit-code constants, and document them:
1=syntax error, 2=bad input files, 4=I/O error or panic.
Add "Exit Status" section in manual.
* sed/utils.h: Define new constants.
* sed/utils.c,
sed/compile.c,
sed/execute.c,
sed/sed.c: Use constants instead of hard-coded values.
* doc/sed-in.texi: Add "Exit Status" section.
* doc/sed.texi: Automatically re-generated.
Diffstat (limited to 'doc/sed-in.texi')
-rw-r--r-- | doc/sed-in.texi | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/sed-in.texi b/doc/sed-in.texi index d5510c0..c249700 100644 --- a/doc/sed-in.texi +++ b/doc/sed-in.texi @@ -78,6 +78,7 @@ Boston, MA 02110-1301, USA @menu * Introduction:: Introduction * Invoking sed:: Invocation +* Exit status:: Exit status * sed Programs:: @command{sed} programs * Examples:: Some sample scripts * Limitations:: Limitations and (non-)limitations of @value{SSED} @@ -411,6 +412,39 @@ be processed. A file name of @samp{-} refers to the standard input stream. The standard input will be processed if no file names are specified. +@node Exit status +@chapter Exit status +@cindex exit status +An exit status of zero indicates success, and a nonzero value +indicates failure. @value{SSED} returns the following exit status +error values: + +@table @asis +@item 0 +Successful completion. + +@item 1 +Invalid command, invalid syntax, invalid regular expression or a +@value{SSED} extension command used with @option{--posix}. + +@item 2 +One or more of the input file specified on the command line could not be +opened (e.g. if a file is not found, or read permission is denied). +Processing continued with other files. + +@item 4 +An I/O error, or a serious processing error during runtime, +@value{SSED} aborted immediately. +@end table + +Additionally, the commands @code{q} and @code{Q} can be used to terminate +@command{sed} with a custom exit code value (this is a @value{SSED} extension): + +@example +$ echo | sed 'Q42' ; echo $? +42 +@end example + @node sed Programs @chapter @command{sed} Programs |