summaryrefslogtreecommitdiff
path: root/misc/getopt
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2004-12-26 15:55:39 +0000
committerwiz <wiz@pkgsrc.org>2004-12-26 15:55:39 +0000
commitf931e3505198a0614daea94c4a5f3576c453ba48 (patch)
treed518130338b9233742d760f54477ed7e0a7b1324 /misc/getopt
parent7cfb341cf51b80badf75761371f52d2d670671ad (diff)
downloadpkgsrc-f931e3505198a0614daea94c4a5f3576c453ba48.tar.gz
Initial import of getopt, a getopt(1) replacement supporting long options.
Getopt(1) is a program to help shell scripts parse command-line parameters. It is for example included in the util-linux distribution (versions up to 2.7.1) for Linux. But, there were some problems with that getopt(1) implementation, as listed in the 'BUGS' section of its man-page: * Whatever getopt(3) has. * Arguments containing white space or imbedded shell metacharacters generally will not survive intact; this looks easy to fix but isn't. * The error message for an invalid option is identified as coming from getopt rather than from the shell procedure containing the invocation of getopt; this again is hard to fix. * The precise best way to use the set command to set the arguments without disrupting the value(s) of shell options varies from one shell version to another. Additionally, the example in the manual-page does not run correctly (at least not with any bash shell I have tried). This implementation of getopt(1) solves some of these problems, while still staying (for all practical purposes) completely compatible with other getopt(1) implementations. It has replaced the old util-linux version, but it should be useful for other Unixes too.
Diffstat (limited to 'misc/getopt')
-rw-r--r--misc/getopt/DESCR23
-rw-r--r--misc/getopt/Makefile20
-rw-r--r--misc/getopt/PLIST3
-rw-r--r--misc/getopt/distinfo6
-rw-r--r--misc/getopt/patches/patch-aa12
-rw-r--r--misc/getopt/patches/patch-ab50
6 files changed, 114 insertions, 0 deletions
diff --git a/misc/getopt/DESCR b/misc/getopt/DESCR
new file mode 100644
index 00000000000..2d27314455c
--- /dev/null
+++ b/misc/getopt/DESCR
@@ -0,0 +1,23 @@
+Getopt(1) is a program to help shell scripts parse command-line
+parameters. It is for example included in the util-linux distribution
+(versions up to 2.7.1) for Linux. But, there were some problems
+with that getopt(1) implementation, as listed in the 'BUGS' section
+of its man-page:
+ * Whatever getopt(3) has.
+ * Arguments containing white space or imbedded shell metacharacters
+ generally will not survive intact; this looks easy to fix but
+ isn't.
+ * The error message for an invalid option is identified as
+ coming from getopt rather than from the shell procedure
+ containing the invocation of getopt; this again is hard to
+ fix.
+ * The precise best way to use the set command to set the
+ arguments without disrupting the value(s) of shell options
+ varies from one shell version to another.
+Additionally, the example in the manual-page does not run correctly
+(at least not with any bash shell I have tried).
+
+This implementation of getopt(1) solves some of these problems,
+while still staying (for all practical purposes) completely compatible
+with other getopt(1) implementations. It has replaced the old
+util-linux version, but it should be useful for other Unixes too.
diff --git a/misc/getopt/Makefile b/misc/getopt/Makefile
new file mode 100644
index 00000000000..0da6f3320ea
--- /dev/null
+++ b/misc/getopt/Makefile
@@ -0,0 +1,20 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/12/26 15:55:39 wiz Exp $
+#
+
+DISTNAME= getopt-1.1.3
+CATEGORIES= misc
+MASTER_SITES= http://www.frodol.dds.nl/
+
+MAINTAINER= tech-pkg@NetBSD.org
+HOMEPAGE= http://www.frodol.dds.nl/
+COMMENT= Program to help shell scripts parse command-line parameters
+
+USE_BUILDLINK3= yes
+USE_GNU_TOOLS+= make
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/getopt ${PREFIX}/bin
+ ${INSTALL_MAN} ${WRKSRC}/getopt.1 ${PREFIX}/man/man1
+
+.include "../../devel/gettext-lib/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/misc/getopt/PLIST b/misc/getopt/PLIST
new file mode 100644
index 00000000000..298c9c71943
--- /dev/null
+++ b/misc/getopt/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2004/12/26 15:55:39 wiz Exp $
+bin/getopt
+man/man1/getopt.1
diff --git a/misc/getopt/distinfo b/misc/getopt/distinfo
new file mode 100644
index 00000000000..9c103289655
--- /dev/null
+++ b/misc/getopt/distinfo
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1.1.1 2004/12/26 15:55:39 wiz Exp $
+
+SHA1 (getopt-1.1.3.tar.gz) = e62c646523acc55c8a4a1728ebe5c3cdb235fc2d
+Size (getopt-1.1.3.tar.gz) = 37775 bytes
+SHA1 (patch-aa) = 33e467672d3f2b7a11a60c937dcb2aff032548eb
+SHA1 (patch-ab) = 32b6b41c134c73ee743ea67928991de8fe4db23a
diff --git a/misc/getopt/patches/patch-aa b/misc/getopt/patches/patch-aa
new file mode 100644
index 00000000000..fb9c4228b08
--- /dev/null
+++ b/misc/getopt/patches/patch-aa
@@ -0,0 +1,12 @@
+$NetBSD: patch-aa,v 1.1.1.1 2004/12/26 15:55:39 wiz Exp $
+
+--- getopt.c.orig 2003-01-23 21:51:24.000000000 +0100
++++ getopt.c
+@@ -42,6 +42,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <ctype.h>
++#include <locale.h>
+
+ #if LIBCGETOPT
+ #include <getopt.h>
diff --git a/misc/getopt/patches/patch-ab b/misc/getopt/patches/patch-ab
new file mode 100644
index 00000000000..ff7ea7c5aa9
--- /dev/null
+++ b/misc/getopt/patches/patch-ab
@@ -0,0 +1,50 @@
+$NetBSD: patch-ab,v 1.1.1.1 2004/12/26 15:55:39 wiz Exp $
+
+--- Makefile.orig 2003-01-23 21:52:29.000000000 +0100
++++ Makefile
+@@ -1,7 +1,7 @@
+ .SUFFIXES:
+
+ DESTDIR=
+-prefix=/usr/local
++prefix=${PREFIX}
+ bindir=$(prefix)/bin
+ mandir=$(prefix)/man
+ man1dir=$(mandir)/man1
+@@ -11,7 +11,7 @@ getoptdir=$(libdir)/getopt
+ localedir=$(sharedir)/locale
+
+ # Define this to 0 to use the getopt(3) routines in this package.
+-LIBCGETOPT=1
++LIBCGETOPT=0
+
+ # Define this to 1 if you do not have the gettext routines
+ WITHOUT_GETTEXT=0
+@@ -20,8 +20,6 @@ WITHOUT_GETTEXT=0
+
+ SHELL=/bin/sh
+
+-CC=gcc
+-LD=ld
+ RM=rm -f
+ INSTALL=install
+ MSGFMT=msgfmt
+@@ -39,8 +37,7 @@ WARNINGS=-Wall \
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline
+ OPTIMIZE=-O3 -fno-strength-reduce
+-CFLAGS=$(WARNINGS) $(OPTIMIZE)
+-LDFLAGS=
++CFLAGS+=$(WARNINGS)
+
+ sources=getopt.c
+ ifeq ($(LIBCGETOPT),0)
+@@ -58,7 +55,7 @@ clean: clean_po
+ -$(RM) $(objects) $(binaries)
+
+ getopt: $(objects)
+- $(CC) $(LDFLAGS) -o $@ $(objects)
++ $(CC) $(LDFLAGS) -o $@ $(objects) -lintl
+
+ install: getopt install_po
+ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)