summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2003-03-14 11:05:56 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2003-03-14 11:05:56 +0000
commitcc49397417497f37be1fb61c9372849290ecfc17 (patch)
tree09f54dfd91446718dfb097c50cd9e25bc8849bb6 /bin
parentfeefc8787e3b2cf2450d557a00479046ba6e1202 (diff)
better document how getopts handles options;
plus typos; from J.A. Neitzel; Fixes PR 3141; ok millert@
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/ksh.115
-rw-r--r--bin/ksh/ksh.1tbl15
-rw-r--r--bin/ksh/sh.115
-rw-r--r--bin/ksh/sh.1tbl15
4 files changed, 36 insertions, 24 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1
index f2cd2275ed2..060bf1aa8de 100644
--- a/bin/ksh/ksh.1
+++ b/bin/ksh/ksh.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ksh.1,v 1.48 2002/09/18 07:33:47 deraadt Exp $
+.\" $OpenBSD: ksh.1,v 1.49 2003/03/14 11:05:55 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -536,7 +536,7 @@ and
.Ql /
are dropped.
Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted.
+stripped; any space within a pattern must be quoted.
Both the word and the
patterns are subject to parameter, command, and arithmetic substitution, as
well as tilde substitution.
@@ -2951,7 +2951,7 @@ and the index of the next argument to be processed in the shell parameter
.Ev OPTIND .
If the option was introduced with a
.Ql + ,
-the option places in
+the option placed in
.Ar name
is prefixed with a
.Ql + .
@@ -2963,11 +2963,14 @@ When an illegal option or a missing option argument is encountered, a question
mark or a colon is placed in
.Ar name
(indicating an illegal option or missing argument, respectively) and
-.Ev OPTAG
+.Ev OPTARG
is set to the option character that caused the problem.
-An error message is also printed to standard error if
+If
.Ar optstring
-does not being with a colon.
+does not begin with a colon, a question mark is placed in
+.Ar name ,
+.Ev OPTARG
+is unset and an error message is printed to standard error.
.Pp
When the end of the options is encountered,
.Ic getopts
diff --git a/bin/ksh/ksh.1tbl b/bin/ksh/ksh.1tbl
index 42181bd3cb3..402ee5b2a4e 100644
--- a/bin/ksh/ksh.1tbl
+++ b/bin/ksh/ksh.1tbl
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ksh.1tbl,v 1.48 2002/09/18 07:33:47 deraadt Exp $
+.\" $OpenBSD: ksh.1tbl,v 1.49 2003/03/14 11:05:55 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -536,7 +536,7 @@ and
.Ql /
are dropped.
Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted.
+stripped; any space within a pattern must be quoted.
Both the word and the
patterns are subject to parameter, command, and arithmetic substitution, as
well as tilde substitution.
@@ -2951,7 +2951,7 @@ and the index of the next argument to be processed in the shell parameter
.Ev OPTIND .
If the option was introduced with a
.Ql + ,
-the option places in
+the option placed in
.Ar name
is prefixed with a
.Ql + .
@@ -2963,11 +2963,14 @@ When an illegal option or a missing option argument is encountered, a question
mark or a colon is placed in
.Ar name
(indicating an illegal option or missing argument, respectively) and
-.Ev OPTAG
+.Ev OPTARG
is set to the option character that caused the problem.
-An error message is also printed to standard error if
+If
.Ar optstring
-does not being with a colon.
+does not begin with a colon, a question mark is placed in
+.Ar name ,
+.Ev OPTARG
+is unset and an error message is printed to standard error.
.Pp
When the end of the options is encountered,
.Ic getopts
diff --git a/bin/ksh/sh.1 b/bin/ksh/sh.1
index 36e9b7c6db8..cd1c46c0803 100644
--- a/bin/ksh/sh.1
+++ b/bin/ksh/sh.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sh.1,v 1.30 2002/09/18 07:33:47 deraadt Exp $
+.\" $OpenBSD: sh.1,v 1.31 2003/03/14 11:05:55 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -515,7 +515,7 @@ and
.Ql /
are dropped.
Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted.
+stripped; any space within a pattern must be quoted.
Both the word and the
patterns are subject to parameter, command, and arithmetic substitution, as
well as tilde substitution.
@@ -2484,7 +2484,7 @@ and the index of the next argument to be processed in the shell parameter
.Ev OPTIND .
If the option was introduced with a
.Ql + ,
-the option places in
+the option placed in
.Ar name
is prefixed with a
.Ql + .
@@ -2496,11 +2496,14 @@ When an illegal option or a missing option argument is encountered, a question
mark or a colon is placed in
.Ar name
(indicating an illegal option or missing argument, respectively) and
-.Ev OPTAG
+.Ev OPTARG
is set to the option character that caused the problem.
-An error message is also printed to standard error if
+If
.Ar optstring
-does not being with a colon.
+does not begin with a colon, a question mark is placed in
+.Ar name ,
+.Ev OPTARG
+is unset and an error message is printed to standard error.
.Pp
When the end of the options is encountered,
.Ic getopts
diff --git a/bin/ksh/sh.1tbl b/bin/ksh/sh.1tbl
index a42074ef950..7a7e8ccace0 100644
--- a/bin/ksh/sh.1tbl
+++ b/bin/ksh/sh.1tbl
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sh.1tbl,v 1.30 2002/09/18 07:33:47 deraadt Exp $
+.\" $OpenBSD: sh.1tbl,v 1.31 2003/03/14 11:05:55 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -515,7 +515,7 @@ and
.Ql /
are dropped.
Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted.
+stripped; any space within a pattern must be quoted.
Both the word and the
patterns are subject to parameter, command, and arithmetic substitution, as
well as tilde substitution.
@@ -2484,7 +2484,7 @@ and the index of the next argument to be processed in the shell parameter
.Ev OPTIND .
If the option was introduced with a
.Ql + ,
-the option places in
+the option placed in
.Ar name
is prefixed with a
.Ql + .
@@ -2496,11 +2496,14 @@ When an illegal option or a missing option argument is encountered, a question
mark or a colon is placed in
.Ar name
(indicating an illegal option or missing argument, respectively) and
-.Ev OPTAG
+.Ev OPTARG
is set to the option character that caused the problem.
-An error message is also printed to standard error if
+If
.Ar optstring
-does not being with a colon.
+does not begin with a colon, a question mark is placed in
+.Ar name ,
+.Ev OPTARG
+is unset and an error message is printed to standard error.
.Pp
When the end of the options is encountered,
.Ic getopts