summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devel/libgetopt/Makefile51
-rw-r--r--devel/libgetopt/PLIST11
-rw-r--r--devel/libgetopt/distinfo6
-rw-r--r--devel/libgetopt/files/Makefile.libgetopt9
-rw-r--r--devel/libgetopt/files/getopt.h20
-rw-r--r--devel/libgetopt/files/getopt_long.3273
-rw-r--r--devel/libgetopt/files/getopt_long.c494
-rw-r--r--devel/libgetopt/files/namespace.h606
-rw-r--r--devel/libgetopt/files/shlib_version5
9 files changed, 800 insertions, 675 deletions
diff --git a/devel/libgetopt/Makefile b/devel/libgetopt/Makefile
index 015bda9c8b2..da9d59bd242 100644
--- a/devel/libgetopt/Makefile
+++ b/devel/libgetopt/Makefile
@@ -1,19 +1,15 @@
-# $NetBSD: Makefile,v 1.17 2005/02/21 20:26:10 hubertf Exp $
+# $NetBSD: Makefile,v 1.18 2005/03/10 19:19:46 tv Exp $
#
-DISTNAME= libgetopt-${VERS}
-PKGREVISION= 1
+DISTNAME= libgetopt-1.4
CATEGORIES= pkgtools sysutils
-MASTER_SITES= ${MASTER_SITE_LOCAL}
-# MASTER_SITES= ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/src/lib/libc/stdlib/ \
-# ftp://ftp.de.NetBSD.org/pub/NetBSD/NetBSD-current/src/lib/libc/stdlib/
-DISTFILES= getopt_long.c-${VERS} getopt_long.3-${VERS}
+MASTER_SITES= # empty
+DISTFILES= # empty
-MAINTAINER= tech-pkg@NetBSD.org,mcr@NetBSD.org
+MAINTAINER= tech-pkg@NetBSD.org
COMMENT= Library for handling --long options
-NO_SRC_ON_FTP= Already in MASTER_SITE_LOCAL
-
+USE_LIBTOOL= YES
WRKSRC= ${WRKDIR}/libgetopt
.include "../../mk/bsd.prefs.mk"
@@ -22,36 +18,23 @@ WRKSRC= ${WRKDIR}/libgetopt
PKG_SKIP_REASON= "${PKGNAME} is part of your ${OPSYS} distribution"
.endif
-VERS= 1.3
-# I have NFC why the mkdir in pre-extract doesn't work, so do it here:
-EXTRACT_CMD= ${MKDIR} ${WRKSRC} && ${CP} ${DOWNLOADED_DISTFILE} ${WRKSRC}
-MANCOMPRESSED_IF_MANZ= yes
-MAKE_FLAGS+= LIBDIR=${PREFIX}/lib MANDIR=${PREFIX}/man
-MAKE_FLAGS+= MKLINT=no
-
.if ${OPSYS} == "SunOS"
MAKEFLAGS+= NETBSD_COMPATIBLE=YES
CFLAGS+= -DREPLACE_GETOPT
.endif
-.if ${OPSYS} != "NetBSD"
-MAKE_FLAGS+= MKMAN=no
-MAN_INCLUDED= '@comment '
-.else
-MAN_INCLUDED=
-.endif
-
-PLIST_SUBST+= MAN_INCLUDED=${MAN_INCLUDED}
+do-extract:
+ ${MKDIR} ${WRKSRC}
+ ${CP} ${FILESDIR}/getopt_long.? ${WRKSRC}
+ ${CP} ${FILESDIR}/getopt.h ${WRKSRC}
-post-extract:
- ${CP} ${FILESDIR}/getopt.h ${WRKSRC}
- ${CP} ${FILESDIR}/namespace.h ${WRKSRC}
- ${CP} ${FILESDIR}/shlib_version ${WRKSRC}
- ${CP} ${FILESDIR}/Makefile.libgetopt ${WRKSRC}/Makefile
- ${MV} ${WRKSRC}/getopt_long.c-${VERS} ${WRKSRC}/getopt_long.c
- ${MV} ${WRKSRC}/getopt_long.3-${VERS} ${WRKSRC}/getopt_long.3
+do-build:
+ cd ${WRKSRC} && ${LIBTOOL} --mode=compile ${COMPILE.c} getopt_long.c
+ cd ${WRKSRC} && ${LIBTOOL} --mode=link ${LINK.c} -o libgetopt.la getopt_long.lo -version-info 5:0:4 -rpath ${PREFIX}/lib
-post-install:
- ${INSTALL_DATA} ${FILESDIR}/getopt.h ${PREFIX}/include/getopt.h
+do-install:
+ ${LIBTOOL} --mode=install ${INSTALL_LIB} ${WRKSRC}/libgetopt.la ${PREFIX}/lib/
+ ${INSTALL_DATA} ${WRKSRC}/getopt.h ${PREFIX}/include/
+ ${INSTALL_MAN} ${WRKSRC}/getopt_long.3 ${PREFIX}/man/man3/
.include "../../mk/bsd.pkg.mk"
diff --git a/devel/libgetopt/PLIST b/devel/libgetopt/PLIST
index cbf01ce9cfb..cdbe6b3c844 100644
--- a/devel/libgetopt/PLIST
+++ b/devel/libgetopt/PLIST
@@ -1,9 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1 2001/11/01 01:24:30 zuntum Exp $
-lib/libgetopt.a
-lib/libgetopt_pic.a
-lib/libgetopt.so
-lib/libgetopt.so.1
-lib/libgetopt.so.1.1
-${MAN_INCLUDED}man/man3/getopt_long.3
-${MAN_INCLUDED}man/cat3/getopt_long.0
+@comment $NetBSD: PLIST,v 1.2 2005/03/10 19:19:46 tv Exp $
+lib/libgetopt.la
+man/man3/getopt_long.3
include/getopt.h
diff --git a/devel/libgetopt/distinfo b/devel/libgetopt/distinfo
index 6c7feb4fb51..a2ee42b980a 100644
--- a/devel/libgetopt/distinfo
+++ b/devel/libgetopt/distinfo
@@ -1,6 +1,2 @@
-$NetBSD: distinfo,v 1.2 2001/04/21 00:44:27 wiz Exp $
+$NetBSD: distinfo,v 1.3 2005/03/10 19:19:46 tv Exp $
-SHA1 (getopt_long.c-1.3) = 1cacfb054f19ae8c7ad713caf0ccd02eeb1a4524
-Size (getopt_long.c-1.3) = 12789 bytes
-SHA1 (getopt_long.3-1.3) = 29379706e3537a3a323d16c8ebea8dc9a2bd9ccf
-Size (getopt_long.3-1.3) = 8281 bytes
diff --git a/devel/libgetopt/files/Makefile.libgetopt b/devel/libgetopt/files/Makefile.libgetopt
deleted file mode 100644
index 77951a20b96..00000000000
--- a/devel/libgetopt/files/Makefile.libgetopt
+++ /dev/null
@@ -1,9 +0,0 @@
-# $NetBSD: Makefile.libgetopt,v 1.1.1.1 1999/08/06 16:37:22 hubertf Exp $
-
-LIB= getopt
-SRCS= getopt_long.c
-MAN= getopt_long.3
-
-MKPROFILE=no
-
-.include <bsd.lib.mk>
diff --git a/devel/libgetopt/files/getopt.h b/devel/libgetopt/files/getopt.h
index ba0975f3d1f..2dcd12d459f 100644
--- a/devel/libgetopt/files/getopt.h
+++ b/devel/libgetopt/files/getopt.h
@@ -1,4 +1,4 @@
-/* $NetBSD: getopt.h,v 1.3 2005/02/11 17:29:06 tv Exp $ */
+/* $NetBSD: getopt.h,v 1.4 2005/03/10 19:19:47 tv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -39,7 +39,6 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
-#include <sys/cdefs.h>
#include <unistd.h>
/*
@@ -64,15 +63,20 @@ struct option {
int val;
};
-__BEGIN_DECLS
-int getopt_long __P((int, char * const *, const char *,
- const struct option *, int *));
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int getopt_long(int, char * const *, const char *,
+ const struct option *, int *);
-#ifdef __INTERIX
-/* XXX this is in libc, but not in a system header */
+/* On some platforms, this is in libc, but not in a system header */
extern int optreset;
+
+#ifdef __cplusplus
+};
#endif
-__END_DECLS
+
#endif
#endif /* !_GETOPT_H_ */
diff --git a/devel/libgetopt/files/getopt_long.3 b/devel/libgetopt/files/getopt_long.3
new file mode 100644
index 00000000000..c5e5e418338
--- /dev/null
+++ b/devel/libgetopt/files/getopt_long.3
@@ -0,0 +1,273 @@
+.\" $NetBSD: getopt_long.3,v 1.1 2005/03/10 19:19:47 tv Exp $
+.\"
+.\" Copyright (c) 1988, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
+.\"
+.Dd April 1, 2000
+.Dt GETOPT_LONG 3
+.Os
+.Sh NAME
+.Nm getopt_long
+.Nd get long options from command line argument list
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.Fd #include <getopt.h>
+.Ft int
+.Fn getopt_long "int argc" "char * const *argv" "const char *optstring" "struct options *long options" "int *index"
+.Sh DESCRIPTION
+The
+.Fn getopt_long
+function is similar to
+.Xr getopt 3
+but it accepts options in two forms: words and characters. The
+.Fn getopt_long
+function provides a superset of of the functionality of
+.Xr getopt 3 .
+.Fn getopt_long
+can be used in two ways. In the first way, every long option understood
+by the program has a corresponding short option, and the option
+structure is only used to translate from long options to short
+options. When used in this fashion,
+.Fn getopt_long
+behaves identically to
+.Xr getopt 3 .
+This is a good way to add long option processing to an existing program
+with the minimum of rewriting.
+.Pp
+In the second mechanism, a long option sets a flag in the
+.Fa option
+structure passed, or will store a pointer to the command line argument
+in the
+.Fa option
+structure passed to it for options that take arguments. Additionally,
+the long option's argument may be specified as a single argument with
+an equal sign, e.g.
+.Bd -literal
+myprogram --myoption=somevalue
+.Ed
+.Pp
+When a long option is processed the call to
+.Fn getopt_long
+will return 0. For this reason, long option processing without
+shortcuts is not backwards compatible with
+.Xr getopt 3 .
+.Pp
+It is possible to combine these methods, providing for long options
+processing with short option equivalents for some options. Less
+frequently used options would be processed as long options only.
+.Sh USAGE
+.Pp
+The
+.Fn getopt_long
+call requires a structure to be initialized describing the long
+options. The structure is:
+.Bd -literal
+struct option {
+ char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+.Ed
+.Pp
+The
+.Fa name
+field should contain the option name without the leading double dash.
+.Pp
+The
+.Fa has_arg
+field should be one of:
+.Bl -tag -width "optional_argument"
+.It Li no_argument
+no argument to the option is expect.
+.It Li required_argument
+an argument to the option is required.
+.It Li optional_argument
+an argument to the option may be presented.
+.El
+.Pp
+If
+.Fa flag
+is non-NULL, then the integer pointed to by it will be set to the
+value in the
+.Fa val
+field. If the
+.Fa flag
+field is NULL, then the
+.Fa val
+field will be returned. Setting
+.Fa flag
+to NULL and setting
+.Fa val
+to the corresponding short option will make this function act just
+like
+.Xr getopt 3 .
+.Sh EXAMPLE
+.Bd -literal -compact
+extern char *optarg;
+extern int optind;
+int bflag, ch, fd;
+int daggerset;
+
+/* options descriptor */
+static struct option longopts[] = {
+ { "buffy", no_argument, 0, 'b' },
+ { "floride", required_argument, 0, 'f' },
+ { "daggerset", no_argument, &daggerset, 1 },
+ { 0, 0, 0, 0 }
+};
+
+bflag = 0;
+while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1)
+ switch(ch) {
+ case 'b':
+ bflag = 1;
+ break;
+ case 'f':
+ if ((fd = open(optarg, O_RDONLY, 0)) < 0) {
+ (void)fprintf(stderr,
+ "myname: %s: %s\en", optarg, strerror(errno));
+ exit(1);
+ }
+ break;
+ case 0:
+ if(daggerset) {
+ fprintf(stderr,"Buffy will put use her dagger to "
+ "apply floride to dracula's teeth\en");
+ }
+ break;
+ case '?':
+ default:
+ usage();
+}
+argc -= optind;
+argv += optind;
+.Ed
+.Sh HISTORY
+The
+.Fn getopt_long
+function first appeared in GNU libiberty. The first NetBSD implementation
+appeared in 1.5.
+.Sh IMPLEMENTATION DIFFERENCES
+.Pp
+This section describes differences to the GNU implementation
+found in glibc-2.1.3:
+.Bl -tag -width "xxx"
+.It Li o
+handling of - as first char of option string in presence of
+environment variable POSIXLY_CORRECT:
+.Bl -tag -width "NetBSD"
+.It Li GNU
+ignores POSIXLY_CORRECT and returns non-options as
+arguments to option '\e1'.
+.It Li NetBSD
+honors POSIXLY_CORRECT and stops at the first non-option.
+.El
+.It Li o
+handling of :: in options string in presence of POSIXLY_CORRECT:
+.Bl -tag -width "NetBSD"
+.It Li Both
+GNU and NetBSD ignore POSIXLY_CORRECT here and take :: to
+mean the preceding option takes an optional argument.
+.El
+.It Li o
+return value in case of missing argument if first character
+(after + or -) in option string is not ':':
+.Bl -tag -width "NetBSD"
+.It Li GNU
+returns '?'
+.It NetBSD
+returns ':' (since NetBSD's getopt does).
+.El
+.It Li o
+handling of --a in getopt:
+.Bl -tag -width "NetBSD"
+.It Li GNU
+parses this as option '-', option 'a'.
+.It Li NetBSD
+parses this as '--', and returns -1 (ignoring the a). (Because
+the original getopt does.)
+.El
+.It Li o
+setting of optopt for long options with flag != NULL:
+.Bl -tag -width "NetBSD"
+.It Li GNU
+sets optopt to val.
+.It Li NetBSD
+sets optopt to 0 (since val would never be returned).
+.El
+.It Li o
+handling of -W with W; in option string in getopt (not getopt_long):
+.Bl -tag -width "NetBSD"
+.It Li GNU
+causes a segfault.
+.It Li NetBSD
+returns -1, with optind pointing past the argument of -W
+(as if `-W arg' were `--arg', and thus '--' had been found).
+.\" How should we treat W; in the option string when called via
+.\" getopt? Ignore the ';' or treat it as a ':'? Issue a warning?
+.El
+.It Li o
+setting of optarg for long options without an argument that are
+invoked via -W (W; in option string):
+.Bl -tag -width "NetBSD"
+.It Li GNU
+sets optarg to the option name (the argument of -W).
+.It Li NetBSD
+sets optarg to NULL (the argument of the long option).
+.El
+.It Li o
+handling of -W with an argument that is not (a prefix to) a known
+long option (W; in option string):
+.Bl -tag -width "NetBSD"
+.It Li GNU
+returns -W with optarg set to the unknown option.
+.It Li NetBSD
+treats this as an error (unknown option) and returns '?' with
+optopt set to 0 and optarg set to NULL (as GNU's man page
+documents).
+.El
+.It Li o
+The error messages are different.
+.It Li o
+NetBSD does not permute the argument vector at the same points in
+the calling sequence as GNU does. The aspects normally used by
+the caller (ordering after -1 is returned, value of optind relative
+to current positions) are the same, though. (We do fewer variable
+swaps.)
+.El
+.Sh BUGS
+The implementation, can completelely replace
+.Xr getopt 3 ,
+but right now we are using separate code.
diff --git a/devel/libgetopt/files/getopt_long.c b/devel/libgetopt/files/getopt_long.c
new file mode 100644
index 00000000000..e5aab00a9aa
--- /dev/null
+++ b/devel/libgetopt/files/getopt_long.c
@@ -0,0 +1,494 @@
+/* $NetBSD: getopt_long.c,v 1.1 2005/03/10 19:19:47 tv Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "getopt.h"
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(e)
+#endif
+
+#ifdef REPLACE_GETOPT
+#ifdef __weak_alias
+__weak_alias(getopt,_getopt)
+#endif
+int opterr = 1; /* if error message should be printed */
+int optind = 1; /* index into parent argv vector */
+int optopt = '?'; /* character checked for validity */
+int optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+#endif
+
+#ifdef __weak_alias
+__weak_alias(getopt_long,_getopt_long)
+#endif
+
+
+#define IGNORE_FIRST (*options == '-' || *options == '+')
+#define PRINT_ERROR ((opterr) && ((*options != ':') \
+ || (IGNORE_FIRST && options[1] != ':')))
+#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
+#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
+/* XXX: GNU ignores PC if *options == '-' */
+#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-')
+
+/* return values */
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define INORDER (int)1
+
+#define EMSG ""
+
+static int getopt_internal(int, char * const *, const char *);
+static int gcd(int, int);
+static void permute_args(int, int, int, char * const *);
+static void xwarnx(const char *, ...);
+
+static char *place = EMSG; /* option letter processing */
+
+/* XXX: set optreset to 1 rather than these two */
+static int nonopt_start = -1; /* first non option argument (for permute) */
+static int nonopt_end = -1; /* first option after non options (for permute) */
+
+/* Error messages */
+static const char recargchar[] = "option requires an argument -- %c";
+static const char recargstring[] = "option requires an argument -- %s";
+static const char ambig[] = "ambiguous option -- %.*s";
+static const char noarg[] = "option doesn't take an argument -- %.*s";
+static const char illoptchar[] = "illegal option -- %c";
+static const char illoptstring[] = "illegal option -- %s";
+
+static const char *__progname;
+
+
+/* Replacement for warnx(3) for systems without it. */
+static void xwarnx(const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ if (__progname)
+ (void) fprintf(stderr, "%s: ", __progname);
+ if (fmt)
+ (void) vfprintf(stderr, fmt, ap);
+ (void) fprintf(stderr, "\n");
+ va_end(ap);
+}
+
+/*
+ * Compute the greatest common divisor of a and b.
+ */
+static int
+gcd(a, b)
+ int a;
+ int b;
+{
+ int c;
+
+ c = a % b;
+ while (c != 0) {
+ a = b;
+ b = c;
+ c = a % b;
+ }
+
+ return b;
+}
+
+/*
+ * Exchange the block from nonopt_start to nonopt_end with the block
+ * from nonopt_end to opt_end (keeping the same order of arguments
+ * in each block).
+ */
+static void
+permute_args(nonopt_start, nonopt_end, opt_end, nargv)
+ int nonopt_start;
+ int nonopt_end;
+ int opt_end;
+ char * const *nargv;
+{
+ int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
+ char *swap;
+
+ /*
+ * compute lengths of blocks and number and size of cycles
+ */
+ nnonopts = nonopt_end - nonopt_start;
+ nopts = opt_end - nonopt_end;
+ ncycle = gcd(nnonopts, nopts);
+ cyclelen = (opt_end - nonopt_start) / ncycle;
+
+ for (i = 0; i < ncycle; i++) {
+ cstart = nonopt_end+i;
+ pos = cstart;
+ for (j = 0; j < cyclelen; j++) {
+ if (pos >= nonopt_end)
+ pos -= nnonopts;
+ else
+ pos += nopts;
+ swap = nargv[pos];
+ /* LINTED const cast */
+ ((char **) nargv)[pos] = nargv[cstart];
+ /* LINTED const cast */
+ ((char **)nargv)[cstart] = swap;
+ }
+ }
+}
+
+/*
+ * getopt_internal --
+ * Parse argc/argv argument vector. Called by user level routines.
+ * Returns -2 if -- is found (can be long option or end of options marker).
+ */
+static int
+getopt_internal(nargc, nargv, options)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+{
+ char *oli; /* option letter list index */
+ int optchar;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+
+ optarg = NULL;
+
+ /*
+ * XXX Some programs (like rsyncd) expect to be able to
+ * XXX re-initialize optind to 0 and have getopt_long(3)
+ * XXX properly function again. Work around this braindamage.
+ */
+ if (optind == 0)
+ optind = 1;
+
+ if (optreset)
+ nonopt_start = nonopt_end = -1;
+start:
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc) { /* end of argument vector */
+ place = EMSG;
+ if (nonopt_end != -1) {
+ /* do permutation, if we have to */
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ else if (nonopt_start != -1) {
+ /*
+ * If we skipped non-options, set optind
+ * to the first of them.
+ */
+ optind = nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return -1;
+ }
+ if (*(place = nargv[optind]) != '-') { /* found non-option */
+ place = EMSG;
+ if (IN_ORDER) {
+ /*
+ * GNU extension:
+ * return non-option as argument to option 1
+ */
+ optarg = nargv[optind++];
+ return INORDER;
+ }
+ if (!PERMUTE) {
+ /*
+ * if no permutation wanted, stop parsing
+ * at first non-option
+ */
+ return -1;
+ }
+ /* do permutation */
+ if (nonopt_start == -1)
+ nonopt_start = optind;
+ else if (nonopt_end != -1) {
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ nonopt_start = optind -
+ (nonopt_end - nonopt_start);
+ nonopt_end = -1;
+ }
+ optind++;
+ /* process next argument */
+ goto start;
+ }
+ if (nonopt_start != -1 && nonopt_end == -1)
+ nonopt_end = optind;
+ if (place[1] && *++place == '-') { /* found "--" */
+ place++;
+ return -2;
+ }
+ }
+ if ((optchar = (int)*place++) == (int)':' ||
+ (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
+ /* option letter unknown or ':' */
+ if (!*place)
+ ++optind;
+ if (PRINT_ERROR)
+ xwarnx(illoptchar, optchar);
+ optopt = optchar;
+ return BADCH;
+ }
+ if (optchar == 'W' && oli[1] == ';') { /* -W long-option */
+ /* XXX: what if no long options provided (called by getopt)? */
+ if (*place)
+ return -2;
+
+ if (++optind >= nargc) { /* no arg */
+ place = EMSG;
+ if (PRINT_ERROR)
+ xwarnx(recargchar, optchar);
+ optopt = optchar;
+ /* XXX: GNU returns '?' if options[0] != ':' */
+ return BADARG;
+ } else /* white space */
+ place = nargv[optind];
+ /*
+ * Handle -W arg the same as --arg (which causes getopt to
+ * stop parsing).
+ */
+ return -2;
+ }
+ if (*++oli != ':') { /* doesn't take argument */
+ if (!*place)
+ ++optind;
+ } else { /* takes (optional) argument */
+ optarg = NULL;
+ if (*place) /* no white space */
+ optarg = place;
+ /* XXX: disable test for :: if PC? (GNU doesn't) */
+ else if (oli[1] != ':') { /* arg not optional */
+ if (++optind >= nargc) { /* no arg */
+ place = EMSG;
+ if (PRINT_ERROR)
+ xwarnx(recargchar, optchar);
+ optopt = optchar;
+ /* XXX: GNU returns '?' if options[0] != ':' */
+ return BADARG;
+ } else
+ optarg = nargv[optind];
+ }
+ place = EMSG;
+ ++optind;
+ }
+ /* dump back option letter */
+ return optchar;
+}
+
+#ifdef REPLACE_GETOPT
+/*
+ * getopt --
+ * Parse argc/argv argument vector.
+ *
+ * [eventually this will replace the real getopt]
+ */
+int
+getopt(nargc, nargv, options)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+{
+ int retval;
+
+ __progname = nargv[0];
+
+ if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+ ++optind;
+ /*
+ * We found an option (--), so if we skipped non-options,
+ * we have to permute.
+ */
+ if (nonopt_end != -1) {
+ permute_args(nonopt_start, nonopt_end, optind,
+ nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ retval = -1;
+ }
+ return retval;
+}
+#endif
+
+/*
+ * getopt_long --
+ * Parse argc/argv argument vector.
+ */
+int
+getopt_long(nargc, nargv, options, long_options, idx)
+ int nargc;
+ char * const *nargv;
+ const char *options;
+ const struct option *long_options;
+ int *idx;
+{
+ int retval;
+
+ _DIAGASSERT(nargv != NULL);
+ _DIAGASSERT(options != NULL);
+ _DIAGASSERT(long_options != NULL);
+ /* idx may be NULL */
+
+ if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+ char *current_argv, *has_equal;
+ size_t current_argv_len;
+ int i, match;
+
+ current_argv = place;
+ match = -1;
+
+ optind++;
+ place = EMSG;
+
+ if (*current_argv == '\0') { /* found "--" */
+ /*
+ * We found an option (--), so if we skipped
+ * non-options, we have to permute.
+ */
+ if (nonopt_end != -1) {
+ permute_args(nonopt_start, nonopt_end,
+ optind, nargv);
+ optind -= nonopt_end - nonopt_start;
+ }
+ nonopt_start = nonopt_end = -1;
+ return -1;
+ }
+ if ((has_equal = strchr(current_argv, '=')) != NULL) {
+ /* argument found (--option=arg) */
+ current_argv_len = has_equal - current_argv;
+ has_equal++;
+ } else
+ current_argv_len = strlen(current_argv);
+
+ for (i = 0; long_options[i].name; i++) {
+ /* find matching long option */
+ if (strncmp(current_argv, long_options[i].name,
+ current_argv_len))
+ continue;
+
+ if (strlen(long_options[i].name) ==
+ (unsigned)current_argv_len) {
+ /* exact match */
+ match = i;
+ break;
+ }
+ if (match == -1) /* partial match */
+ match = i;
+ else {
+ /* ambiguous abbreviation */
+ if (PRINT_ERROR)
+ xwarnx(ambig, (int)current_argv_len,
+ current_argv);
+ optopt = 0;
+ return BADCH;
+ }
+ }
+ if (match != -1) { /* option found */
+ if (long_options[match].has_arg == no_argument
+ && has_equal) {
+ if (PRINT_ERROR)
+ xwarnx(noarg, (int)current_argv_len,
+ current_argv);
+ /*
+ * XXX: GNU sets optopt to val regardless of
+ * flag
+ */
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ /* XXX: GNU returns '?' if options[0] != ':' */
+ return BADARG;
+ }
+ if (long_options[match].has_arg == required_argument ||
+ long_options[match].has_arg == optional_argument) {
+ if (has_equal)
+ optarg = has_equal;
+ else if (long_options[match].has_arg ==
+ required_argument) {
+ /*
+ * optional argument doesn't use
+ * next nargv
+ */
+ optarg = nargv[optind++];
+ }
+ }
+ if ((long_options[match].has_arg == required_argument)
+ && (optarg == NULL)) {
+ /*
+ * Missing argument; leading ':'
+ * indicates no error should be generated
+ */
+ if (PRINT_ERROR)
+ xwarnx(recargstring, current_argv);
+ /*
+ * XXX: GNU sets optopt to val regardless
+ * of flag
+ */
+ if (long_options[match].flag == NULL)
+ optopt = long_options[match].val;
+ else
+ optopt = 0;
+ /* XXX: GNU returns '?' if options[0] != ':' */
+ --optind;
+ return BADARG;
+ }
+ } else { /* unknown option */
+ if (PRINT_ERROR)
+ xwarnx(illoptstring, current_argv);
+ optopt = 0;
+ return BADCH;
+ }
+ if (long_options[match].flag) {
+ *long_options[match].flag = long_options[match].val;
+ retval = 0;
+ } else
+ retval = long_options[match].val;
+ if (idx)
+ *idx = match;
+ }
+ return retval;
+}
diff --git a/devel/libgetopt/files/namespace.h b/devel/libgetopt/files/namespace.h
deleted file mode 100644
index 28c50868940..00000000000
--- a/devel/libgetopt/files/namespace.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/* $NetBSD: namespace.h,v 1.58 2000/09/28 08:38:55 kleink Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NAMESPACE_H_
-#define _NAMESPACE_H_
-
-#include <sys/cdefs.h>
-
-#define brk _brk
-#define catclose _catclose
-#define catgets _catgets
-#define catopen _catopen
-#define err _err
-#define errx _errx
-#define fork _fork
-#define fseeko _fseeko
-#define ftello _ftello
-#define inet_aton _inet_aton
-#define inet_pton _inet_pton
-#define pipe _pipe
-#define sbrk _sbrk
-#define strtoll _strtoll
-#define strtoull _strtoull
-#define sys_errlist _sys_errlist
-#define sys_nerr _sys_nerr
-#define sys_siglist _sys_siglist
-#define sys_nsig _sys_nsig
-#define verr _verr
-#define verrx _verrx
-#define vwarn _vwarn
-#define vwarnx _vwarnx
-#define warn _warn
-#define warnx _warnx
-
-#ifdef __weak_alias
-#define MD4Final _MD4Final
-#define MD4Init _MD4Init
-#define MD4Update _MD4Update
-#define MD5Final _MD5Final
-#define MD5Init _MD5Init
-#define MD5Update _MD5Update
-#define RMD160Data _RMD160Data
-#define RMD160End _RMD160End
-#define RMD160File _RMD160File
-#define RMD160Final _RMD160Final
-#define RMD160Init _RMD160Init
-#define RMD160Transform _RMD160Transform
-#define RMD160Update _RMD160Update
-#define SHA1Data _SHA1Data
-#define SHA1End _SHA1End
-#define SHA1File _SHA1File
-#define SHA1Final _SHA1Final
-#define SHA1Init _SHA1Init
-#define SHA1Transform _SHA1Transform
-#define SHA1Update _SHA1Update
-#define a64l _a64l
-#define alarm _alarm
-#define alphasort _alphasort
-#define asctime_r _asctime_r
-#define atoll _atoll
-#define authnone_create _authnone_create
-#define authunix_create _authunix_create
-#define authunix_create_default _authunix_create_default
-#define basename _basename
-#define bindresvport _bindresvport
-#define bindresvport_sa _bindresvport_sa
-#define bm_comp _bm_comp
-#define bm_exec _bm_exec
-#define bm_free _bm_free
-#define callrpc _callrpc
-#define cfgetispeed _cfgetispeed
-#define cfgetospeed _cfgetospeed
-#define cfmakeraw _cfmakeraw
-#define cfsetispeed _cfsetispeed
-#define cfsetospeed _cfsetospeed
-#define cfsetspeed _cfsetspeed
-#define cgetcap _cgetcap
-#define cgetclose _cgetclose
-#define cgetent _cgetent
-#define cgetfirst _cgetfirst
-#define cgetmatch _cgetmatch
-#define cgetnext _cgetnext
-#define cgetnum _cgetnum
-#define cgetset _cgetset
-#define cgetstr _cgetstr
-#define cgetustr _cgetustr
-#define clnt_broadcast _clnt_broadcast
-#define clnt_create _clnt_create
-#define clnt_create_vers _clnt_create_vers
-#define clnt_dg_create _clnt_dg_create
-#define clnt_pcreateerror _clnt_pcreateerror
-#define clnt_perrno _clnt_perrno
-#define clnt_perror _clnt_perror
-#define clnt_raw_create _clnt_raw_create
-#define clnt_tli_create _clnt_tli_create
-#define clnt_tp_create _clnt_tp_create
-#define clnt_spcreateerror _clnt_spcreateerror
-#define clnt_sperrno _clnt_sperrno
-#define clnt_sperror _clnt_sperror
-#define clnt_vc_create _clnt_vc_create
-#define clntraw_create _clntraw_create
-#define clnttcp_create _clnttcp_create
-#define clntudp_bufcreate _clntudp_bufcreate
-#define clntudp_create _clntudp_create
-#define closedir _closedir
-#define closelog _closelog
-#define confstr _confstr
-#define ctermid _ctermid
-#define ctime_r _ctime_r
-#define daemon _daemon
-#define dbm_clearerr _dbm_clearerr
-#define dbm_close _dbm_close
-#define dbm_delete _dbm_delete
-#define dbm_dirfno _dbm_dirfno
-#define dbm_error _dbm_error
-#define dbm_fetch _dbm_fetch
-#define dbm_firstkey _dbm_firstkey
-#define dbm_nextkey _dbm_nextkey
-#define dbm_open _dbm_open
-#define dbm_store _dbm_store
-#define dbopen _dbopen
-#define devname _devname
-#define dirname _dirname
-#define dn_expand _dn_expand
-#define drand48 _drand48
-#define endfsent _endfsent
-#define endgrent _endgrent
-#define endhostent _endhostent
-#define endnetconfig _endnetconfig
-#define endnetent _endnetent
-#define endnetgrent _endnetgrent
-#define endprotoent _endprotoent
-#define endpwent _endpwent
-#define endrpcent _endrpcent
-#define endservent _endservent
-#define endttyent _endttyent
-#define endusershell _endusershell
-#define erand48 _erand48
-#define ether_aton _ether_aton
-#define ether_hostton _ether_hostton
-#define ether_line _ether_line
-#define ether_ntoa _ether_ntoa
-#define ether_ntohost _ether_ntohost
-#define execl _execl
-#define execle _execle
-#define execlp _execlp
-#define execv _execv
-#define execvp _execvp
-#define fdopen _fdopen
-#define fgetln _fgetln
-#define fnmatch _fnmatch
-#define freenetconfigent _freenetconfigent
-#define freeaddrinfo _freeaddrinfo
-#define freeifaddrs _freeifaddrs
-#define ftok _ftok
-#define ftruncate _ftruncate
-#define fts_children _fts_children
-#define fts_close _fts_close
-#define fts_open _fts_open
-#define fts_read _fts_read
-#define fts_set _fts_set
-#define gai_strerror _gai_strerror
-#define get_myaddress _get_myaddress
-#define getaddrinfo _getaddrinfo
-#define getbsize _getbsize
-#define getcwd _getcwd
-#define getdiskbyname _getdiskbyname
-#define getdomainname _getdomainname
-#define getfsent _getfsent
-#define getfsfile _getfsfile
-#define getfsspec _getfsspec
-#define getgrent _getgrent
-#define getgrgid _getgrgid
-#define getgrnam _getgrnam
-#define getgrouplist _getgrouplist
-#define gethostbyaddr _gethostbyaddr
-#define gethostbyname _gethostbyname
-#define gethostname _gethostname
-#define getifaddrs _getifaddrs
-#define getloadavg _getloadavg
-#define getlogin _getlogin
-#define getmntinfo _getmntinfo
-#define getmode _getmode
-#define getnameinfo _getnameinfo
-#define getnetbyaddr _getnetbyaddr
-#define getnetbyname _getnetbyname
-#define getnetconfig _getnetconfig
-#define getnetconfigent _getnetconfigent
-#define getnetent _getnetent
-#define getnetgrent _getnetgrent
-#define getnetpath _getnetpath
-#define getopt _getopt
-#define getopt_long _getopt_long
-#define getpagesize _getpagesize
-#define getpass _getpass
-#define getprotobyname _getprotobyname
-#define getprotobynumber _getprotobynumber
-#define getprotoent _getprotoent
-#define getpwent _getpwent
-#define getpwnam _getpwnam
-#define getpwuid _getpwuid
-#define getrpcbyname _getrpcbyname
-#define getrpcbynumber _getrpcbynumber
-#define getrpcent _getrpcent
-#define getrpcport _getrpcport
-#define getservbyname _getservbyname
-#define getservbyport _getservbyport
-#define getservent _getservent
-#define getsubopt _getsubopt
-#define getttyent _getttyent
-#define getttynam _getttynam
-#define getusershell _getusershell
-#define glob _glob
-#define globfree _globfree
-#define gmtime_r _gmtime_r
-#define group_from_gid _group_from_gid
-#define heapsort _heapsort
-#define herror _herror
-#define hes_error _hes_error
-#define hes_free _hes_free
-#define hes_init _hes_init
-#define hes_resolve _hes_resolve
-#define hes_to_bind _hes_to_bind
-#define hesiod_end _hesiod_end
-#define hesiod_free_list _hesiod_free_list
-#define hesiod_init _hesiod_init
-#define hesiod_resolve _hesiod_resolve
-#define hesiod_to_bind _hesiod_to_bind
-#define if_freenameindex _if_freenameindex
-#define if_indextoname _if_indextoname
-#define if_nameindex _if_nameindex
-#define if_nametoindex _if_nametoindex
-#define in6addr_any _in6addr_any
-#define in6addr_linklocal_allnodes _in6addr_linklocal_allnodes
-#define in6addr_loopback _in6addr_loopback
-#define in6addr_nodelocal_allnodes _in6addr_nodelocal_allnodes
-#define inet6_option_alloc _inet6_option_alloc
-#define inet6_option_append _inet6_option_append
-#define inet6_option_find _inet6_option_find
-#define inet6_option_init _inet6_option_init
-#define inet6_option_next _inet6_option_next
-#define inet6_option_space _inet6_option_space
-#define inet6_rthdr_add _inet6_rthdr_add
-#define inet6_rthdr_getaddr _inet6_rthdr_getaddr
-#define inet6_rthdr_getflags _inet6_rthdr_getflags
-#define inet6_rthdr_init _inet6_rthdr_init
-#define inet6_rthdr_lasthop _inet6_rthdr_lasthop
-#define inet6_rthdr_segments _inet6_rthdr_segments
-#define inet6_rthdr_space _inet6_rthdr_space
-#define inet_lnaof _inet_lnaof
-#define inet_makeaddr _inet_makeaddr
-#define inet_net_ntop _inet_net_ntop
-#define inet_net_pton _inet_net_pton
-#define inet_neta _inet_neta
-#define inet_netof _inet_netof
-#define inet_network _inet_network
-#define inet_nsap_addr _inet_nsap_addr
-#define inet_nsap_ntoa _inet_nsap_ntoa
-#define inet_ntoa _inet_ntoa
-#define inet_ntop _inet_ntop
-#define initgroups _initgroups
-#define initstate _initstate
-#define innetgr _innetgr
-#define isatty _isatty
-#define isinf _isinf
-#define isnan _isnan
-#define jrand48 _jrand48
-#define l64a _l64a
-#define l64a_r _l64a_r
-#define lcong48 _lcong48
-#define llabs _llabs
-#define lldiv _lldiv
-#define localtime_r _localtime_r
-#define lockf _lockf
-#define lrand48 _lrand48
-#define lseek _lseek
-#define mergesort _mergesort
-#define mmap _mmap
-#define mpool_close _mpool_close
-#define mpool_filter _mpool_filter
-#define mpool_get _mpool_get
-#define mpool_new _mpool_new
-#define mpool_open _mpool_open
-#define mpool_put _mpool_put
-#define mpool_sync _mpool_sync
-#define mrand48 _mrand48
-#define nc_perror _nc_perror
-#define nc_sperror _nc_sperror
-#define nice _nice
-#if 0
-#define nlist _nlist
-#endif
-#define nrand48 _nrand48
-#define nsdispatch _nsdispatch
-#define offtime _offtime
-#define opendir _opendir
-#define openlog _openlog
-#define pause _pause
-#define pclose _pclose
-#define pmap_getmaps _pmap_getmaps
-#define pmap_getport _pmap_getport
-#define pmap_rmtcall _pmap_rmtcall
-#define pmap_set _pmap_set
-#define pmap_unset _pmap_unset
-#define popen _popen
-#define posix2time _posix2time
-#define pread _pread
-#define psignal _psignal
-#define putenv _putenv
-#define pwrite _pwrite
-#define qabs _qabs
-#define qdiv _qdiv
-#define radixsort _radixsort
-#define random _random
-#define readdir _readdir
-#define realpath _realpath
-#define regcomp _regcomp
-#define regerror _regerror
-#define regexec _regexec
-#define regfree _regfree
-#define registerrpc _registerrpc
-#define res_init _res_init
-#define res_mkquery _res_mkquery
-#define res_query _res_query
-#define res_search _res_search
-#define rewinddir _rewinddir
-#define rpc_broadcast _rpc_broadcast
-#define rpc_broadcast_exp _rpc_broadcast_exp
-#define rpc_call _rpc_call
-#define rpc_reg _rpc_reg
-#define rpcb_getmaps _rpcb_getmaps
-#define rpcb_gettime _rpcb_gettime
-#define rpcb_rmtcall _rpcb_rmtcall
-#define rpcb_set _rpcb_set
-#define rpcb_taddr2uaddr _rpcb_taddr2uaddr
-#define rpcb_uaddr2taddr _rpcb_uaddr2taddr
-#define rpcb_unset _rpcb_unset
-#define scandir _scandir
-#define seed48 _seed48
-#define seekdir _seekdir
-#define send _send
-#define setdomainname _setdomainname
-#define setenv _setenv
-#define setfsent _setfsent
-#define setgrent _setgrent
-#define setgroupent _setgroupent
-#define sethostent _sethostent
-#define sethostname _sethostname
-#define setlogmask _setlogmask
-#define setmode _setmode
-#define setnetconfig _setnetconfig
-#define setnetent _setnetent
-#define setnetgrent _setnetgrent
-#define setpassent _setpassent
-#define setnetpath _setnetpath
-#define setproctitle _setproctitle
-#define setprotoent _setprotoent
-#define setpwent _setpwent
-#define setrpcent _setrpcent
-#define setservent _setservent
-#define setstate _setstate
-#define setttyent _setttyent
-#define setusershell _setusershell
-#define shm_open _shm_open
-#define shm_unlink _shm_unlink
-#define siginterrupt _siginterrupt
-#define signal _signal
-#define sl_add _sl_add
-#define sl_find _sl_find
-#define sl_free _sl_free
-#define sl_init _sl_init
-#define sleep _sleep
-#define snprintf _snprintf
-#define sradixsort _sradixsort
-#define srand48 _srand48
-#define srandom _srandom
-#define strcasecmp _strcasecmp
-#define strdup _strdup
-#define strncasecmp _strncasecmp
-#define strptime _strptime
-#define strsep _strsep
-#define strsignal _strsignal
-#define strsvis _strsvis
-#define strsvisx _strsvisx
-#define strtok_r _strtok_r
-#define strunvis _strunvis
-#define strvis _strvis
-#define strvisx _strvisx
-#define svc_auth_reg _svc_auth_reg
-#define svc_create _svc_create
-#define svc_dg_create _svc_dg_create
-#define svc_exit _svc_exit
-#define svc_fd_create _svc_fd_create
-#define svc_getreq _svc_getreq
-#define svc_getreqset _svc_getreqset
-#define svc_getreq_common _svc_getreq_common
-#define svc_raw_create _svc_raw_create
-#define svc_register _svc_register
-#define svc_reg _svc_reg
-#define svc_run _svc_run
-#define svc_sendreply _svc_sendreply
-#define svc_tli_create _svc_tli_create
-#define svc_tp_create _svc_tp_create
-#define svc_unregister _svc_unregister
-#define svc_unreg _svc_unreg
-#define svc_vc_create _svc_vc_create
-#define svcerr_auth _svcerr_auth
-#define svcerr_decode _svcerr_decode
-#define svcerr_noproc _svcerr_noproc
-#define svcerr_noprog _svcerr_noprog
-#define svcerr_progvers _svcerr_progvers
-#define svcerr_systemerr _svcerr_systemerr
-#define svcerr_weakauth _svcerr_weakauth
-#define svcfd_create _svcfd_create
-#define svcraw_create _svcraw_create
-#define svctcp_create _svctcp_create
-#define svcudp_bufcreate _svcudp_bufcreate
-#define svcudp_create _svcudp_create
-#define svcudp_enablecache _svcudp_enablecache
-#define svis _svis
-#define sysconf _sysconf
-#define sysctl _sysctl
-#define syslog _syslog
-#define tcdrain _tcdrain
-#define tcflow _tcflow
-#define tcflush _tcflush
-#define tcgetattr _tcgetattr
-#define tcgetpgrp _tcgetpgrp
-#define tcgetsid _tcgetsid
-#define tcsendbreak _tcsendbreak
-#define tcsetattr _tcsetattr
-#define tcsetpgrp _tcsetpgrp
-#define telldir _telldir
-#define time _time
-#define time2posix _time2posix
-#define timegm _timegm
-#define timelocal _timelocal
-#define timeoff _timeoff
-#define times _times
-#if 0
-#define timezone _timezone
-#endif
-#define ttyname _ttyname
-#define ttyslot _ttyslot
-#define tzname _tzname
-#define tzset _tzset
-#define tzsetwall _tzsetwall
-#define ualarm _ualarm
-#define uname _uname
-#define unsetenv _unsetenv
-#define unvis _unvis
-#define user_from_uid _user_from_uid
-#define usleep _usleep
-#define utime _utime
-#define valloc _valloc
-#define vis _vis
-#define vsnprintf _vsnprintf
-#define vsyslog _vsyslog
-#define wait _wait
-#define wait3 _wait3
-#define waitpid _waitpid
-#define xdr_accepted_reply _xdr_accepted_reply
-#define xdr_array _xdr_array
-#define xdr_authunix_parms _xdr_authunix_parms
-#define xdr_bool _xdr_bool
-#define xdr_bytes _xdr_bytes
-#define xdr_callhdr _xdr_callhdr
-#define xdr_callmsg _xdr_callmsg
-#define xdr_char _xdr_char
-#define xdr_datum _xdr_datum
-#define xdr_des_block _xdr_des_block
-#define xdr_domainname _xdr_domainname
-#define xdr_double _xdr_double
-#define xdr_enum _xdr_enum
-#define xdr_float _xdr_float
-#define xdr_free _xdr_free
-#define xdr_hyper _xdr_hyper
-#define xdr_int _xdr_int
-#define xdr_int16_t _xdr_int16_t
-#define xdr_int32_t _xdr_int32_t
-#define xdr_int64_t _xdr_int64_t
-#define xdr_long _xdr_long
-#define xdr_longlong_t _xdr_longlong_t
-#define xdr_mapname _xdr_mapname
-#define xdr_netbuf _xdr_netbuf
-#define xdr_netobj _xdr_netobj
-#define xdr_opaque _xdr_opaque
-#define xdr_opaque_auth _xdr_opaque_auth
-#define xdr_peername _xdr_peername
-#define xdr_pmap _xdr_pmap
-#define xdr_pmaplist _xdr_pmaplist
-#define xdr_pointer _xdr_pointer
-#define xdr_reference _xdr_reference
-#define xdr_rejected_reply _xdr_rejected_reply
-#define xdr_replymsg _xdr_replymsg
-#define xdr_rmtcall_args _xdr_rmtcall_args
-#define xdr_rmtcallres _xdr_rmtcallres
-#define xdr_rpcb _xdr_rpcb
-#define xdr_rpcb_entry _xdr_rpcb_entry
-#define xdr_rpcb_entry_list_ptr _xdr_rpcb_entry_list_ptr
-#define xdr_rpcb_rmtcallargs _xdr_rpcb_rmtcallargs
-#define xdr_rpcb_rmtcallres _xdr_rpcb_rmtcallres
-#define xdr_rpcb_stat _xdr_rpcb_stat
-#define xdr_rpcb_stat_byvers _xdr_rpcb_stat_byvers
-#define xdr_rpcblist _xdr_rpcblist
-#define xdr_rpcblist_ptr _xdr_rpcblist_ptr
-#define xdr_rpcbs_addrlist _xdr_rpcbs_addrlist
-#define xdr_rpcbs_addrlist_ptr _xdr_rpcbs_addrlist_ptr
-#define xdr_rpcbs_proc _xdr_rpcbs_proc
-#define xdr_rpcbs_rmtcalllist _xdr_rpcbs_rmtcalllist
-#define xdr_rpcbs_rmtcalllist_ptr _xdr_rpcbs_rmtcalllist_ptr
-#define xdr_rpcbs _xdr_rpcbs
-#define xdr_rpcbs _xdr_rpcbs
-#define xdr_short _xdr_short
-#define xdr_string _xdr_string
-#define xdr_u_char _xdr_u_char
-#define xdr_u_hyper _xdr_u_hyper
-#define xdr_u_int _xdr_u_int
-#define xdr_u_int16_t _xdr_u_int16_t
-#define xdr_u_int32_t _xdr_u_int32_t
-#define xdr_u_int64_t _xdr_u_int64_t
-#define xdr_u_long _xdr_u_long
-#define xdr_u_longlong_t _xdr_u_longlong_t
-#define xdr_u_short _xdr_u_short
-#define xdr_union _xdr_union
-#define xdr_vector _xdr_vector
-#define xdr_void _xdr_void
-#define xdr_wrapstring _xdr_wrapstring
-#define xdr_yp_inaddr _xdr_yp_inaddr
-#define xdr_ypall _xdr_ypall
-#define xdr_ypbind_resp _xdr_ypbind_resp
-#define xdr_ypbind_setdom _xdr_ypbind_setdom
-#define xdr_ypdomain_wrap_string _xdr_ypdomain_wrap_string
-#define xdr_ypmap_parms _xdr_ypmap_parms
-#define xdr_ypmap_wrap_string _xdr_ypmap_wrap_string
-#define xdr_ypmaplist _xdr_ypmaplist
-#define xdr_ypowner_wrap_string _xdr_ypowner_wrap_string
-#define xdr_yppushresp_xfr _xdr_yppushresp_xfr
-#define xdr_ypreq_key _xdr_ypreq_key
-#define xdr_ypreq_nokey _xdr_ypreq_nokey
-#define xdr_ypreq_xfr _xdr_ypreq_xfr
-#define xdr_ypresp_key_val _xdr_ypresp_key_val
-#define xdr_ypresp_maplist _xdr_ypresp_maplist
-#define xdr_ypresp_master _xdr_ypresp_master
-#define xdr_ypresp_order _xdr_ypresp_order
-#define xdr_ypresp_val _xdr_ypresp_val
-#define xdrmem_create _xdrmem_create
-#define xdrrec_create _xdrrec_create
-#define xdrrec_endofrecord _xdrrec_endofrecord
-#define xdrrec_eof _xdrrec_eof
-#define xdrrec_skiprecord _xdrrec_skiprecord
-#define xdrstdio_create _xdrstdio_create
-#define xprt_register _xprt_register
-#define xprt_unregister _xprt_unregister
-#define yp_all _yp_all
-#define yp_bind _yp_bind
-#define yp_first _yp_first
-#define yp_get_default_domain _yp_get_default_domain
-#define yp_maplist _yp_maplist
-#define yp_master _yp_master
-#define yp_match _yp_match
-#define yp_next _yp_next
-#define yp_order _yp_order
-#define yp_unbind _yp_unbind
-#define yperr_string _yperr_string
-#define ypprot_err _ypprot_err
-#define dlopen __dlopen
-#define dlclose __dlclose
-#define dlsym __dlsym
-#define dlerror __dlerror
-#define dladdr __dladdr
-#endif
-
-#endif
diff --git a/devel/libgetopt/files/shlib_version b/devel/libgetopt/files/shlib_version
deleted file mode 100644
index 536d4ccef4f..00000000000
--- a/devel/libgetopt/files/shlib_version
+++ /dev/null
@@ -1,5 +0,0 @@
-# $NetBSD: shlib_version,v 1.2 2000/10/18 11:16:59 wiz Exp $
-# Don't forget to edit pkg/PLIST when changing
-#
-major=1
-minor=1