summaryrefslogtreecommitdiff
path: root/usr.bin/getopt
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1994-11-08 19:51:51 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1994-11-08 19:51:51 +0000
commitf4856526c75b2c41c79507c179357bc902687282 (patch)
tree28630d63f9905311c39fe883978ad96c85adfd0d /usr.bin/getopt
parentba48a7c378d0c7cd5de85feaf7c6d51f8237859c (diff)
This commit was manufactured by cvs2svn to create branch 'ALPHA_2_0'.
Notes
svn path=/releng/ALPHA_2_0/; revision=4294
Diffstat (limited to 'usr.bin/getopt')
-rw-r--r--usr.bin/getopt/Makefile7
-rw-r--r--usr.bin/getopt/README57
-rw-r--r--usr.bin/getopt/getopt.1103
-rw-r--r--usr.bin/getopt/getopt.c30
4 files changed, 0 insertions, 197 deletions
diff --git a/usr.bin/getopt/Makefile b/usr.bin/getopt/Makefile
deleted file mode 100644
index 21dde959afa2..000000000000
--- a/usr.bin/getopt/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# $Header: /b/source/CVS/src/usr.bin/getopt/Makefile,v 1.1 1993/06/21 12:43:58 brezak Exp $
-#
-
-PROG = getopt
-MAN1 = getopt.1
-
-.include <bsd.prog.mk>
diff --git a/usr.bin/getopt/README b/usr.bin/getopt/README
deleted file mode 100644
index 55e699872994..000000000000
--- a/usr.bin/getopt/README
+++ /dev/null
@@ -1,57 +0,0 @@
-/***** unido:mod.std.unix / ut-sally!jsq / 8:54 pm Jul 4, 1985*/
-From: John Quarterman (moderator) <ut-sally!std-unix>
-
-Topic: yet more on getopt (command line arguments)
-
-Two more messages, the first a followup to a previous posting, and
-the second public domain sources and man pages for getopt(3) and getopt(1).
- -mod
-
-----------------------------------------------------------------------
-
-From: ihnp4!utzoo!henry
-Date: 3 Jul 85 18:34:41 CDT (Wed)
-To: ihnp4!ut-sally!std-unix
-Subject: Re: command line arguments
-
-> > A group of bundled options may end with an option that has an argument.
->
-> This creates confusion in using C-Kermit when you want to send an image
-> file. For example:
->
-> send -is filename < --- works fine
-> send -si filename < --- bombs the program
-
-The AT&T syntax standard (which getopt does not completely enforce)
-actually forbids both of these usages. Options with arguments are not
-allowed to be bundled, and they must be separated from their arguments
-by a space.
-
-> I would *much* prefer to bundle the flags, then
-> have those with arguments pick them up in the same order as the flags are
-> listed.
-
-The few existing commands that use such a convention, notably tar(1), are
-(in my experience) the worse for it. It's seriously error-prone. I think
-the AT&T people did the right thing.
-
-------------------------------
-
-Date: Tue, 2 Jul 85 13:07:09 edt
-From: ihnp4!utcs!ian (Ian F. Darwin)
-To: ihnp4!ut-sally!jsq@tzec.UTEXAS.ARPA
-Subject: here is getopt
-
-Here is the source for getopt(3), the function that should be in
-everybody's C program, and getopt(1), a program that uses it to
-make shell programs comprehensible and consistent. There are man
-pages for both. Please send these on to the mod. group. Thanks.
-
-[ I have hacked the following shell script slightly so that
-it doesn't extract directly into system source directories,
-rather into the current directory. It should be assumed that
-this code comes with no warranty from me, Ian Darwin, or anyone
-else as to whether it accurately represents getopt as distributed
-with System V, or any command line standard, or that it works
-at all, or that it will cause no damage when extracted or used. -mod]
-
diff --git a/usr.bin/getopt/getopt.1 b/usr.bin/getopt/getopt.1
deleted file mode 100644
index 16a50f090a57..000000000000
--- a/usr.bin/getopt/getopt.1
+++ /dev/null
@@ -1,103 +0,0 @@
-.Dd June 21, 1993
-.Dt GETOPT 1
-.Os
-.Sh NAME
-.Nm getopt
-.Nd parse command options
-.Sh SYNOPSIS
-.Nm set \-\- \`getopt optstring $*\`
-.Sh DESCRIPTION
-.Nm Getopt
-is used to break up options in command lines for easy parsing by
-shell procedures, and to check for legal options.
-.Op Optstring
-is a string of recognized option letters (see
-.Xr getopt 3
-);
-if a letter is followed by a colon, the option
-is expected to have an argument which may or may not be
-separated from it by white space.
-The special option
-.B \-\-
-is used to delimit the end of the options.
-.Nm Getopt
-will place
-.B \-\-
-in the arguments at the end of the options,
-or recognize it if used explicitly.
-The shell arguments
-(\fB$1 $2\fR ...) are reset so that each option is
-preceded by a
-.B \-
-and in its own shell argument;
-each option argument is also in its own shell argument.
-.Sh EXAMPLE
-The following code fragment shows how one might process the arguments
-for a command that can take the options
-.Op a
-and
-.Op b ,
-and the option
-.Op o ,
-which requires an argument.
-.Pp
-.Bd -literal -offset indent
-set \-\- \`getopt abo: $*\`
-if test $? != 0
-then
- echo 'Usage: ...'
- exit 2
-fi
-for i
-do
- case "$i"
- in
- \-a|\-b)
- flag=$i; shift;;
- \-o)
- oarg=$2; shift; shift;;
- \-\-)
- shift; break;;
- esac
-done
-.Ed
-.Pp
-This code will accept any of the following as equivalent:
-.Pp
-.Bd -literal -offset indent
-cmd \-aoarg file file
-cmd \-a \-o arg file file
-cmd \-oarg -a file file
-cmd \-a \-oarg \-\- file file
-.Ed
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr getopt 3
-.Sh DIAGNOSTICS
-.Nm Getopt
-prints an error message on the standard error output when it
-encounters an option letter not included in
-.Op optstring .
-.Sh HISTORY
-Written by Henry Spencer, working from a Bell Labs manual page.
-Behavior believed identical to the Bell version.
-.Sh BUGS
-Whatever
-.Xr getopt 3
-has.
-.Pp
-Arguments containing white space or imbedded shell metacharacters
-generally will not survive intact; this looks easy to fix but isn't.
-.Pp
-The error message for an invalid option is identified as coming
-from
-.Nm getopt
-rather than from the shell procedure containing the invocation
-of
-.Nm getopt ;
-this again is hard to fix.
-.Pp
-The precise best way to use the
-.Nm set
-command to set the arguments without disrupting the value(s) of
-shell options varies from one shell version to another.
diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c
deleted file mode 100644
index 03b0987ef140..000000000000
--- a/usr.bin/getopt/getopt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdio.h>
-
-main(argc, argv)
-int argc;
-char *argv[];
-{
- extern int optind;
- extern char *optarg;
- int c;
- int status = 0;
-
- optind = 2; /* Past the program name and the option letters. */
- while ((c = getopt(argc, argv, argv[1])) != EOF)
- switch (c) {
- case '?':
- status = 1; /* getopt routine gave message */
- break;
- default:
- if (optarg != NULL)
- printf(" -%c %s", c, optarg);
- else
- printf(" -%c", c);
- break;
- }
- printf(" --");
- for (; optind < argc; optind++)
- printf(" %s", argv[optind]);
- printf("\n");
- exit(status);
-}