openbsd-ports/misc/gnugetopt/patches/patch-getopt_1
bernd 6a5d8b9dd3 Initial import of gnugetopt-1.1.4.
GNU getopt(1) is a program to help shell scripts parse command-line parameters.

Port started by msf@ and finished by me.

ok msf@
2006-11-03 13:25:02 +00:00

200 lines
6.1 KiB
Plaintext

$OpenBSD: patch-getopt_1,v 1.1.1.1 2006/11/03 13:25:02 bernd Exp $
--- getopt.1.orig Mon Nov 7 23:16:38 2005
+++ getopt.1 Thu Nov 2 15:21:45 2006
@@ -1,14 +1,14 @@
-.TH GETOPT 1 "May 31, 1997" Linux ""
+.TH GNUGETOPT 1 "May 31, 1997" Linux ""
.SH NAME
-getopt \- parse command options (enhanced)
+gnugetopt \- parse command options (enhanced)
.SH SYNOPSIS
-.BR getopt " optstring parameters"
+.BR gnugetopt " optstring parameters"
-.BR getopt " [options] [" \-\- "] optstring parameters"
+.BR gnugetopt " [options] [" \-\- "] optstring parameters"
-.BR getopt " [options] " \-o | \-\-options " optstring [options] [" \-\- "] parameters"
+.BR gnugetopt " [options] " \-o | \-\-options " optstring [options] [" \-\- "] parameters"
.SH DESCRIPTION
-.B getopt
+.B gnugetopt
is used to break up
.RI ( parse )
options in command lines for easy parsing by
@@ -19,9 +19,9 @@ It uses the
routines to do this.
The parameters
-.B getopt
+.B gnugetopt
is called with can be divided into two parts: options
-which modify the way getopt will parse
+which modify the way gnugetopt will parse
.RI ( options
and
.I \-o|\-\-options optstring
@@ -49,7 +49,7 @@ is not an option (does not start with a
.RB ` \- ',
this is the first format in the
.BR SYNOPSIS),
-.B getopt
+.B gnugetopt
will generate output that is compatible with that of other versions of
.BR getopt (1).
It will still do parameter shuffling and recognize optional
@@ -67,12 +67,12 @@ by using the
.B eval
command). This has the effect of preserving those characters, but
you must call
-.B getopt
+.B gnugetopt
in a way that is no longer compatible with other versions (the second
or third format in the
.BR SYNOPSIS).
To determine whether this enhanced version of
-.BR getopt (1)
+.BR gnugetopt (1)
is installed, a special test option
.RB ( \-T )
can be used.
@@ -95,14 +95,14 @@ in
may be followed by one colon to indicate it has a required argument,and by two colons to indicate it has an optional argument.
.IP "\-n, \-\-name progname"
The name that will be used by the
-.BR getopt (3)
+.BR gnugetopt (3)
routines when it reports errors. Note that errors of
-.BR getopt (1)
-are still reported as coming from getopt.
+.BR gnugetopt (1)
+are still reported as coming from gnugetopt.
.IP "\-o, \-\-options shortopts"
The short (one\-character) options to be recognized. If this option is not
found, the first parameter of
-.B getopt
+.B gnugetopt
that does not start with
a
.RB ` \- '
@@ -121,10 +121,10 @@ options are parsed and output is generat
.B SCANNING MODES
for details).
.IP "\-q, \-\-quiet"
-Disable error reporting by getopt(3).
+Disable error reporting by gnugetopt(3).
.IP "\-Q, \-\-quiet\-output"
Do not generate normal output. Errors are still reported by
-.BR getopt (3),
+.BR gnugetopt (3),
unless you also use
.IR \-q .
.IP "\-s, \-\-shell shell"
@@ -144,7 +144,7 @@ characters can cause havoc in this mode
implementations).
.IP "\-T \-\-test"
Test if your
-.BR getopt (1)
+.BR gnugetopt (1)
is this enhanced version or an old version. This generates no output,
and sets the error status to 4. Other implementations of
.BR getopt (1),
@@ -158,7 +158,7 @@ and error status 0.
Output version information and exit succesfully. No other output is generated.
.SH PARSING
This section specifies the format of the second part of the parameters of
-.B getopt
+.B gnugetopt
(the
.I parameters
in the
@@ -170,7 +170,7 @@ generated. These parameters were typical
was called with.
Care must be taken that each parameter the shell function was
called with corresponds to exactly one parameter in the parameter list of
-.B getopt
+.B gnugetopt
(see the
.BR EXAMPLES ).
All parsing is done by the GNU
@@ -355,14 +355,14 @@ parameter is still generated, but it wil
this mode.
.SH COMPATIBILITY
This version of
-.BR getopt (1)
+.BR gnugetopt (1)
is written to be as compatible as possible to
other versions. Usually you can just replace them with this version
without any modifications, and with some advantages.
-If the first character of the first parameter of getopt is not a
+If the first character of the first parameter of gnugetopt is not a
.RB ` \- ',
-getopt goes into compatibility mode. It will interpret its first parameter as
+gnugetopt goes into compatibility mode. It will interpret its first parameter as
the string of short options, and all other arguments will be parsed. It
will still do parameter shuffling (ie. all non\-option parameters are outputed
at the end), unless the environment variable
@@ -372,7 +372,7 @@ is set.
The environment variable
.B GETOPT_COMPATIBLE
forces
-.B getopt
+.B gnugetopt
into compatibility mode. Setting both this environment variable and
.B POSIXLY_CORRECT
offers 100% compatibility for `difficult' programs. Usually, though,
@@ -384,13 +384,13 @@ and
.RB ` + '
characters in the short options string are ignored.
.SH RETURN CODES
-.B getopt
+.B gnugetopt
returns error code
.B 0
for succesful parsing,
.B 1
if
-.BR getopt (3)
+.BR gnugetopt (3)
returns errors,
.B 2
if it does not understand its own parameters,
@@ -401,15 +401,13 @@ if it is called with
.BR \-T .
.SH EXAMPLES
Example scripts for (ba)sh and (t)csh are provided with the
-.BR getopt (1)
+.BR gnugetopt (1)
distribution, and are optionally installed in
-.B /usr/local/lib/getopt
-or
-.BR /usr/lib/getopt .
+.B /usr/local/share/examples/gnugetopt .
.SH ENVIRONMENT
.IP POSIXLY_CORRECT
This environment variable is examined by the
-.BR getopt (3)
+.BR gnugetopt (3)
routines.
If it is set, parsing stops as soon as a parameter
is found that is not an option or an option argument. All remaining
@@ -418,14 +416,14 @@ whether they start with a
.RB ` \- '.
.IP GETOPT_COMPATIBLE
Forces
-.B getopt
+.B gnugetopt
to use the first calling format as specified in the
.BR SYNOPSIS .
.SH BUGS
-.BR getopt (3)
+.BR gnugetopt (3)
can parse long options with optional arguments that are given an empty optional
argument (but can not do this for short options). This
-.BR getopt (1)
+.BR gnugetopt (1)
treats optional arguments that are empty as if they were not present.
The syntax if you do not want any short option variables at all is