r1187 - in trunk: freebsd6-buildutils/debian/patches libbsd libbsd/debian libbsd/include/bsd
Author: rmh
Date: 2006-02-13 20:56:47 +0000 (Mon, 13 Feb 2006)
New Revision: 1187
Added:
trunk/libbsd/bsd_getopt.c
trunk/libbsd/include/bsd/getopt.h
Modified:
trunk/freebsd6-buildutils/debian/patches/11_optreset.diff
trunk/libbsd/ChangeLog
trunk/libbsd/Makefile
trunk/libbsd/Versions
trunk/libbsd/debian/changelog
Log:
Implement bsd_getopt in libbsd, and use it in freebsd6-buildutils (for make).
Modified: trunk/freebsd6-buildutils/debian/patches/11_optreset.diff
===================================================================
--- trunk/freebsd6-buildutils/debian/patches/11_optreset.diff 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/freebsd6-buildutils/debian/patches/11_optreset.diff 2006-02-13 20:56:47 UTC (rev 1187)
@@ -1,12 +1,20 @@
---- src/usr.bin/make/main.c~ 2006-02-13 10:59:47.000000000 +0100
-+++ src/usr.bin/make/main.c 2006-02-13 11:00:11.000000000 +0100
-@@ -337,8 +337,7 @@
- Boolean found_dd = FALSE;
+--- src/usr.bin/make/main.c~ 2006-02-13 20:44:23.000000000 +0100
++++ src/usr.bin/make/main.c 2006-02-13 20:46:55.000000000 +0100@
+@@ -136,6 +136,8 @@
+ time_t now; /* Time at start of make */
+ struct GNode *DEFAULT; /* .DEFAULT node */
- rearg:
-- optind = 1; /* since we're called more than once */
-- optreset = 1;
-+ reset_getopt ();
- #define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:"
- for (;;) {
++#include <bsd/getopt.h> /* optreset */
++
+ /**
+ * Exit with usage message.
+ */
+@@ -358,7 +358,7 @@
if ((optind < argc) && strcmp(argv[optind], "--") == 0) {
+ found_dd = TRUE;
+ }
+- if ((c = getopt(argc, argv, OPTFLAGS)) == -1) {
++ if ((c = bsd_getopt(argc, argv, OPTFLAGS)) == -1) {
+ break;
+ }
+ switch(c) {
Modified: trunk/libbsd/ChangeLog
===================================================================
--- trunk/libbsd/ChangeLog 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/ChangeLog 2006-02-13 20:56:47 UTC (rev 1187)
@@ -1,3 +1,11 @@
+2006-02-13 Robert Millan <rmh@aybabtu.com>
+
+ Add bsd_getopt.
+ * bsd_getopt.c: New.
+ * include/bsd/getopt.h: New.
+ * Versions: Add bsd_getopt and optreset.
+ * Makefile: Add bsd_getopt.c and include/bsd/getopt.h.
+
2006-02-10 Robert Millan <rmh@aybabtu.com>
Add errc, warnc, verrc and vwarnc.
Modified: trunk/libbsd/Makefile
===================================================================
--- trunk/libbsd/Makefile 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/Makefile 2006-02-13 20:56:47 UTC (rev 1187)
@@ -4,9 +4,9 @@
# $Id$
#
-LIB_SRCS = arc4random.c err.c fgetln.c inet_net_pton.c strlcat.c strlcpy.c md5c.c fmtcheck.c
+LIB_SRCS = arc4random.c bsd_getopt.c err.c fgetln.c inet_net_pton.c strlcat.c strlcpy.c md5c.c fmtcheck.c
-LIB_INCLUDES = include/bsd/err.h include/bsd/ip_icmp.h include/bsd/random.h include/bsd/queue.h include/bsd/md5.h include/bsd/string.h include/bsd/bsd.h include/bsd/stdlib.h
+LIB_INCLUDES = include/bsd/err.h include/bsd/getopt.h include/bsd/ip_icmp.h include/bsd/random.h include/bsd/queue.h include/bsd/md5.h include/bsd/string.h include/bsd/bsd.h include/bsd/stdlib.h
LIB_MANS = man/arc4random.3 man/strlcpy.3 man/fgetln.3 man/fmtcheck.3
Modified: trunk/libbsd/Versions
===================================================================
--- trunk/libbsd/Versions 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/Versions 2006-02-13 20:56:47 UTC (rev 1187)
@@ -1,6 +1,7 @@
LIBBSD_0.0 {
global:
arc4random;
+ bsd_getopt; optreset;
errc; warnc; verrc; vwarnc;
fgetln;
fgetwln;
Added: trunk/libbsd/bsd_getopt.c
===================================================================
--- trunk/libbsd/bsd_getopt.c 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/bsd_getopt.c 2006-02-13 20:56:47 UTC (rev 1187)
@@ -0,0 +1,15 @@
+#include <bsd/getopt.h>
+
+int optreset = 0;
+
+int
+bsd_getopt (int argc, char **argv, char *shortopts)
+{
+ if (optreset == 1)
+ {
+ optreset = 0;
+ optind = 0;
+ }
+
+ return getopt (argc, argv, shortopts);
+}
Modified: trunk/libbsd/debian/changelog
===================================================================
--- trunk/libbsd/debian/changelog 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/debian/changelog 2006-02-13 20:56:47 UTC (rev 1187)
@@ -1,4 +1,4 @@
-libbsd (0.0-1) unreleased; urgency=low
+libbsd (0.0-1+kbsd.1) unreleased; urgency=low
* Initial release.
Added: trunk/libbsd/include/bsd/getopt.h
===================================================================
--- trunk/libbsd/include/bsd/getopt.h 2006-02-13 20:45:13 UTC (rev 1186)
+++ trunk/libbsd/include/bsd/getopt.h 2006-02-13 20:56:47 UTC (rev 1187)
@@ -0,0 +1,4 @@
+#include <getopt.h>
+extern int optreset;
+
+int bsd_getopt (int, char **, char *);
Reply to: