summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorSergey A. Osokin <osa@FreeBSD.org>2003-06-13 23:56:42 +0000
committerSergey A. Osokin <osa@FreeBSD.org>2003-06-13 23:56:42 +0000
commit445d53b2d18b1e791d6ddea09bfbc5d48e35e0f1 (patch)
tree54c421cdb09d22f7eefa19cfc647d2240bb69438 /misc
parentNew port: graphical configuation utility for the newsreader slrn (diff)
A getopt(1) replacement that supports GNU-style long options
Submitted by: Sergei Kolobov <sergei@kolobov.com> PR: 53174 Approved by: fjoe (implicit)
Notes
Notes: svn path=/head/; revision=82963
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile1
-rw-r--r--misc/getopt/Makefile34
-rw-r--r--misc/getopt/distinfo1
-rw-r--r--misc/getopt/files/patch-Makefile38
-rw-r--r--misc/getopt/files/patch-getopt.c55
-rw-r--r--misc/getopt/pkg-descr14
-rw-r--r--misc/getopt/pkg-plist13
7 files changed, 156 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile
index be8bba4b1a3b..b47d11e2f1b0 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -88,6 +88,7 @@
SUBDIR += ftree
SUBDIR += gctpc
SUBDIR += geekcode
+ SUBDIR += getopt
SUBDIR += git
SUBDIR += gkrellm-reminder
SUBDIR += gkrellmaflag
diff --git a/misc/getopt/Makefile b/misc/getopt/Makefile
new file mode 100644
index 000000000000..d8abc6c0018e
--- /dev/null
+++ b/misc/getopt/Makefile
@@ -0,0 +1,34 @@
+# New ports collection makefile for: getopt
+# Date created: 2003-06-05
+# Whom: Sergei Kolobov <sergei@kolobov.com>
+#
+# $FreeBSD$
+#
+
+PORTNAME= getopt
+PORTVERSION= 1.1.3
+CATEGORIES= misc
+MASTER_SITES= http://huizen.dds.nl/~frodol/
+
+MAINTAINER= sergei@kolobov.com
+COMMENT= A getopt(1) replacement that supports GNU-style long options
+
+LIB_DEPENDS= intl:${PORTSDIR}/devel/gettext
+
+USE_GMAKE= yes
+USE_GETOPT_LONG= yes
+
+CFLAGS+= -I${LOCALBASE}/include
+LDFLAGS+= -L${LOCALBASE}/lib -lintl
+MAKE_ENV= LIBCGETOPT=0 CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
+
+MAN1= getopt.1
+DOCS= Changelog README
+
+.if !defined(NOPORTDOCS)
+post-install:
+ @${MKDIR} ${DOCSDIR}
+ @cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
+.endif
+
+.include <bsd.port.mk>
diff --git a/misc/getopt/distinfo b/misc/getopt/distinfo
new file mode 100644
index 000000000000..0be519e79ac5
--- /dev/null
+++ b/misc/getopt/distinfo
@@ -0,0 +1 @@
+MD5 (getopt-1.1.3.tar.gz) = 7b7637dcb0ac531f1af29f4d6b018e86
diff --git a/misc/getopt/files/patch-Makefile b/misc/getopt/files/patch-Makefile
new file mode 100644
index 000000000000..fadb1f525005
--- /dev/null
+++ b/misc/getopt/files/patch-Makefile
@@ -0,0 +1,38 @@
+--- Makefile.orig Thu Jan 23 23:52:29 2003
++++ Makefile Thu Jun 5 16:17:44 2003
+@@ -1,7 +1,7 @@
+ .SUFFIXES:
+
+ DESTDIR=
+-prefix=/usr/local
++prefix=$(PREFIX)
+ bindir=$(prefix)/bin
+ mandir=$(prefix)/man
+ man1dir=$(mandir)/man1
+@@ -29,7 +29,7 @@
+ LANGUAGES = cs de es fr it ja nl pt_BR
+ MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES))
+
+-CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) -DWITH_GETTEXT=$(WITH_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX
++CPPFLAGS+=-DLIBCGETOPT=$(LIBCGETOPT) -DWITH_GETTEXT=$(WITH_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX
+ ifeq ($(LIBCGETOPT),0)
+ CPPFLAGS+=-I./gnu
+ endif
+@@ -39,8 +39,6 @@
+ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
+ -Wnested-externs -Winline
+ OPTIMIZE=-O3 -fno-strength-reduce
+-CFLAGS=$(WARNINGS) $(OPTIMIZE)
+-LDFLAGS=
+
+ sources=getopt.c
+ ifeq ($(LIBCGETOPT),0)
+@@ -71,7 +69,7 @@
+ getopt-test.bash getopt-test.tcsh \
+ $(DESTDIR)$(getoptdir)
+
+-ifeq ($(WITH_GETTEXT),1)
++ifeq ($(WITHOUT_GETTEXT),0)
+ all_po: $(MOFILES)
+ install_po: all_po
+ $(INSTALL) -m 755 -d $(DESTDIR)$(localedir)
diff --git a/misc/getopt/files/patch-getopt.c b/misc/getopt/files/patch-getopt.c
new file mode 100644
index 000000000000..70cf42ffe042
--- /dev/null
+++ b/misc/getopt/files/patch-getopt.c
@@ -0,0 +1,55 @@
+--- getopt.c.orig Thu Jun 5 16:00:34 2003
++++ getopt.c Thu Jun 5 16:02:34 2003
+@@ -66,7 +66,6 @@
+ int quiet_errors=0; /* 0 is not quiet. */
+ int quiet_output=0; /* 0 is not quiet. */
+ int quote=1; /* 1 is do quote. */
+-int alternative=0; /* 0 is getopt_long, 1 is getopt_long_only */
+
+ /* Function prototypes */
+ void *our_malloc(size_t size);
+@@ -188,9 +187,7 @@
+ opterr=0;
+ optind=0; /* Reset getopt(3) */
+
+- while ((opt = (alternative?
+- getopt_long_only(argc,argv,optstr,longopts,&longindex):
+- getopt_long(argc,argv,optstr,longopts,&longindex)))
++ while ((opt = getopt_long(argc,argv,optstr,longopts,&longindex))
+ != EOF)
+ if (opt == '?' || opt == ':' )
+ exit_code = 1;
+@@ -325,7 +322,6 @@
+ fputs(_(" getopt [options] [--] optstring parameters\n"),stderr);
+ fputs(_(" getopt [options] -o|--options optstring [options] [--]\n"),stderr);
+ fputs(_(" parameters\n"),stderr);
+- fputs(_(" -a, --alternative Allow long options starting with single -\n"),stderr);
+ fputs(_(" -h, --help This small usage guide\n"),stderr);
+ fputs(_(" -l, --longoptions=longopts Long options to be recognized\n"),stderr);
+ fputs(_(" -n, --name=progname The name under which errors are reported\n"),stderr);
+@@ -355,14 +351,13 @@
+ {"test",no_argument,NULL,'T'},
+ {"unquoted",no_argument,NULL,'u'},
+ {"help",no_argument,NULL,'h'},
+- {"alternative",no_argument,NULL,'a'},
+ {"name",required_argument,NULL,'n'},
+ {"version",no_argument,NULL,'V'},
+ {NULL,0,NULL,0}
+ };
+
+ /* Stop scanning as soon as a non-option argument is found! */
+-static const char *shortopts="+ao:l:n:qQs:TuhV";
++static const char *shortopts="+o:l:n:qQs:TuhV";
+
+ int main(int argc, char *argv[])
+ {
+@@ -405,9 +400,6 @@
+
+ while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF)
+ switch (opt) {
+- case 'a':
+- alternative=1;
+- break;
+ case 'h':
+ print_help();
+ exit(0);
diff --git a/misc/getopt/pkg-descr b/misc/getopt/pkg-descr
new file mode 100644
index 000000000000..687e309465ca
--- /dev/null
+++ b/misc/getopt/pkg-descr
@@ -0,0 +1,14 @@
+Rewrite of getopt(1) with the following features:
+
+* It can do anything that the GNU getopt(3) routines can do.
+* It can cope with spaces and shell metacharacters within arguments.
+* It can parse long parameters.
+* It can shuffle parameters, so you can mix options and other parameters
+ on the command-line.
+* It can be easily identified as an enhanced getopt(1) from within shell
+ scripts.
+* It can report parse errors as coming from the shell script.
+* It compiles cleanly with both libc-5 and glibc-2.
+
+Author: Frodo Looijaard <frodol@dds.nl>
+WWW: http://huizen.dds.nl/~frodol/getopt.html
diff --git a/misc/getopt/pkg-plist b/misc/getopt/pkg-plist
new file mode 100644
index 000000000000..6f935e6d168a
--- /dev/null
+++ b/misc/getopt/pkg-plist
@@ -0,0 +1,13 @@
+@comment $Id$
+bin/getopt
+%%PORTDOCS%%%%DOCSDIR%%/Changelog
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
+share/locale/cs/LC_MESSAGES/getopt.mo
+share/locale/de/LC_MESSAGES/getopt.mo
+share/locale/es/LC_MESSAGES/getopt.mo
+share/locale/fr/LC_MESSAGES/getopt.mo
+share/locale/it/LC_MESSAGES/getopt.mo
+share/locale/ja/LC_MESSAGES/getopt.mo
+share/locale/nl/LC_MESSAGES/getopt.mo
+share/locale/pt_BR/LC_MESSAGES/getopt.mo