pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/misc/getopt Initial import of getopt, a getopt(1) repl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/715537689b32
branches:  trunk
changeset: 486303:715537689b32
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Sun Dec 26 15:55:39 2004 +0000

description:
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:

 misc/getopt/DESCR            |  23 ++++++++++++++++++++
 misc/getopt/Makefile         |  20 +++++++++++++++++
 misc/getopt/PLIST            |   3 ++
 misc/getopt/distinfo         |   6 +++++
 misc/getopt/patches/patch-aa |  12 ++++++++++
 misc/getopt/patches/patch-ab |  50 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 114 insertions(+), 0 deletions(-)

diffs (138 lines):

diff -r c031dace39d5 -r 715537689b32 misc/getopt/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/DESCR Sun Dec 26 15:55:39 2004 +0000
@@ -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 -r c031dace39d5 -r 715537689b32 misc/getopt/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/Makefile      Sun Dec 26 15:55:39 2004 +0000
@@ -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@localhost
+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 -r c031dace39d5 -r 715537689b32 misc/getopt/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/PLIST Sun Dec 26 15:55:39 2004 +0000
@@ -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 -r c031dace39d5 -r 715537689b32 misc/getopt/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/distinfo      Sun Dec 26 15:55:39 2004 +0000
@@ -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 -r c031dace39d5 -r 715537689b32 misc/getopt/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/patches/patch-aa      Sun Dec 26 15:55:39 2004 +0000
@@ -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 -r c031dace39d5 -r 715537689b32 misc/getopt/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/getopt/patches/patch-ab      Sun Dec 26 15:55:39 2004 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index