diff options
author | jlam <jlam> | 2000-08-25 16:15:52 +0000 |
---|---|---|
committer | jlam <jlam> | 2000-08-25 16:15:52 +0000 |
commit | 71eb72cb4a5a19ac09b68ab9319890ca94d51cc1 (patch) | |
tree | 91bc4f6b08d1fbc4010c48f8659cf5765bb79760 /devel | |
parent | 3a1bebce123bb22057ee0a47182f21bd1e3213ed (diff) | |
download | pkgsrc-71eb72cb4a5a19ac09b68ab9319890ca94d51cc1.tar.gz |
cmdline - C++ library for parsing command arguments
Diffstat (limited to 'devel')
43 files changed, 5412 insertions, 0 deletions
diff --git a/devel/cmdline/Makefile b/devel/cmdline/Makefile new file mode 100644 index 00000000000..3398217bd8f --- /dev/null +++ b/devel/cmdline/Makefile @@ -0,0 +1,30 @@ +# $NetBSD: Makefile,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +DISTNAME= CmdLine +PKGNAME= cmdline-${PKG_VERS} +DIST_VERS= 1.04 +PKG_VERS= 1.05nb1 +CATEGORIES= devel +MASTER_SITES= http://www.enteract.com/~bradapp/ftp/src/libs/C++/ + +MAINTAINER= jlam@netbsd.org +HOMEPAGE= http://www.enteract.com/~bradapp/ftp/src/libs/C++/CmdLine.html + +DIST_SUBDIR= cmdline-${DIST_VERS} + +USE_LIBTOOL= # defined +NO_CONFIGURE= # defined + +.if exists(/usr/include/readline.h) +MOREUSRDEFS+= -DHAVE_READLINE_H +MOREUSRLIBS+= -ledit -ltermcap +.else +DEPENDS+= readline-*:../../devel/readline +MOREUSRDEFS+= -DHAVE_READLINE_READLINE_H +MOREUSRLIBS+= ${LDFLAGS} -lreadline -ltermcap +.endif + +MAKE_ENV+= MOREUSRDEFS="${MOREUSRDEFS}" +MAKE_ENV+= MOREUSRLIBS="${MOREUSRLIBS}" + +.include "../../mk/bsd.pkg.mk" diff --git a/devel/cmdline/files/md5 b/devel/cmdline/files/md5 new file mode 100644 index 00000000000..4666ea501da --- /dev/null +++ b/devel/cmdline/files/md5 @@ -0,0 +1,3 @@ +$NetBSD: md5,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +MD5 (cmdline-1.04/CmdLine.tar.gz) = ae2d805e9ced6a862307715253d0a84a diff --git a/devel/cmdline/files/patch-sum b/devel/cmdline/files/patch-sum new file mode 100644 index 00000000000..0130f91d9eb --- /dev/null +++ b/devel/cmdline/files/patch-sum @@ -0,0 +1,39 @@ +$NetBSD: patch-sum,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +MD5 (patch-aa) = 1b104107cf882e4cb3ffbc9eff23fce7 +MD5 (patch-ab) = a23bca184a8937f1a19f4e814bb88038 +MD5 (patch-ac) = 5463c6295dacd48b3d102599fac5e2c3 +MD5 (patch-ad) = d1c3f24f88189d1d00c5a5fb39cc15ab +MD5 (patch-ae) = 31599930521a553ca62bfdf3891eaca0 +MD5 (patch-af) = c2bc9740df3a07244dd7a05fe9870b7f +MD5 (patch-ag) = 22f77a05607374145827208c82b8ed81 +MD5 (patch-ah) = daaa8553bc23f4cede8c614e80c49d80 +MD5 (patch-ai) = 8a17e49a3f22b540c1aff7e76361fdd8 +MD5 (patch-aj) = bbf27ba3a4bb8ca813c070474ad9a508 +MD5 (patch-ak) = cba0e51465501ad7899eb0abdaf809a5 +MD5 (patch-al) = 5f91d3a5247e7b0497cd7faf24cb416f +MD5 (patch-am) = 4ba04325d01722200fefde0e71207418 +MD5 (patch-an) = 028904f17214a387b5e64318049e1d85 +MD5 (patch-ao) = 9950a8b306c2c67fb4df6bb55f7c94f9 +MD5 (patch-ap) = a5a4a0b85a9d8df42f84ae5d5c2ce785 +MD5 (patch-aq) = 616beb9362ec4ed168e221ab22570430 +MD5 (patch-ar) = 189843c64b0a6df5303a62f3e65b4bc2 +MD5 (patch-as) = f93118c6fa747ffad4684c20d4b2dd23 +MD5 (patch-at) = 5cf58101bc7059ddd5fbe8f3b6431090 +MD5 (patch-au) = 9cd9ba694b52ee5d6901990431d40841 +MD5 (patch-av) = da7e83313c978d8cb6a2941df10cd4ce +MD5 (patch-aw) = 3cd2158e8cfcf7d217a3aec11ce0c97e +MD5 (patch-ax) = b415f2cb118bfbbb598532b88ddf48aa +MD5 (patch-ay) = 673e1ea1b9109a29d6de4ed69beb0a2f +MD5 (patch-az) = a29ee8df91415f0bf42b8e1328c78dde +MD5 (patch-ba) = 182909e3184529841759736aebfdbdd2 +MD5 (patch-bb) = 4912be536b503a10c8916dc04c1bff84 +MD5 (patch-bc) = 615d0cb28394d4c539da4af293b7ed64 +MD5 (patch-bd) = 064c19014c159ddb9bfac8c53a3b3ea8 +MD5 (patch-be) = 554d8a4fbe5a0ba6d23c48debfd7baca +MD5 (patch-bf) = c5e576e7ba35ded3ca06ddff6dc1660d +MD5 (patch-bg) = b7fc331e0410e300a54a5fd9de0548c7 +MD5 (patch-bh) = 4c90f0610cf7e1dc4b8af5ffb0ade203 +MD5 (patch-bi) = 2827f9b0b72c6d7c91076006cd374d5f +MD5 (patch-bj) = d74eefe364e5ed2487f84c9943ca9439 +MD5 (patch-bk) = 4ca3eb755506f6fb1fd18978491ccd26 diff --git a/devel/cmdline/patches/patch-aa b/devel/cmdline/patches/patch-aa new file mode 100644 index 00000000000..1ad6e446041 --- /dev/null +++ b/devel/cmdline/patches/patch-aa @@ -0,0 +1,71 @@ +$NetBSD: patch-aa,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +--- Config.mk.orig Thu Jan 2 13:33:36 1997 ++++ Config.mk +@@ -13,7 +13,7 @@ + ###^^##################################################################### + + ## Universe to compile in (use "att" for SYSV Unix and "ucb" for BSD Unix). +-.UNIVERSE=att ++.UNIVERSE=ucb + + ## Host operating system + OS=unix +@@ -28,7 +28,7 @@ + OBJEXT=.o + + ## library file extension +-LIBEXT=.a ++LIBEXT=.la + + ## executable file extension + EXECEXT= +@@ -106,7 +106,7 @@ + # their corresponding strings at the end of doc/macros.man! + # + ## common local directory +-LOCAL=/usr/local/ ++LOCAL=${PREFIX}/ + + ## where to install executables + BINDIR=$(LOCAL)bin/ +@@ -127,10 +127,10 @@ + LOCALMAN=local_man/ + + ## where to install man-pages +-MANDIR=/usr/man/$(LOCALMAN) ++MANDIR=$(LOCAL)man/ + + ## where to install catman-pages (preformatted manual pages) +-CATMANDIR=/usr/catman/$(LOCALMAN) ++CATMANDIR=$(MANDIR) + + ## subdirectory of MANDIR and CATMANDIR for section 1 of man-pages + MAN1DIR=man1/ +@@ -149,7 +149,7 @@ + # Define C++ compilation stuff + # + ## name of C++ compiler +-CC=CC ++CC=$(LIBTOOL) g++ + + ## option to specify other include directories to search + INC=-I +@@ -183,7 +183,8 @@ + FLAG=$(OPT) + # FLAG=$(DBG) + TESTDEFS= +-USRDEFS=$(DEF)DEBUG_CMDLINE ++USRDEFS=$(DEF)unix $(DEF)DEBUG_CMDLINE $(DEF)GNU_READLINE $(MOREUSRDEFS) ++USRLIBS=$(MOREUSRLIBS) + OPTIONS= + + #------------------------------------------------------------------------------ +@@ -192,6 +193,7 @@ + RECUR= "FLAG=$(FLAG)" \ + "TESTDEFS=$(TESTDEFS)" \ + "USRDEFS=$(USRDEFS)" \ ++ "USRLIBS=$(USRLIBS)" \ + "OPTIONS=$(OPTIONS)" + + #------------------------------------------------------------------------------ diff --git a/devel/cmdline/patches/patch-ab b/devel/cmdline/patches/patch-ab new file mode 100644 index 00000000000..28d51196992 --- /dev/null +++ b/devel/cmdline/patches/patch-ab @@ -0,0 +1,48 @@ +$NetBSD: patch-ab,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +--- doc/Makefile.orig Thu Jan 2 13:33:24 1997 ++++ doc/Makefile +@@ -47,18 +47,16 @@ + + .man1.1: + $(SOELIM) $< >$*.1 +- $(MANTOCATMAN) $*.1 + + .man3.3: + $(SOELIM) $< >$*.3 +- $(MANTOCATMAN) $*.3 + + ### + # installation dependencies + ### + all: + +-install: installman installcatman ++install: installman + + installman: installman1 installman3 + +@@ -66,19 +64,19 @@ + + installman1: $(MAN1FILES) + ( $(CHDIR) $(MANDIR)$(MAN1DIR) ; $(RM) $(MAN1FILES) ) +- $(CP) $(MAN1FILES) $(MANDIR)$(MAN1DIR) ++ $(BSD_INSTALL_MAN) $(MAN1FILES) $(MANDIR)$(MAN1DIR) + + installcatman1: $(CATMAN1FILES) + ( $(CHDIR) $(CATMANDIR)$(MAN1DIR) ; $(RM) $(CATMAN1FILES) ) +- $(CP) $(CATMAN1FILES) $(CATMANDIR)$(MAN1DIR) ++ $(BSD_INSTALL_MAN) $(CATMAN1FILES) $(CATMANDIR)$(MAN1DIR) + + installman3: $(MAN3FILES) + ( $(CHDIR) $(MANDIR)$(MAN3DIR) ; $(RM) $(MAN3FILES) ) +- $(CP) $(MAN3FILES) $(MANDIR)$(MAN3DIR) ++ $(BSD_INSTALL_MAN) $(MAN3FILES) $(MANDIR)$(MAN3DIR) + + installcatman3: $(CATMAN3FILES) + ( $(CHDIR) $(CATMANDIR)$(MAN3DIR) ; $(RM) $(CATMAN3FILES) ) +- $(CP) $(CATMAN3FILES) $(CATMANDIR)$(MAN3DIR) ++ $(BSD_INSTALL_MAN) $(CATMAN3FILES) $(CATMANDIR)$(MAN3DIR) + + ### + # maintenance dependencies diff --git a/devel/cmdline/patches/patch-ac b/devel/cmdline/patches/patch-ac new file mode 100644 index 00000000000..b2c62e1fbb2 --- /dev/null +++ b/devel/cmdline/patches/patch-ac @@ -0,0 +1,41 @@ +$NetBSD: patch-ac,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +--- src/cmd/Makefile.orig Thu Jan 2 13:33:27 1997 ++++ src/cmd/Makefile +@@ -46,12 +46,12 @@ + ### + # compilation options + ### +-INCLUDES=$(INC)$(PROGLIBDIR) ++INCLUDES=$(INC)$(PROGLIBDIR) $(INC)$(CURDIR) + FLAG=$(OPT) + # FLAG=$(DBG) + TESTDEFS= + USRDEFS= +-DEFINES=$(OSDEFS) $(USRDEFS) $(TESTDEFS) ++DEFINES=$(OSDEFS) $(USRDEFS) $(TESTDEFS) $(MOREUSRDEFS) + OPTIONS= + CFLAGS=$(FLAG) $(INCLUDES) $(DEFINES) $(OPTIONS) + +@@ -74,17 +74,16 @@ + ( $(CHDIR) $(PROGLIBDIR) ; $(BUILD) $@ ; ) + + $(PROGRAM): $(OBJS) +- $(CC) $(EXE) $@ $(OBJS) $(PROGLIB) ++ $(CC) $(EXE) $@ $(OBJS) $(PROGLIB) $(USRLIBS) + + ### + # maintenance dependencies + ### + install: $(PROGRAM) $(BINDIR) $(PROGRAM).pl + -$(RM) $(BINDIR)$(PROGRAM) $(PERLLIB)$(PROGRAM).pl $(TCLLIB)$(PROGRAM).tcl +- $(CP) $(PROGRAM) $(BINDIR)$(PROGRAM) +- $(STRIP) $(BINDIR)$(PROGRAM) +- -$(CP) $(PROGRAM).pl $(PERLLIB)$(PROGRAM).pl +- -$(CP) $(PROGRAM).tcl $(TCLLIB)$(PROGRAM).tcl ++ $(LIBTOOL) $(BSD_INSTALL_PROGRAM) $(PROGRAM) $(BINDIR)$(PROGRAM) ++# -$(CP) $(PROGRAM).pl $(PERLLIB)$(PROGRAM).pl ++# -$(CP) $(PROGRAM).tcl $(TCLLIB)$(PROGRAM).tcl + + clean: + -$(RM) *$(OBJEXT) core .exrc *~ \#*\# diff --git a/devel/cmdline/patches/patch-ad b/devel/cmdline/patches/patch-ad new file mode 100644 index 00000000000..91e0987e1f0 --- /dev/null +++ b/devel/cmdline/patches/patch-ad @@ -0,0 +1,84 @@ +$NetBSD: patch-ad,v 1.1.1.1 2000/08/25 16:15:52 jlam Exp $ + +--- src/cmd/argtypes.c.orig Thu Jan 2 13:33:27 1997 ++++ src/cmd/argtypes.c +@@ -1,10 +1,6 @@ +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> +- + #include "argtypes.h" + ++using namespace cmdline; + + //----------------------------------------------------------------------------- + // ^FUNCTION: operator() - handle an argument from the command-line +@@ -64,7 +60,7 @@ + + //-------------------------------------------------------------- ShellCmdArgInt + +-ShellCmdArgInt::~ShellCmdArgInt(void) ++ShellCmdArgInt::~ShellCmdArgInt() + { + } + +@@ -80,7 +76,7 @@ + + //------------------------------------------------------------ ShellCmdArgFloat + +-ShellCmdArgFloat::~ShellCmdArgFloat(void) ++ShellCmdArgFloat::~ShellCmdArgFloat() + { + } + +@@ -96,7 +92,7 @@ + + //------------------------------------------------------------- ShellCmdArgChar + +-ShellCmdArgChar::~ShellCmdArgChar(void) ++ShellCmdArgChar::~ShellCmdArgChar() + { + } + +@@ -112,7 +108,7 @@ + + //-------------------------------------------------------------- ShellCmdArgStr + +-ShellCmdArgStr::~ShellCmdArgStr(void) ++ShellCmdArgStr::~ShellCmdArgStr() + { + } + +@@ -131,7 +127,7 @@ + const char * ShellCmdArgBool::true_string = "TRUE" ; + const char * ShellCmdArgBool::false_string = "" ; + +-ShellCmdArgBool::~ShellCmdArgBool(void) ++ShellCmdArgBool::~ShellCmdArgBool() + { + } + +@@ -148,7 +144,7 @@ + + //------------------------------------------------------------ ShellCmdArgClear + +-ShellCmdArgClear::~ShellCmdArgClear(void) ++ShellCmdArgClear::~ShellCmdArgClear() + { + } + +@@ -165,7 +161,7 @@ + + //----------------------------------------------------------- ShellCmdArgToggle + +-ShellCmdArgToggle::~ShellCmdArgToggle(void) ++ShellCmdArgToggle::~ShellCmdArgToggle() + { + } + +@@ -179,4 +175,3 @@ + } + return badval; + } +- diff --git a/devel/cmdline/patches/patch-ae b/devel/cmdline/patches/patch-ae new file mode 100644 index 00000000000..f4b18a99a7f --- /dev/null +++ b/devel/cmdline/patches/patch-ae @@ -0,0 +1,184 @@ +$NetBSD: patch-ae,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/argtypes.h.orig Thu Jan 2 13:33:27 1997 ++++ src/cmd/argtypes.h +@@ -8,6 +8,10 @@ + // + // ^HISTORY: + // 04/26/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Refer to namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _argtypes_h +@@ -27,21 +31,21 @@ + char * keyword, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPTVALREQ) + : ShellCmdArg(name, optchar, keyword, value, description, syntax_flags) + {} + + ShellCmdArgInt(char * name, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isPOSVALREQ) + : ShellCmdArg(name, value, description, syntax_flags) + {} + +- virtual ~ShellCmdArgInt(void); ++ virtual ~ShellCmdArgInt(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + //------------------------------------------------------------ ShellCmdArgFloat +@@ -56,21 +60,21 @@ + char * keyword, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPTVALREQ) + : ShellCmdArg(name, optchar, keyword, value, description, syntax_flags) + {} + + ShellCmdArgFloat(char * name, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isPOSVALREQ) + : ShellCmdArg(name, value, description, syntax_flags) + {} + +- virtual ~ShellCmdArgFloat(void); ++ virtual ~ShellCmdArgFloat(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + //------------------------------------------------------------- ShellCmdArgChar +@@ -85,21 +89,21 @@ + char * keyword, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPTVALREQ) + : ShellCmdArg(name, optchar, keyword, value, description, syntax_flags) + {} + + ShellCmdArgChar(char * name, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isPOSVALREQ) + : ShellCmdArg(name, value, description, syntax_flags) + {} + +- virtual ~ShellCmdArgChar(void); ++ virtual ~ShellCmdArgChar(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + //-------------------------------------------------------------- ShellCmdArgStr +@@ -114,21 +118,21 @@ + char * keyword, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPTVALREQ) + : ShellCmdArg(name, optchar, keyword, value, description, syntax_flags) + {} + + ShellCmdArgStr(char * name, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =cmdline::CmdArg::isPOSVALREQ) + : ShellCmdArg(name, value, description, syntax_flags) + {} + +- virtual ~ShellCmdArgStr(void); ++ virtual ~ShellCmdArgStr(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + //------------------------------------------------------------- ShellCmdArgBool +@@ -142,23 +146,23 @@ + char optchar, + char * keyword, + char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPT) + : ShellCmdArg(name, optchar, keyword, description, syntax_flags) + {} + +- virtual ~ShellCmdArgBool(void); ++ virtual ~ShellCmdArgBool(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + + // Need to know what the values to use for TRUE and FALSE are + // + + static const char * +- True(void) { return true_string ; } ++ True() { return true_string ; } + + static const char * +- False(void) { return false_string ; } ++ False() { return false_string ; } + + // Need to be able to set the values to use for TRUE and FALSE + +@@ -184,14 +188,14 @@ + char optchar, + char * keyword, + char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPT) + : ShellCmdArgBool(name, optchar, keyword, description, syntax_flags) + {} + +- virtual ~ShellCmdArgClear(void); ++ virtual ~ShellCmdArgClear(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + //----------------------------------------------------------- ShellCmdArgToggle +@@ -202,14 +206,14 @@ + char optchar, + char * keyword, + char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =cmdline::CmdArg::isOPT) + : ShellCmdArgBool(name, optchar, keyword, description, syntax_flags) + {} + +- virtual ~ShellCmdArgToggle(void); ++ virtual ~ShellCmdArgToggle(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + #endif /* _argtypes_h */ diff --git a/devel/cmdline/patches/patch-af b/devel/cmdline/patches/patch-af new file mode 100644 index 00000000000..2b1df097b14 --- /dev/null +++ b/devel/cmdline/patches/patch-af @@ -0,0 +1,160 @@ +$NetBSD: patch-af,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/cmdparse.c.orig Thu Jan 2 13:33:27 1997 ++++ src/cmd/cmdparse.c +@@ -10,20 +10,26 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added ALLOW_PLUS to list of CmdLine configuration flags ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Update to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <fstream.h> +-#include <strstream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <fstream> ++#include <iostream> ++#include <strstream> + + #include <argtypes.h> + #include "cmdparse.h" + #include "syntax.h" + #include "quoted.h" + ++using namespace cmdline; ++using namespace std; ++ + enum { SUCCESS = 0, FAILURE = -1 } ; + + enum { MAX_IDENT_LEN = 64, MAX_DESCRIPTION_LEN = 1024 } ; +@@ -67,8 +73,8 @@ + copy(char * & dest, const char * src) + { + if (src == NULL) return ; +- dest = new char[::strlen(src) + 1] ; +- if (dest) ::strcpy(dest, src); ++ dest = new char[strlen(src) + 1] ; ++ if (dest) strcpy(dest, src); + } + + //------------------------------------------------------------------ CmdArgVers +@@ -78,7 +84,7 @@ + { + } + +-CmdArgVers::~CmdArgVers(void) ++CmdArgVers::~CmdArgVers() + { + } + +@@ -136,7 +142,7 @@ + // Follow along - its pretty straightforward. + //-^^---------------- + int +-CmdParseCommand::parse_declarations(void) ++CmdParseCommand::parse_declarations() + { + const char * str = input_str ; + const char * varname = input_var ; +@@ -176,7 +182,7 @@ + // means that standard input should be used. + // + if (filename) { +- if (::strcmp(filename, "-") == 0) { ++ if (strcmp(filename, "-") == 0) { + rc += parse_declarations(cin); + } else { + ifstream ifs(filename); +@@ -256,7 +262,7 @@ + char * kwd = NULL ; + char * val = NULL ; + char * desc = NULL ; +- unsigned flags = arg.syntax() ; ++ unsigned int flags = arg.syntax() ; + char opt = arg.optchar() ; + + // Need to make copies of some things because we cant assume they +@@ -333,7 +339,7 @@ + // Parse the user's argument declarations from an input string. + // + // ^REQUIREMENTS: +-// This member function should only be called by parse_declarations(void). ++// This member function should only be called by parse_declarations(). + // + // ^SIDE-EFFECTS: + // - modifies usr_cmd by appending to it any valid arguments that we parse. +@@ -348,8 +354,8 @@ + CmdParseCommand::parse_declarations(const char * str) + { + int rc = 0; +- char * strbuf = new char[::strlen(str) + 1] ; +- (void) ::strcpy(strbuf, str); ++ char * strbuf = new char[strlen(str) + 1] ; ++ strcpy(strbuf, str); + istrstream iss(strbuf); + rc = parse_declarations(iss); + delete strbuf ; +@@ -372,7 +378,7 @@ + // Parse the user's argument declarations from an input steam. + // + // ^REQUIREMENTS: +-// This member function should only be called by parse_declarations(void). ++// This member function should only be called by parse_declarations(). + // + // ^SIDE-EFFECTS: + // - modifies usr_cmd by appending to it any valid arguments that we parse. +@@ -394,7 +400,7 @@ + CmdParseCommand::parse_declarations(istream & is) + { + // Keep track of the number of declarations that we parse. +- unsigned nargs = 0; ++ unsigned int nargs = 0; + + if (is.eof()) return SUCCESS; + +@@ -408,7 +414,7 @@ + // Skip all non-alpha-numerics + int c = is.peek() ; + while ((c != EOF) && (c != '_') && (! isalnum(c))) { +- (void) is.get(); ++ is.get(); + c = is.peek(); + } + +@@ -510,7 +516,7 @@ + void + CmdParseCommand::set_args(UnixShell * shell) + { +- unsigned flags, syntax; ++ unsigned int flags, syntax; + CmdLineCmdArgIter iter(usr_cmd); + + for (CmdArg * cmdarg = iter() ; cmdarg ; cmdarg = iter()) { +@@ -533,8 +539,8 @@ + if ((syntax & CmdArg::isVALTAKEN) && (! (flags & CmdArg::VALGIVEN))) { + // flag was given without its value - we need to record that + char var_name[256]; +- (void) ::strcpy(var_name, sh_cmdarg->name()); +- (void) ::strcat(var_name, suffix_str); ++ strcpy(var_name, sh_cmdarg->name()); ++ strcat(var_name, suffix_str); + ShellVariable sh_var(var_name); + sh_var.set(ShellCmdArgBool::True()); + shell->set(sh_var); +@@ -646,7 +652,7 @@ + + //------------------------------------------- CmdParseCommand::~CmdParseCommand + +-CmdParseCommand::~CmdParseCommand(void) ++CmdParseCommand::~CmdParseCommand() + { + CmdLineCmdArgIter iter(usr_cmd); + diff --git a/devel/cmdline/patches/patch-ag b/devel/cmdline/patches/patch-ag new file mode 100644 index 00000000000..8b9bd47edfd --- /dev/null +++ b/devel/cmdline/patches/patch-ag @@ -0,0 +1,123 @@ +$NetBSD: patch-ag,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/cmdparse.h.orig Thu Jan 2 13:33:28 1997 ++++ src/cmd/cmdparse.h +@@ -10,6 +10,10 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added ALLOW_PLUS to list of CmdLine configuration flags ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Refer to namespace cmdline ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _cmdparse_h +@@ -32,30 +36,30 @@ + // CmdArgVers is a class that simply prints (on cerr) the version + // information for this command. + // +-class CmdArgVers : public CmdArg { ++class CmdArgVers : public cmdline::CmdArg { + public: + CmdArgVers(char optchar, const char * keyword, const char * description); + +- virtual ~CmdArgVers(void); ++ virtual ~CmdArgVers(); + + virtual int +- operator()(const char * & arg, CmdLine & cmd); ++ operator()(const char * & arg, cmdline::CmdLine & cmd); + } ; + + + class istream ; + class ArgSyntax ; + class UnixShell ; +-class CmdParseCommand : public CmdLine { ++class CmdParseCommand : public cmdline::CmdLine { + public: + + CmdParseCommand(const char * name); + +- virtual ~CmdParseCommand(void); ++ virtual ~CmdParseCommand(); + + // Do whatever it is we need to do! + int +- operator()(CmdLineArgIter & iter) ; ++ operator()(cmdline::CmdLineArgIter & iter) ; + + private: + // Dont allow copying or assignment +@@ -68,7 +72,7 @@ + + // Parse the users argument declarations + int +- parse_declarations(void); ++ parse_declarations(); + + int + parse_declarations(const char * input); +@@ -85,35 +89,35 @@ + + //------------------------------------------------ arguments to cmdparse(1) + +- CmdArgBool anywhere; // clear OPTS_FIRST +- CmdArgBool anycase; // set ANY_CASE_OPTS +- CmdArgBool no_abort; // set NO_ABORT +- CmdArgBool no_guessing; // set NO_GUESSING +- CmdArgBool prompt; // set PROMPT_USER +- CmdArgBool plus; // set ALLOW_PLUS +- CmdArgBool opts_only; // set OPTS_ONLY +- CmdArgBool kwds_only; // set KWDS_ONLY +- CmdArgBool quiet; // set QUIET +- +- CmdArgVers version; // print version and exit +- CmdArgBool usage; // print usage and exit +- +- CmdArgBool array_variant; // use alternate array syntax +- CmdArgStr true_str; // TRUE for booleans +- CmdArgStr false_str; // FALSE for booleans +- CmdArgStr suffix_str; // suffix for missing optional-values +- CmdArgStr usr_shell; // the shell (command interpreter) +- +- CmdArgStr input_file; // read declarations from file +- CmdArgStr input_var; // read declarations environment variable +- CmdArgStr input_str; // read declarations from string ++ cmdline::CmdArgBool anywhere; // clear OPTS_FIRST ++ cmdline::CmdArgBool anycase; // set ANY_CASE_OPTS ++ cmdline::CmdArgBool no_abort; // set NO_ABORT ++ cmdline::CmdArgBool no_guessing; // set NO_GUESSING ++ cmdline::CmdArgBool prompt; // set PROMPT_USER ++ cmdline::CmdArgBool plus; // set ALLOW_PLUS ++ cmdline::CmdArgBool opts_only; // set OPTS_ONLY ++ cmdline::CmdArgBool kwds_only; // set KWDS_ONLY ++ cmdline::CmdArgBool quiet; // set QUIET ++ ++ CmdArgVers version; // print version and exit ++ cmdline::CmdArgBool usage; // print usage and exit ++ ++ cmdline::CmdArgBool array_variant; // use alternate array syntax ++ cmdline::CmdArgStr true_str; // TRUE for booleans ++ cmdline::CmdArgStr false_str; // FALSE for booleans ++ cmdline::CmdArgStr suffix_str; // suffix for missing optional-values ++ cmdline::CmdArgStr usr_shell; // the shell (command interpreter) ++ ++ cmdline::CmdArgStr input_file; // read declarations from file ++ cmdline::CmdArgStr input_var; // read declarations environment variable ++ cmdline::CmdArgStr input_str; // read declarations from string + +- CmdArgDummy dummy_arg; // "--" ++ cmdline::CmdArgDummy dummy_arg; // "--" + +- CmdArgStr usr_prog; // program name +- CmdArgStrList usr_args; // program arguments ++ cmdline::CmdArgStr usr_prog; // program name ++ cmdline::CmdArgStrList usr_args; // program arguments + +- CmdLine usr_cmd; // the user's CmdLine object ++ cmdline::CmdLine usr_cmd; // the user's CmdLine object + } ; + + #endif /* _cmdparse_h */ diff --git a/devel/cmdline/patches/patch-ah b/devel/cmdline/patches/patch-ah new file mode 100644 index 00000000000..81a14d08e7e --- /dev/null +++ b/devel/cmdline/patches/patch-ah @@ -0,0 +1,38 @@ +$NetBSD: patch-ah,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/fsm.c.orig Thu Jan 2 13:33:28 1997 ++++ src/cmd/fsm.c +@@ -7,15 +7,20 @@ + // + // ^HISTORY: + // 03/27/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <ctype.h> +-#include <string.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <iostream> + + #include "fsm.h" + ++using namespace std; ++ + // define the characters that have a "special" meaning + enum { + c_LBRACE = '[', +@@ -214,7 +219,7 @@ + // + if (! *input) { + fsm_state = FINAL; +- } else if (::strncmp(input, "...", 3) == 0) { ++ } else if (strncmp(input, "...", 3) == 0) { + fsm_state = LIST; + token.set(input, 3); + input += 3; diff --git a/devel/cmdline/patches/patch-ai b/devel/cmdline/patches/patch-ai new file mode 100644 index 00000000000..bcc51628e1e --- /dev/null +++ b/devel/cmdline/patches/patch-ai @@ -0,0 +1,81 @@ +$NetBSD: patch-ai,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/fsm.h.orig Thu Jan 2 13:33:28 1997 ++++ src/cmd/fsm.h +@@ -7,6 +7,9 @@ + // + // ^HISTORY: + // 03/27/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + class SyntaxFSM { +@@ -23,35 +26,35 @@ + + struct token_t { + const char * start; // start address of token +- unsigned len; // length of token ++ unsigned int len; // length of token + +- token_t(void) : start(0), len(0) {} ++ token_t() : start(0), len(0) {} + + void +- set(const char * s, unsigned l) { start = s, len = l; } ++ set(const char * s, unsigned int l) { start = s, len = l; } + } ; + +- SyntaxFSM(void) : ntoks(0), nbpairs(0), lev(0), fsm_state(START) {} ++ SyntaxFSM() : ntoks(0), nbpairs(0), lev(0), fsm_state(START) {} + + // Reset the FSM + void +- reset(void) { ntoks = 0; nbpairs = 0; lev = 0; fsm_state = START; } ++ reset() { ntoks = 0; nbpairs = 0; lev = 0; fsm_state = START; } + + // Return the number of tokens parsed thus far. +- unsigned +- num_tokens(void) const { return ntoks; } ++ unsigned int ++ num_tokens() const { return ntoks; } + + // Return the number of balanced brace-pairs parsed thus far. +- unsigned +- num_braces(void) const { return nbpairs; } ++ unsigned int ++ num_braces() const { return nbpairs; } + + // Return the current nesting level of brace-pairs + int +- level(void) const { return lev; } ++ level() const { return lev; } + + // Return the current machine state + state_t +- state(void) const { return fsm_state; } ++ state() const { return fsm_state; } + + // Get the next token from "input" and place it in "token" + // (consuming characters from "input"). +@@ -63,10 +66,10 @@ + operator()(const char * & input, token_t & token); + + protected: +- unsigned ntoks; // number of tokens parsed thus far +- unsigned nbpairs; // number of balanced brace-pairs parsed thus far +- int lev; // current nesting level of brace-pairs +- state_t fsm_state; // current machine state ++ unsigned int ntoks; // number of tokens parsed thus far ++ unsigned int nbpairs; // number of balanced brace-pairs parsed thus far ++ int lev; // current nesting level of brace-pairs ++ state_t fsm_state; // current machine state + + private: + void +@@ -75,4 +78,3 @@ + void + parse_token(const char * & input); + } ; +- diff --git a/devel/cmdline/patches/patch-aj b/devel/cmdline/patches/patch-aj new file mode 100644 index 00000000000..08be256deba --- /dev/null +++ b/devel/cmdline/patches/patch-aj @@ -0,0 +1,37 @@ +$NetBSD: patch-aj,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/main.c.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/main.c +@@ -6,21 +6,27 @@ + // + // ^HISTORY: + // 05/03/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <new.h> +-#include <iostream.h> +-#include <stdlib.h> ++#include <cstdlib> ++#include <iostream> ++#include <new> + + #include "cmdparse.h" + ++using namespace std; ++using namespace cmdline; ++ + // + // cmdparse_new_handler -- allocation error handler for cmdparse(1). + // +-void cmdparse_new_handler(void) ++void cmdparse_new_handler() + { + cerr << "cmdparse: free-store allocation error." << endl ; +- ::exit(127); ++ exit(127); + } + + int diff --git a/devel/cmdline/patches/patch-ak b/devel/cmdline/patches/patch-ak new file mode 100644 index 00000000000..afd33e38cc0 --- /dev/null +++ b/devel/cmdline/patches/patch-ak @@ -0,0 +1,102 @@ +$NetBSD: patch-ak,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/quoted.c.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/quoted.c +@@ -6,18 +6,23 @@ + // + // ^HISTORY: + // 05/01/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <iostream> + + #include "quoted.h" + ++using namespace std; ++ + //--------------------------------------------------------------- Constructors + +-QuotedString::QuotedString(unsigned max_size) ++QuotedString::QuotedString(unsigned int max_size) + : size(max_size) + { + buffer = new char[size] ; +@@ -26,28 +31,28 @@ + + QuotedString::QuotedString(const char * str) + { +- size = ::strlen(str + 1); ++ size = strlen(str + 1); + buffer = new char[size]; +- if (buffer) ::strcpy(buffer, str); ++ if (buffer) strcpy(buffer, str); + } + +-QuotedString::QuotedString(const char * str, unsigned max_size) ++QuotedString::QuotedString(const char * str, unsigned int max_size) + : size(max_size) + { + buffer = new char[size]; +- if (buffer) ::strcpy(buffer, str); ++ if (buffer) strcpy(buffer, str); + } + + QuotedString::QuotedString(const QuotedString & qstr) + : size(qstr.size) + { + buffer = new char[size]; +- if (buffer) ::strcpy(buffer, qstr.buffer); ++ if (buffer) strcpy(buffer, qstr.buffer); + } + + //--------------------------------------------------------------- Destructor + +-QuotedString::~QuotedString(void) ++QuotedString::~QuotedString() + { + delete [] buffer ; + } +@@ -60,7 +65,7 @@ + delete [] buffer ; + size = qstr.size; + buffer = new char[size]; +- if (buffer) ::strcpy(buffer, qstr.buffer); ++ if (buffer) strcpy(buffer, qstr.buffer); + return *this ; + } + +@@ -68,9 +73,9 @@ + QuotedString::operator=(const char * str) + { + delete [] buffer ; +- size = ::strlen(str) + 1; ++ size = strlen(str) + 1; + buffer = new char[size]; +- if (buffer) ::strcpy(buffer, str); ++ if (buffer) strcpy(buffer, str); + return *this ; + } + +@@ -108,9 +113,9 @@ + + + // Now fetch into "dest" until we see the ending quote. +- char * dest = qstr.buffer; +- unsigned end_quote = 0; +- unsigned len = 0; ++ char * dest = qstr.buffer; ++ unsigned int end_quote = 0; ++ unsigned int len = 0; + int c; + while (! end_quote) { + int escape = 0; diff --git a/devel/cmdline/patches/patch-al b/devel/cmdline/patches/patch-al new file mode 100644 index 00000000000..231a1409dd3 --- /dev/null +++ b/devel/cmdline/patches/patch-al @@ -0,0 +1,62 @@ +$NetBSD: patch-al,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/quoted.h.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/quoted.h +@@ -12,24 +12,28 @@ + // + // ^HISTORY: + // 05/01/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _quoted_h + #define _quoted_h + +-class istream ; ++#include <iosfwd> ++ + class QuotedString { + public: + // constructors and destructors +- QuotedString(unsigned max_size); ++ QuotedString(unsigned int max_size); + + QuotedString(const char * str); + +- QuotedString(const char * str, unsigned max_size); ++ QuotedString(const char * str, unsigned int max_size); + + QuotedString(const QuotedString & qstr); + +- virtual ~QuotedString(void); ++ virtual ~QuotedString(); + + // assignment + QuotedString & +@@ -39,19 +43,19 @@ + operator=(const char * str); + + // convert to a string +- operator char*(void) { return buffer; } ++ operator char*() { return buffer; } + + // operator >> reads a quoted string from input. + // If no beginning or ending quote is seen, than + // a message is printed on cerr and the failbit + // of the input stream is set. + // +- friend istream & +- operator>>(istream & is, QuotedString & qstr); ++ friend std::istream & ++ operator>>(std::istream & is, QuotedString & qstr); + + private: +- unsigned size; +- char * buffer; ++ unsigned int size; ++ char * buffer; + } ; + + #endif /* _quoted_h */ diff --git a/devel/cmdline/patches/patch-am b/devel/cmdline/patches/patch-am new file mode 100644 index 00000000000..3c012ea92ea --- /dev/null +++ b/devel/cmdline/patches/patch-am @@ -0,0 +1,99 @@ +$NetBSD: patch-am,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/shell_arg.c.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/shell_arg.c +@@ -7,15 +7,21 @@ + // + // ^HISTORY: + // 04/22/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <iostream> + + #include "shell_arg.h" + ++using namespace cmdline; ++using namespace std; ++ + //----------------------------------------------------------------- initialize + + void +@@ -30,12 +36,12 @@ + + //---------------------------------------------------------------- constructors + +-ShellCmdArg::ShellCmdArg(char * variable_name, +- char optchar, +- char * keyword, +- char * value, +- char * description, +- unsigned syntax_flags) ++ShellCmdArg::ShellCmdArg(char * variable_name, ++ char optchar, ++ char * keyword, ++ char * value, ++ char * description, ++ unsigned int syntax_flags) + : CmdArg(optchar, keyword, value, description, syntax_flags), + sca_name(variable_name), sca_keyword(keyword), + sca_value(value), sca_description(description) +@@ -43,11 +49,11 @@ + initialize(variable_name); + } + +-ShellCmdArg::ShellCmdArg(char * variable_name, +- char optchar, +- char * keyword, +- char * description, +- unsigned syntax_flags) ++ShellCmdArg::ShellCmdArg(char * variable_name, ++ char optchar, ++ char * keyword, ++ char * description, ++ unsigned int syntax_flags) + : CmdArg(optchar, keyword, description, syntax_flags), + sca_name(variable_name), sca_keyword(keyword), + sca_value(NULL), sca_description(description) +@@ -55,10 +61,10 @@ + initialize(variable_name); + } + +-ShellCmdArg::ShellCmdArg(char * variable_name, +- char * value, +- char * description, +- unsigned syntax_flags) ++ShellCmdArg::ShellCmdArg(char * variable_name, ++ char * value, ++ char * description, ++ unsigned int syntax_flags) + : CmdArg(value, description, syntax_flags), + sca_name(variable_name), sca_keyword(NULL), + sca_value(value), sca_description(description) +@@ -68,7 +74,7 @@ + + //------------------------------------------------------------------ destructor + +-ShellCmdArg::~ShellCmdArg(void) ++ShellCmdArg::~ShellCmdArg() + { + if (is_array()) { + delete shell_array ; +@@ -84,7 +90,7 @@ + //-------------------------------------------------------------------- is_array + + int +-ShellCmdArg::is_array(void) const ++ShellCmdArg::is_array() const + { + return (syntax() & CmdArg::isLIST) ; + } diff --git a/devel/cmdline/patches/patch-an b/devel/cmdline/patches/patch-an new file mode 100644 index 00000000000..bdb187efb50 --- /dev/null +++ b/devel/cmdline/patches/patch-an @@ -0,0 +1,77 @@ +$NetBSD: patch-an,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/shell_arg.h.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/shell_arg.h +@@ -8,6 +8,10 @@ + // + // ^HISTORY: + // 04/22/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Refer to namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _shell_arg_h +@@ -29,43 +33,43 @@ + // already exited!). + // + +-class ShellCmdArg : public CmdArg { ++class ShellCmdArg : public cmdline::CmdArg { + public: + ShellCmdArg(char * variable_name, + char optchar, + char * keyword, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ); ++ unsigned int syntax_flags =cmdline::CmdArg::isOPTVALREQ); + + ShellCmdArg(char * variable_name, + char optchar, + char * keyword, + char * description, +- unsigned syntax_flags =CmdArg::isOPT); ++ unsigned int syntax_flags =cmdline::CmdArg::isOPT); + + ShellCmdArg(char * variable_name, + char * value, + char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ); ++ unsigned int syntax_flags =cmdline::CmdArg::isPOSVALREQ); + +- virtual ~ShellCmdArg(void); ++ virtual ~ShellCmdArg(); + + // Return the name of this variable/array + const char * +- name(void) const { return sca_name; } ++ name() const { return sca_name; } + + // Are we an array or a variable? + int +- is_array(void) const; ++ is_array() const; + + // Return the variable portion + ShellVariable & +- variable(void) { return *shell_variable; } ++ variable() { return *shell_variable; } + + // Return the array portion + ShellArray & +- array(void) { return *shell_array; } ++ array() { return *shell_array; } + + // If we are a variable then the "set" member function sets the + // value of the variable, otherwise it appends to the list of +@@ -75,7 +79,7 @@ + set(const char * value); + + virtual int +- operator()(const char * & arg, CmdLine & cmd) = 0; ++ operator()(const char * & arg, cmdline::CmdLine & cmd) = 0; + + private: + ShellCmdArg(const ShellCmdArg & cp); diff --git a/devel/cmdline/patches/patch-ao b/devel/cmdline/patches/patch-ao new file mode 100644 index 00000000000..c0bfa487f45 --- /dev/null +++ b/devel/cmdline/patches/patch-ao @@ -0,0 +1,274 @@ +$NetBSD: patch-ao,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/shells.c.orig Thu Jan 2 13:33:30 1997 ++++ src/cmd/shells.c +@@ -7,18 +7,24 @@ + // + // ^HISTORY: + // 04/19/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <iostream> + + #include <fifolist.h> + + #include "shells.h" + #include "argtypes.h" + ++using namespace cmdline; ++using namespace std; ++ + //--------------------------------------------------------------- ShellVariable + + ShellVariable::ShellVariable(const char * name) +@@ -26,7 +32,7 @@ + { + } + +-ShellVariable::~ShellVariable(void) ++ShellVariable::~ShellVariable() + { + } + +@@ -38,10 +44,10 @@ + CharPtrList list; + CharPtrListArray array; + +- ShellArrayValues(void); ++ ShellArrayValues(); + } ; + +-ShellArrayValues::ShellArrayValues(void) ++ShellArrayValues::ShellArrayValues() + : array(list) + { + list.self_cleaning(1); +@@ -54,7 +60,7 @@ + { + } + +-ShellArray::~ShellArray(void) ++ShellArray::~ShellArray() + { + delete array_value ; + } +@@ -72,21 +78,21 @@ + } + } + +-unsigned +-ShellArray::count(void) const ++unsigned int ++ShellArray::count() const + { + return ((array_value) ? array_value->list.count() : 0); + } + + const char * +-ShellArray::operator[](unsigned index) const ++ShellArray::operator[](unsigned int index) const + { + return ((array_value) ? array_value->array[index] : NULL); + } + + //----------------------------------------------------------- AbstractUnixShell + +-AbstractUnixShell::~AbstractUnixShell(void) ++AbstractUnixShell::~AbstractUnixShell() + { + } + +@@ -122,13 +128,13 @@ + } + } + +-UnixShell::~UnixShell(void) ++UnixShell::~UnixShell() + { + delete shell; + } + + const char * +-UnixShell::name(void) const ++UnixShell::name() const + { + return ((shell) ? shell->name() : NULL); + } +@@ -171,16 +177,16 @@ + + const char * BourneShell::NAME = "sh" ; + +-BourneShell::BourneShell(void) ++BourneShell::BourneShell() + { + } + +-BourneShell::~BourneShell(void) ++BourneShell::~BourneShell() + { + } + + const char * +-BourneShell::name(void) const ++BourneShell::name() const + { + return BourneShell::NAME ; + } +@@ -275,16 +281,16 @@ + + const char * KornShell::NAME = "ksh" ; + +-KornShell::KornShell(void) ++KornShell::KornShell() + { + } + +-KornShell::~KornShell(void) ++KornShell::~KornShell() + { + } + + const char * +-KornShell::name(void) const ++KornShell::name() const + { + return KornShell::NAME ; + } +@@ -323,16 +329,16 @@ + + const char * BourneAgainShell::NAME = "bash" ; + +-BourneAgainShell::BourneAgainShell(void) ++BourneAgainShell::BourneAgainShell() + { + } + +-BourneAgainShell::~BourneAgainShell(void) ++BourneAgainShell::~BourneAgainShell() + { + } + + const char * +-BourneAgainShell::name(void) const ++BourneAgainShell::name() const + { + return BourneAgainShell::NAME ; + } +@@ -353,16 +359,16 @@ + + const char * CShell::NAME = "csh" ; + +-CShell::CShell(void) ++CShell::CShell() + { + } + +-CShell::~CShell(void) ++CShell::~CShell() + { + } + + const char * +-CShell::name(void) const ++CShell::name() const + { + return CShell::NAME ; + } +@@ -433,16 +439,16 @@ + + const char * ZShell::NAME = "zsh" ; + +-ZShell::ZShell(void) ++ZShell::ZShell() + { + } + +-ZShell::~ZShell(void) ++ZShell::~ZShell() + { + } + + const char * +-ZShell::name(void) const ++ZShell::name() const + { + return ZShell::NAME ; + } +@@ -515,16 +521,16 @@ + + const char * Plan9Shell::NAME = "rc" ; + +-Plan9Shell::Plan9Shell(void) ++Plan9Shell::Plan9Shell() + { + } + +-Plan9Shell::~Plan9Shell(void) ++Plan9Shell::~Plan9Shell() + { + } + + const char * +-Plan9Shell::name(void) const ++Plan9Shell::name() const + { + return Plan9Shell::NAME ; + } +@@ -594,7 +600,7 @@ + + const char * PerlShell::NAME = "perl" ; + +-PerlShell::PerlShell(void) ++PerlShell::PerlShell() + { + static const char perl_true[] = "1" ; + static const char perl_false[] = "0" ; +@@ -604,12 +610,12 @@ + ShellCmdArgBool::False(perl_false); + } + +-PerlShell::~PerlShell(void) ++PerlShell::~PerlShell() + { + } + + const char * +-PerlShell::name(void) const ++PerlShell::name() const + { + return PerlShell::NAME ; + } +@@ -683,7 +689,7 @@ + + const char * TclShell::NAME = "tcl" ; + +-TclShell::TclShell(void) ++TclShell::TclShell() + { + static const char tcl_true[] = "1" ; + static const char tcl_false[] = "0" ; +@@ -693,12 +699,12 @@ + ShellCmdArgBool::False(tcl_false); + } + +-TclShell::~TclShell(void) ++TclShell::~TclShell() + { + } + + const char * +-TclShell::name(void) const ++TclShell::name() const + { + return TclShell::NAME ; + } diff --git a/devel/cmdline/patches/patch-ap b/devel/cmdline/patches/patch-ap new file mode 100644 index 00000000000..f65c51b253d --- /dev/null +++ b/devel/cmdline/patches/patch-ap @@ -0,0 +1,249 @@ +$NetBSD: patch-ap,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/shells.h.orig Thu Jan 2 13:33:30 1997 ++++ src/cmd/shells.h +@@ -16,6 +16,9 @@ + // + // ^HISTORY: + // 04/19/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _shells_h +@@ -28,11 +31,11 @@ + public: + ShellVariable(const char * name); + +- virtual ~ShellVariable(void); ++ virtual ~ShellVariable(); + + // Return the name of this variable + const char * +- name(void) const { return var_name ; } ++ name() const { return var_name ; } + + // Set the value of this variable + void +@@ -40,7 +43,7 @@ + + // Return the value of this variable + const char * +- value(void) const { return var_value; } ++ value() const { return var_value; } + + protected: + const char * var_name ; +@@ -55,19 +58,19 @@ + public: + ShellArray(const char * name); + +- virtual ~ShellArray(void); ++ virtual ~ShellArray(); + + // Return the name of this array + const char * +- name(void) const { return array_name; } ++ name() const { return array_name; } + + // Append to the list of values in this array + void + append(const char * value); + + // Return the number of items in this array. +- unsigned +- count(void) const; ++ unsigned int ++ count() const; + + // Return the desired element of an array + // +@@ -76,7 +79,7 @@ + // NULL-ptr dereferencing error! + // + const char * +- operator[](unsigned index) const; ++ operator[](unsigned int index) const; + + protected: + const char * array_name ; +@@ -91,11 +94,11 @@ + class AbstractUnixShell { + public: + virtual +- ~AbstractUnixShell(void); ++ ~AbstractUnixShell(); + + // Return the name of this shell + virtual const char * +- name(void) const = 0; ++ name() const = 0; + + // Does "name" correspond to the positional-parameters for this shell? + virtual int +@@ -128,7 +131,7 @@ + set(const ShellArray & array, int variant) const = 0; + + protected: +- AbstractUnixShell(void) {}; ++ AbstractUnixShell() {}; + + } ; + +@@ -145,15 +148,15 @@ + UnixShell(const char * shell_name); + + virtual +- ~UnixShell(void); ++ ~UnixShell(); + + // See if this shell is valid + int +- is_valid(void) const { return (valid) ? 1 : 0; } ++ is_valid() const { return (valid) ? 1 : 0; } + + // Return the name of this shell + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -168,7 +171,7 @@ + set(const ShellArray & array, int variant) const; + + private: +- unsigned valid : 1 ; ++ unsigned int valid : 1 ; + AbstractUnixShell * shell; + + } ; +@@ -197,12 +200,12 @@ + // + class BourneShell : public AbstractUnixShell { + public: +- BourneShell(void); ++ BourneShell(); + +- virtual ~BourneShell(void); ++ virtual ~BourneShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -244,12 +247,12 @@ + // + class KornShell : public BourneShell { + public: +- KornShell(void); ++ KornShell(); + +- virtual ~KornShell(void); ++ virtual ~KornShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -276,12 +279,12 @@ + // + class BourneAgainShell : public BourneShell { + public: +- BourneAgainShell(void); ++ BourneAgainShell(); + +- virtual ~BourneAgainShell(void); ++ virtual ~BourneAgainShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + set(const ShellVariable & variable) const; +@@ -309,12 +312,12 @@ + // + class CShell : public AbstractUnixShell { + public: +- CShell(void); ++ CShell(); + +- virtual ~CShell(void); ++ virtual ~CShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -355,12 +358,12 @@ + // + class ZShell : public AbstractUnixShell { + public: +- ZShell(void); ++ ZShell(); + +- virtual ~ZShell(void); ++ virtual ~ZShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -397,12 +400,12 @@ + // + class Plan9Shell : public AbstractUnixShell { + public: +- Plan9Shell(void); ++ Plan9Shell(); + +- virtual ~Plan9Shell(void); ++ virtual ~Plan9Shell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -438,12 +441,12 @@ + // + class PerlShell : public AbstractUnixShell { + public: +- PerlShell(void); ++ PerlShell(); + +- virtual ~PerlShell(void); ++ virtual ~PerlShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; +@@ -479,12 +482,12 @@ + // + class TclShell : public AbstractUnixShell { + public: +- TclShell(void); ++ TclShell(); + +- virtual ~TclShell(void); ++ virtual ~TclShell(); + + virtual const char * +- name(void) const; ++ name() const; + + virtual void + unset_args(const char * name) const; diff --git a/devel/cmdline/patches/patch-aq b/devel/cmdline/patches/patch-aq new file mode 100644 index 00000000000..c402a3b12b4 --- /dev/null +++ b/devel/cmdline/patches/patch-aq @@ -0,0 +1,42 @@ +$NetBSD: patch-aq,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/syntax.c.orig Thu Jan 2 13:33:29 1997 ++++ src/cmd/syntax.c +@@ -7,18 +7,24 @@ + // + // ^HISTORY: + // 03/25/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <iostream> + + #include <cmdline.h> + + #include "syntax.h" + #include "quoted.h" + ++using namespace cmdline; ++using namespace std; ++ + //------------------------------------------------------------------ copy_token + + //------------------- +@@ -53,7 +59,7 @@ + copy_token(const char * & dest, const SyntaxFSM::token_t & src) + { + char * tok = new char[src.len + 1] ; +- ::strncpy(tok, src.start, src.len); ++ strncpy(tok, src.start, src.len); + tok[src.len] = '\0'; + dest = tok; + } diff --git a/devel/cmdline/patches/patch-ar b/devel/cmdline/patches/patch-ar new file mode 100644 index 00000000000..b4592d1b2ad --- /dev/null +++ b/devel/cmdline/patches/patch-ar @@ -0,0 +1,59 @@ +$NetBSD: patch-ar,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/cmd/syntax.h.orig Thu Jan 2 13:33:31 1997 ++++ src/cmd/syntax.h +@@ -8,42 +8,46 @@ + // + // ^HISTORY: + // 04/29/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + #ifndef _syntax_h + #define _syntax_h + ++#include <iosfwd> ++ + #include "fsm.h" + +-class istream; + class ArgSyntax { + public: +- ArgSyntax(void) ++ ArgSyntax() + : arg_syntax(0), arg_char(0), arg_keyword(0), arg_value(0) + {} + + // Return the syntax flags +- unsigned +- syntax(void) const { return arg_syntax; } ++ unsigned int ++ syntax() const { return arg_syntax; } + + // Return the option character + char +- optchar(void) const { return arg_char; } ++ optchar() const { return arg_char; } + + // Return the keyword name + const char * +- keyword(void) const { return arg_keyword; } ++ keyword() const { return arg_keyword; } + + // Return the value name + const char * +- value(void) const { return arg_value; } ++ value() const { return arg_value; } + + // Extract the syntax (compile it) from an input stream + friend istream & + operator>>(istream & is, ArgSyntax & arg); + + private: +- unsigned arg_syntax ; ++ unsigned int arg_syntax ; + char arg_char; + const char * arg_keyword; + const char * arg_value; diff --git a/devel/cmdline/patches/patch-as b/devel/cmdline/patches/patch-as new file mode 100644 index 00000000000..33120adf8b9 --- /dev/null +++ b/devel/cmdline/patches/patch-as @@ -0,0 +1,35 @@ +$NetBSD: patch-as,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/Makefile.orig Thu Jan 2 13:33:31 1997 ++++ src/lib/Makefile +@@ -70,20 +70,25 @@ + test: cmdtest$(EXECEXT) + + cmdtest$(EXECEXT): cmdtest$(OBJEXT) $(OBJS) +- $(CC) $(EXE) $@ cmdtest$(OBJEXT) $(LIBRARY) ++ $(CC) $(EXE) $@ cmdtest$(OBJEXT) $(LIBRARY) $(USRLIBS) + +-$(LIBRARY): $(OBJS) ++lib$(LIBNAME).a: $(OBJS) + $(AR) $@ $(OBJS) + $(RANLIB) $@ + ++lib$(LIBNAME).la: $(OBJS) ++ $(LIBTOOL) g++ -o lib$(LIBNAME).la $(OBJS:.o=.lo) \ ++ -rpath $(PREFIX)/lib -version-info 0:0 ++ + ### + # maintenance dependencies + ### + install: $(LIBRARY) $(LIBDIR) $(INCDIR) cmdline.h cmdargs.h + -$(RM) $(LIBDIR)$(LIBRARY) $(INCDIR)cmdline.h $(INCDIR)cmdargs.h +- $(CP) $(LIBRARY) $(LIBDIR)$(LIBRARY) +- $(CP) cmdline.h $(INCDIR)cmdline.h +- $(CP) cmdargs.h $(INCDIR)cmdargs.h ++ $(LIBTOOL) $(BSD_INSTALL_DATA) $(LIBRARY) $(LIBDIR)$(LIBRARY) ++ $(BSD_INSTALL_DATA) cmdline.h $(INCDIR)cmdline.h ++ $(BSD_INSTALL_DATA) cmdargs.h $(INCDIR)cmdargs.h ++ $(BSD_INSTALL_DATA) fifolist.h $(INCDIR)fifolist.h + + clean: + -$(RM) *$(OBJEXT) core .exrc *~ \#*\# diff --git a/devel/cmdline/patches/patch-at b/devel/cmdline/patches/patch-at new file mode 100644 index 00000000000..7d307bdb7b2 --- /dev/null +++ b/devel/cmdline/patches/patch-at @@ -0,0 +1,131 @@ +$NetBSD: patch-at,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/argiter.c.orig Thu Jan 2 13:33:31 1997 ++++ src/lib/argiter.c +@@ -7,32 +7,38 @@ + // + // ^HISTORY: + // 04/03/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cstring> ++#include <cctype> ++#include <iostream> + + #include "cmdline.h" + ++namespace cmdline { ++ + //-------------------------------------------------------- class CmdLineArgIter + +-CmdLineArgIter::CmdLineArgIter(void) {} ++CmdLineArgIter::CmdLineArgIter() {} + +-CmdLineArgIter::~CmdLineArgIter(void) {} ++CmdLineArgIter::~CmdLineArgIter() {} + + //----------------------------------------------------------- class CmdArgvIter + +-CmdArgvIter::~CmdArgvIter(void) {} ++CmdArgvIter::~CmdArgvIter() {} + + const char * +-CmdArgvIter::operator()(void) { ++CmdArgvIter::operator()() { + return ((index != count) && (array[index])) ? array[index++] : 0 ; + } + + int +-CmdArgvIter::is_temporary(void) const { return 0; } ++CmdArgvIter::is_temporary() const { return 0; } + + //--------------------------------------------------------- class CmdStrTokIter + +@@ -46,7 +52,7 @@ + } + + // Destructor +-CmdStrTokIter::~CmdStrTokIter(void) ++CmdStrTokIter::~CmdStrTokIter() + { + delete tokstr; + } +@@ -62,24 +68,24 @@ + tokstr = NULL; + token = NULL; + if (tokens) { +- // Make a copy of the token-string (because ::strtok() modifies it) ++ // Make a copy of the token-string (because std::strtok() modifies it) + // and get the first token from the string + // +- tokstr = new char[::strlen(tokens) + 1] ; +- (void) ::strcpy(tokstr, tokens); +- token = ::strtok(tokstr, seps); ++ tokstr = new char[std::strlen(tokens) + 1] ; ++ std::strcpy(tokstr, tokens); ++ token = std::strtok(tokstr, seps); + } + } + + // Iterator function -- operator() +- // Just use ::strtok to get the next token from the string ++ // Just use std::strtok to get the next token from the string + // + const char * +-CmdStrTokIter::operator()(void) ++CmdStrTokIter::operator()() + { + if (seps == NULL) seps = WHITESPACE ; + const char * result = token; +- if (token) token = ::strtok(NULL, seps); ++ if (token) token = std::strtok(NULL, seps); + return result; + } + +@@ -87,7 +93,7 @@ + // always points to temporary space. + // + int +-CmdStrTokIter::is_temporary(void) const ++CmdStrTokIter::is_temporary() const + { + return 1; + } +@@ -102,7 +108,7 @@ + } + + // Destructor +-CmdIstreamIter::~CmdIstreamIter(void) ++CmdIstreamIter::~CmdIstreamIter() + { + delete tok_iter; + } +@@ -122,7 +128,7 @@ + // consider the line to be a comment and we ignore it. + // + const char * +-CmdIstreamIter::operator()(void) ++CmdIstreamIter::operator()() + { + const char * result = NULL; + if (tok_iter) result = tok_iter->operator()(); +@@ -151,7 +157,9 @@ + // the tokens we return are always in temporary storage + // + int +-CmdIstreamIter::is_temporary(void) const ++CmdIstreamIter::is_temporary() const + { + return 1; + } ++ ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-au b/devel/cmdline/patches/patch-au new file mode 100644 index 00000000000..e22ec621a84 --- /dev/null +++ b/devel/cmdline/patches/patch-au @@ -0,0 +1,30 @@ +$NetBSD: patch-au,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/arglist.h.orig Thu Jan 2 13:33:32 1997 ++++ src/lib/arglist.h +@@ -10,6 +10,9 @@ + // + // ^HISTORY: + // 03/21/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline + //-^^--------------------------------------------------------------------- + + #ifndef _arglist_h +@@ -17,11 +20,15 @@ + + #include "fifolist.h" + ++namespace cmdline { ++ + class CmdArg; + + DECLARE_FIFO_LIST(CmdArgList, CmdArg); + + DECLARE_FIFO_LIST(CmdArgListList, CmdArgList); ++ ++} // namespace cmdline + + #endif /* _arglist_h */ + diff --git a/devel/cmdline/patches/patch-av b/devel/cmdline/patches/patch-av new file mode 100644 index 00000000000..fcc61f2e53b --- /dev/null +++ b/devel/cmdline/patches/patch-av @@ -0,0 +1,161 @@ +$NetBSD: patch-av,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdarg.c.orig Thu Jan 2 13:33:32 1997 ++++ src/lib/cmdarg.c +@@ -10,18 +10,26 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added arg_sequence field to CmdArg ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cstring> ++#include <cctype> ++#include <iostream> + + #include "cmdline.h" + ++namespace cmdline { ++ ++using std::cerr; ++ + //---------------------------------------------------------------------- CmdArg + +-int CmdArg::is_dummy(void) { return 0; } ++int CmdArg::is_dummy() { return 0; } + + // Copy-Constructor + CmdArg::CmdArg(const CmdArg & cp) +@@ -35,8 +43,8 @@ + arg_description(cp.arg_description) + { + if (alloc_value_name) { +- char * val_name = new char[::strlen(cp.arg_value_name) + 1] ; +- ::strcpy((char *)val_name, cp.arg_value_name); ++ char * val_name = new char[std::strlen(cp.arg_value_name) + 1] ; ++ std::strcpy((char *)val_name, cp.arg_value_name); + arg_value_name = val_name; + } + } +@@ -47,7 +55,7 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags) ++ unsigned int syntax_flags) + : alloc_value_name(0), + arg_flags(0), + arg_syntax(syntax_flags), +@@ -66,7 +74,7 @@ + CmdArg::CmdArg(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags) ++ unsigned int syntax_flags) + : alloc_value_name(0), + arg_flags(0), + arg_syntax(syntax_flags), +@@ -83,7 +91,7 @@ + + CmdArg::CmdArg(const char * value, + const char * description, +- unsigned syntax_flags) ++ unsigned int syntax_flags) + : alloc_value_name(0), + arg_flags(0), + arg_syntax(syntax_flags), +@@ -100,7 +108,7 @@ + + + // Destructor +-CmdArg::~CmdArg(void) ++CmdArg::~CmdArg() + { + if (alloc_value_name) delete [] (char *)arg_value_name; + } +@@ -110,7 +118,7 @@ + // ^FUNCTION: adjust_syntax - adjust command argument syntax + // + // ^SYNOPSIS: +-// CmdArg::adjust_syntax(void) ++// CmdArg::adjust_syntax() + // + // ^PARAMETERS: + // None. +@@ -134,7 +142,7 @@ + // Follow along in the code ... + //-^^---------------- + void +-CmdArg::adjust_syntax(void) ++CmdArg::adjust_syntax() + { + static const char default_value_name[] = "value" ; + +@@ -207,7 +215,7 @@ + // ^FUNCTION: parse_description - parse the argument description string + // + // ^SYNOPSIS: +-// CmdLine::parse_description(void) ++// CmdLine::parse_description() + // + // ^PARAMETERS: + // None. +@@ -233,7 +241,7 @@ + enum { c_HIDDEN = ';', c_OPEN = '[', c_CLOSE = ']', c_LIST = '.' } ; + + void +-CmdArg::parse_description(void) ++CmdArg::parse_description() + { + if (arg_description == NULL) return; + while (isspace(*arg_description)) ++arg_description; +@@ -249,7 +257,7 @@ + // ^FUNCTION: parse_value - parse the argument value name + // + // ^SYNOPSIS: +-// CmdLine::parse_value(void) ++// CmdLine::parse_value() + // + // ^PARAMETERS: + // None. +@@ -274,7 +282,7 @@ + // Its kind of hairy so follow along. + //-^^---------------- + void +-CmdArg::parse_value(void) ++CmdArg::parse_value() + { + const char * save_value = arg_value_name; + int brace = 0; +@@ -306,7 +314,7 @@ + alloc_value_name = 1; + int len = (int) (ptr - arg_value_name); + char * copied_value = new char[len + 1]; +- (void) ::strncpy(copied_value, arg_value_name, len); ++ std::strncpy(copied_value, arg_value_name, len); + copied_value[len] = '\0'; + arg_value_name = copied_value; + +@@ -338,7 +346,7 @@ + } + + // Not done - we had better see a "..." +- if (::strncmp(ptr, "...", 3) != 0) { ++ if (std::strncmp(ptr, "...", 3) != 0) { + cerr << "Error: unexpected token \"" << ptr << "\"." << endl ; + ++errors; + } else { +@@ -365,3 +373,5 @@ + << "\t(error occurred in CmdArg constructor)" << endl ; + } + } ++ ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-aw b/devel/cmdline/patches/patch-aw new file mode 100644 index 00000000000..9cfe563b6ff --- /dev/null +++ b/devel/cmdline/patches/patch-aw @@ -0,0 +1,399 @@ +$NetBSD: patch-aw,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdargs.c.orig Thu Jan 2 13:33:32 1997 ++++ src/lib/cmdargs.c +@@ -10,17 +10,26 @@ + // + // 03/03/93 Brad Appleton <bradapp@enteract.com> + // - Added exit_handler() and quit() member-functions to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cstring> ++#include <cctype> ++#include <iostream> + + #include "cmdargs.h" + #include "exits.h" + #include "fifolist.h" + ++namespace cmdline { ++ ++using std::cout; ++using std::ostream; ++ + // return values for operator() + enum { SUCCESS = 0, FAILURE = -1 } ; + +@@ -47,7 +56,7 @@ + // -- The internal value (of some appropriate type) that is "managed" + // by this command argument. + // +-// unsigned default_value; ++// unsigned int default_value; + // -- What to assign to "value" if "arg" is NOT a value for this command + // argument. + // +@@ -89,10 +98,10 @@ + + //-------------------------------------------------------------- Dummy Argument + +-CmdArgDummy::~CmdArgDummy(void) {} ++CmdArgDummy::~CmdArgDummy() {} + + int +-CmdArgDummy::is_dummy(void) { return 1; } ++CmdArgDummy::is_dummy() { return 1; } + + // For a CmdArgDummy - operator() is a No-OP and should NEVER + // be called. +@@ -114,7 +123,7 @@ + if (os_ptr == NULL) os_ptr = &cout; + } + +-CmdArgUsage::~CmdArgUsage(void) {} ++CmdArgUsage::~CmdArgUsage() {} + + void + CmdArgUsage::ostream_ptr(ostream * osp) +@@ -134,7 +143,7 @@ + + //----------------------------------------------------------- Integer Arguments + +-CmdArgIntCompiler::~CmdArgIntCompiler(void) {} ++CmdArgIntCompiler::~CmdArgIntCompiler() {} + + // Compile a string into an integer value. + int +@@ -153,7 +162,7 @@ + } + + // compile the string into an integer +- result = ::strtol(arg, (char **) &ptr, 0); // watch out for -c0xa vs -axc0! ++ result = std::strtol(arg, (char **) &ptr, 0); // watch out for -c0xa vs -axc0! + if (ptr == arg) { + // do we have a valid integer? + if (! (cmd.flags() & CmdLine::QUIET)) { +@@ -168,7 +177,7 @@ + } + + +-CmdArgInt::~CmdArgInt(void) {} ++CmdArgInt::~CmdArgInt() {} + + int + CmdArgInt::operator()(const char * & arg, CmdLine & cmd) +@@ -185,7 +194,7 @@ + + //---------------------------------------------------- Floating-point Arguments + +-CmdArgFloatCompiler::~CmdArgFloatCompiler(void) {} ++CmdArgFloatCompiler::~CmdArgFloatCompiler() {} + + // Compile a string into a floating-point value. + int +@@ -203,7 +212,7 @@ + return FAILURE ; + } + +- result = ::strtod(arg, (char **) &ptr); // compile the string into a float ++ result = std::strtod(arg, (char **) &ptr); // compile the string into a float + if (ptr == arg) { + // do we have a valid float? + if (! (cmd.flags() & CmdLine::QUIET)) { +@@ -219,7 +228,7 @@ + } + + +-CmdArgFloat::~CmdArgFloat(void) {} ++CmdArgFloat::~CmdArgFloat() {} + + int + CmdArgFloat::operator()(const char * & arg, CmdLine & cmd) +@@ -236,7 +245,7 @@ + + //--------------------------------------------------------- Character Argumrnts + +-CmdArgCharCompiler::~CmdArgCharCompiler(void) {} ++CmdArgCharCompiler::~CmdArgCharCompiler() {} + + int + CmdArgCharCompiler::compile(const char * & arg, CmdLine & cmd, char & value) +@@ -268,7 +277,7 @@ + } + + +-CmdArgChar::~CmdArgChar(void) {} ++CmdArgChar::~CmdArgChar() {} + + int + CmdArgChar::operator()(const char * & arg, CmdLine & cmd) +@@ -287,7 +296,7 @@ + typedef CmdArgStrCompiler::casc_string CmdArgString ; + + #ifndef __GNUG__ +-CmdArgString::~casc_string(void) ++CmdArgString::~casc_string() + { + if (is_alloc) delete [] (char *)str; + } +@@ -295,20 +304,20 @@ + + // Copy a string (allocating storage if necessary) + void +-CmdArgString::copy(unsigned is_temporary, const char * s) ++CmdArgString::copy(unsigned int is_temporary, const char * s) + { + if (is_alloc) delete [] (char *)str; + is_alloc = (is_temporary) ? 1 : 0; + str = s; + if (is_alloc && s) { +- char * new_s = new char[::strlen(s) + 1] ; +- (void) ::strcpy(new_s, s); ++ char * new_s = new char[std::strlen(s) + 1] ; ++ std::strcpy(new_s, s); + str = new_s; + } + } + + +-CmdArgStrCompiler::~CmdArgStrCompiler(void) {} ++CmdArgStrCompiler::~CmdArgStrCompiler() {} + + int + CmdArgStrCompiler::compile(const char * & arg, +@@ -326,7 +335,7 @@ + } + + +-CmdArgStr::~CmdArgStr(void) {} ++CmdArgStr::~CmdArgStr() {} + + int + CmdArgStr::operator()(const char * & arg, CmdLine & cmd) +@@ -356,11 +365,11 @@ + IntList list; + IntListArray array; + +- CmdArgIntListPrivate(void); ++ CmdArgIntListPrivate(); + } ; + + +-CmdArgIntListPrivate::CmdArgIntListPrivate(void) ++CmdArgIntListPrivate::CmdArgIntListPrivate() + : array(list) + { + list.self_cleaning(1); +@@ -382,19 +391,19 @@ + return rc; + } + +-unsigned +-CmdArgIntList::count(void) const ++unsigned int ++CmdArgIntList::count() const + { + return (val) ? val->list.count() : 0 ; + } + + int & +-CmdArgIntList::operator[](unsigned index) ++CmdArgIntList::operator[](unsigned int index) + { + return val->array[index]; + } + +-CmdArgIntList::~CmdArgIntList(void) {} ++CmdArgIntList::~CmdArgIntList() {} + + + //------------------- Float List ------------------- +@@ -406,10 +415,10 @@ + FloatList list; + FloatListArray array; + +- CmdArgFloatListPrivate(void); ++ CmdArgFloatListPrivate(); + } ; + +-CmdArgFloatListPrivate::CmdArgFloatListPrivate(void) ++CmdArgFloatListPrivate::CmdArgFloatListPrivate() + : array(list) + { + list.self_cleaning(1); +@@ -432,19 +441,19 @@ + return rc; + } + +-unsigned +-CmdArgFloatList::count(void) const ++unsigned int ++CmdArgFloatList::count() const + { + return (val) ? val->list.count() : 0 ; + } + + float & +-CmdArgFloatList::operator[](unsigned index) ++CmdArgFloatList::operator[](unsigned int index) + { + return val->array[index]; + } + +-CmdArgFloatList::~CmdArgFloatList(void) {} ++CmdArgFloatList::~CmdArgFloatList() {} + + //------------------- String List ------------------- + +@@ -454,10 +463,10 @@ + StringList list; + StringListArray array; + +- CmdArgStrListPrivate(void); ++ CmdArgStrListPrivate(); + } ; + +-CmdArgStrListPrivate::CmdArgStrListPrivate(void) ++CmdArgStrListPrivate::CmdArgStrListPrivate() + : array(list) + { + list.self_cleaning(1); +@@ -478,29 +487,29 @@ + return rc; + } + +-unsigned +-CmdArgStrList::count(void) const ++unsigned int ++CmdArgStrList::count() const + { + return (val) ? val->list.count() : 0 ; + } + + CmdArgString & +-CmdArgStrList::operator[](unsigned index) ++CmdArgStrList::operator[](unsigned int index) + { + return val->array[index]; + } + +-CmdArgStrList::~CmdArgStrList(void) {} ++CmdArgStrList::~CmdArgStrList() {} + + //----------------------------------------------------------- Boolean Arguments + +-CmdArgBoolCompiler::~CmdArgBoolCompiler(void) {} ++CmdArgBoolCompiler::~CmdArgBoolCompiler() {} + + int + CmdArgBoolCompiler::compile(const char * & arg, + CmdLine & cmd, +- unsigned & value, +- unsigned default_value) ++ unsigned int & value, ++ unsigned int default_value) + { + if (arg == NULL) { + // if no argument was given use the default +@@ -587,12 +596,12 @@ + + //------------------------------------------------------------------ CmdArgBool + +-CmdArgBool::~CmdArgBool(void) {} ++CmdArgBool::~CmdArgBool() {} + + int + CmdArgBool::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned value = val; ++ unsigned int value = val; + int rc = compile(arg, cmd, value, 1); + val = value; + return rc; +@@ -600,12 +609,12 @@ + + //----------------------------------------------------------------- CmdArgClear + +-CmdArgClear::~CmdArgClear(void) {} ++CmdArgClear::~CmdArgClear() {} + + int + CmdArgClear::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned value = val; ++ unsigned int value = val; + int rc = compile(arg, cmd, value, 0); + val = value; + return rc; +@@ -613,12 +622,12 @@ + + //---------------------------------------------------------------- CmdArgToggle + +-CmdArgToggle::~CmdArgToggle(void) {} ++CmdArgToggle::~CmdArgToggle() {} + + int + CmdArgToggle::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned value = val; ++ unsigned int value = val; + int rc = compile(arg, cmd, value, (! value)); + val = value; + return rc; +@@ -626,12 +635,12 @@ + + //--------------------------------------------------------------- CmdArgBoolRef + +-CmdArgBoolRef::~CmdArgBoolRef(void) {} ++CmdArgBoolRef::~CmdArgBoolRef() {} + + int + CmdArgBoolRef::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned val = ref; ++ unsigned int val = ref; + int rc = ref.compile(arg, cmd, val, 1); + ref = val; + return rc; +@@ -639,12 +648,12 @@ + + //-------------------------------------------------------------- CmdArgClearRef + +-CmdArgClearRef::~CmdArgClearRef(void) {} ++CmdArgClearRef::~CmdArgClearRef() {} + + int + CmdArgClearRef::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned val = ref; ++ unsigned int val = ref; + int rc = ref.compile(arg, cmd, val, 0); + ref = val; + return rc; +@@ -652,14 +661,15 @@ + + //------------------------------------------------------------- CmdArgToggleRef + +-CmdArgToggleRef::~CmdArgToggleRef(void) {} ++CmdArgToggleRef::~CmdArgToggleRef() {} + + int + CmdArgToggleRef::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned val = ref; ++ unsigned int val = ref; + int rc = ref.compile(arg, cmd, val, (! val)); + ref = val; + return rc; + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-ax b/devel/cmdline/patches/patch-ax new file mode 100644 index 00000000000..75c347ea2df --- /dev/null +++ b/devel/cmdline/patches/patch-ax @@ -0,0 +1,637 @@ +$NetBSD: patch-ax,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdargs.h.orig Thu Jan 2 13:33:33 1997 ++++ src/lib/cmdargs.h +@@ -50,13 +50,23 @@ + // + // ^HISTORY: + // 03/25/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Removed unnecessary NULL. + //-^^--------------------------------------------------------------------- + + #ifndef _usr_include_cmdargs_h + #define _usr_include_cmdargs_h + ++#include <iosfwd> + #include <cmdline.h> + ++namespace cmdline { ++ ++using std::ostream; ++ + //-------------------------------------------------------------- Dummy Argument + + // A Dummy argument is one that is used only for its appearance in +@@ -73,28 +83,28 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgDummy(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArg(optchar, keyword, description, syntax_flags) {} + + CmdArgDummy(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArg(value, description, syntax_flags) {} + + CmdArgDummy(const CmdArgDummy & cp) : CmdArg(cp) {} + + CmdArgDummy(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgDummy(void); ++ virtual ~CmdArgDummy(); + + virtual int +- is_dummy(void); // return non-zero ++ is_dummy(); // return non-zero + + virtual int + operator()(const char * & arg, CmdLine & cmd); // NO-OP +@@ -115,20 +125,20 @@ + CmdArgUsage(char optchar, + const char * keyword, + const char * description, +- ostream * osp =NULL); // cout is used if "osp" is NULL ++ ostream * osp =0); // cout is used if "osp" is NULL + + CmdArgUsage(const CmdArgUsage & cp) : CmdArg(cp) {} + + CmdArgUsage(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgUsage(void); ++ virtual ~CmdArgUsage(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); + + // get/set the ostream that usage is printed on + ostream * +- ostream_ptr(void) const { return os_ptr; } ++ ostream_ptr() const { return os_ptr; } + + void + ostream_ptr(ostream * osp); +@@ -150,19 +160,19 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgIntCompiler(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArg(value, description, syntax_flags) {} + + CmdArgIntCompiler(const CmdArgIntCompiler & cp) : CmdArg(cp) {} + + CmdArgIntCompiler(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgIntCompiler(void); ++ virtual ~CmdArgIntCompiler(); + + virtual int + operator()(const char * & arg, CmdLine & cmd) = 0; +@@ -178,7 +188,7 @@ + // a CmdArgInt as if it were an integer: + // + // operator=(int); +- // operator int(void); ++ // operator int(); + // operator<<(os, CmdArgInt); + // + // The integer value is initialized to zero by the constructor. +@@ -199,16 +209,16 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArgIntCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgInt(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArgIntCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgInt(void); ++ virtual ~CmdArgInt(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -223,7 +233,7 @@ + CmdArgInt & + operator=(int cp) { val = cp; return *this; } + +- operator int(void) const { return val; } ++ operator int() const { return val; } + + private: + int val; +@@ -246,19 +256,19 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgFloatCompiler(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArg(value, description, syntax_flags) {} + + CmdArgFloatCompiler(const CmdArgFloatCompiler & cp) : CmdArg(cp) {} + + CmdArgFloatCompiler(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgFloatCompiler(void); ++ virtual ~CmdArgFloatCompiler(); + + virtual int + operator()(const char * & arg, CmdLine & cmd) = 0; +@@ -274,7 +284,7 @@ + // a CmdArgFloat as if it were a float: + // + // operator=(float); +- // operator float(void); ++ // operator float(); + // operator<<(os, CmdArgFloat); + // + // The floating-point value is initialized to zero by the constructor. +@@ -296,16 +306,16 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArgFloatCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgFloat(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArgFloatCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgFloat(void); ++ virtual ~CmdArgFloat(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -322,7 +332,7 @@ + CmdArgFloat & + operator=(float cp) { val = cp; return *this; } + +- operator float(void) const { return val; } ++ operator float() const { return val; } + + private: + float val; +@@ -343,19 +353,19 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgCharCompiler(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArg(value, description, syntax_flags) {} + + CmdArgCharCompiler(const CmdArgCharCompiler & cp) : CmdArg(cp) {} + + CmdArgCharCompiler(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgCharCompiler(void); ++ virtual ~CmdArgCharCompiler(); + + virtual int + operator()(const char * & arg, CmdLine & cmd) = 0; +@@ -371,7 +381,7 @@ + // a CmdArgChar as if it were a character: + // + // operator=(char); +- // operator char(void); ++ // operator char(); + // operator<<(os, CmdArgChar); + // + // The character value is initialized to '\0' by the constructor. +@@ -393,16 +403,16 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArgCharCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgChar(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArgCharCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgChar(void); ++ virtual ~CmdArgChar(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -417,7 +427,7 @@ + CmdArgChar & + operator=(char cp) { val = cp; return *this; } + +- operator char(void) const { return val; } ++ operator char() const { return val; } + + private: + char val; +@@ -446,17 +456,17 @@ + // it and a "char *" (in most cases). + // + struct casc_string { +- unsigned is_alloc : 1 ; ++ unsigned int is_alloc : 1 ; + const char * str ; + +- casc_string(void) : is_alloc(0), str(0) {} ++ casc_string() : is_alloc(0), str(0) {} + + casc_string(const char * s) : is_alloc(0), str(s) {} + + void +- copy(unsigned is_temporary, const char * s); ++ copy(unsigned int is_temporary, const char * s); + +- casc_string(unsigned is_temporary, const char * s) ++ casc_string(unsigned int is_temporary, const char * s) + : is_alloc(0), str(0) { copy(is_temporary, s); } + + casc_string(const casc_string & cp) +@@ -469,9 +479,9 @@ + casc_string & + operator=(const char * cp) { copy(0, cp); return *this; } + +- operator const char*(void) const { return str; } ++ operator const char*() const { return str; } + +- virtual ~casc_string(void) ++ virtual ~casc_string() + #ifdef __GNUG__ + { if (is_alloc) delete [] (char *) str; } + #endif +@@ -482,19 +492,19 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgStrCompiler(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArg(value, description, syntax_flags) {} + + CmdArgStrCompiler(const CmdArgStrCompiler & cp) : CmdArg(cp) {} + + CmdArgStrCompiler(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgStrCompiler(void); ++ virtual ~CmdArgStrCompiler(); + + virtual int + operator()(const char * & arg, CmdLine & cmd) = 0; +@@ -510,7 +520,7 @@ + // a CmdArgStr as if it were a string: + // + // operator=(char*); +- // operator char*(void); ++ // operator char*(); + // operator<<(os, CmdArgStr); + // + // The string value is initialized to NULL by the constructor. +@@ -532,16 +542,16 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALREQ) ++ unsigned int syntax_flags =CmdArg::isOPTVALREQ) + : CmdArgStrCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgStr(const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isPOSVALREQ) ++ unsigned int syntax_flags =CmdArg::isPOSVALREQ) + : CmdArgStrCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgStr(void); ++ virtual ~CmdArgStr(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -560,12 +570,12 @@ + CmdArgStr & + operator=(const char * cp) { val = cp; return *this; } + +- operator CmdArgStrCompiler::casc_string(void) { return val; } ++ operator CmdArgStrCompiler::casc_string() { return val; } + +- operator const char*(void) const { return val.str; } ++ operator const char*() const { return val.str; } + + // use this for comparing to NULL +- int isNULL(void) const { return (val.str) ? 0 : 1; } ++ int isNULL() const { return (val.str) ? 0 : 1; } + + private: + CmdArgStrCompiler::casc_string val; +@@ -605,25 +615,25 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) + : CmdArgIntCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgIntList(const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) + : CmdArgIntCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgIntList(void); ++ virtual ~CmdArgIntList(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); + +- unsigned +- count(void) const; ++ unsigned int ++ count() const; + + int & +- operator[](unsigned index); ++ operator[](unsigned int index); + + private: + CmdArgIntList(const CmdArgInt & cp); +@@ -652,25 +662,25 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) + : CmdArgFloatCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgFloatList(const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) + : CmdArgFloatCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgFloatList(void); ++ virtual ~CmdArgFloatList(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); + +- unsigned +- count(void) const; ++ unsigned int ++ count() const; + + float & +- operator[](unsigned index); ++ operator[](unsigned int index); + + private: + CmdArgFloatList(const CmdArgFloat & cp); +@@ -699,25 +709,25 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isOPTVALREQ + CmdArg::isLIST)) + : CmdArgStrCompiler(optchar, keyword, value, description, syntax_flags), + val(0) {} + + CmdArgStrList(const char * value, + const char * description, +- unsigned syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) ++ unsigned int syntax_flags =(CmdArg::isPOSVALREQ + CmdArg::isLIST)) + : CmdArgStrCompiler(value, description, syntax_flags), val(0) {} + +- virtual ~CmdArgStrList(void); ++ virtual ~CmdArgStrList(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); + +- unsigned +- count(void) const; ++ unsigned int ++ count() const; + + CmdArgStrCompiler::casc_string & +- operator[](unsigned index); ++ operator[](unsigned int index); + + private: + CmdArgStrList(const CmdArgStr & cp); +@@ -754,14 +764,14 @@ + CmdArgBoolCompiler(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArg(optchar, keyword, description, syntax_flags) {} + + CmdArgBoolCompiler(const CmdArgBoolCompiler & cp) : CmdArg(cp) {} + + CmdArgBoolCompiler(const CmdArg & cp) : CmdArg(cp) {} + +- virtual ~CmdArgBoolCompiler(void); ++ virtual ~CmdArgBoolCompiler(); + + virtual int + operator()(const char * & arg, CmdLine & cmd) = 0; +@@ -769,8 +779,8 @@ + int + compile(const char * & arg, + CmdLine & cmd, +- unsigned & value, +- unsigned default_value =1); ++ unsigned int & value, ++ unsigned int default_value =1); + } ; + + +@@ -794,7 +804,7 @@ + // a Boolean Value: + // + // operator=(int); +- // operator int(void); ++ // operator int(); + // + // Examples: + // CmdArgBool xflag('x', "xmode", "turn on xmode); +@@ -808,7 +818,7 @@ + CmdArgBool(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArgBoolCompiler(optchar, keyword, description, syntax_flags), + val(0) {} + +@@ -816,7 +826,7 @@ + + CmdArgBool(const CmdArg & cp) : CmdArgBoolCompiler(cp), val(0) {} + +- virtual ~CmdArgBool(void); ++ virtual ~CmdArgBool(); + + CmdArgBool & + operator=(const CmdArgBool & cp) +@@ -826,13 +836,13 @@ + operator=(int new_value) + { val = (new_value) ? 1 : 0; return *this; } + +- operator int(void) const { return val; } ++ operator int() const { return val; } + + virtual int + operator()(const char * & arg, CmdLine & cmd); + + protected: +- unsigned val : 1; ++ unsigned int val : 1; + } ; + + ostream & +@@ -845,14 +855,14 @@ + CmdArgClear(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArgBool(optchar, keyword, description, syntax_flags) { val = 1; } + + CmdArgClear(const CmdArgClear & cp) : CmdArgBool(cp) {} + + CmdArgClear(const CmdArg & cp) : CmdArgBool(cp) { val = 1; } + +- virtual ~CmdArgClear(void); ++ virtual ~CmdArgClear(); + + CmdArgClear & + operator=(const CmdArgClear & cp) +@@ -862,7 +872,7 @@ + operator=(int new_value) + { val = (new_value) ? 1 : 0; return *this; } + +- operator int(void) const { return val; } ++ operator int() const { return val; } + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -873,14 +883,14 @@ + CmdArgToggle(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArgBool(optchar, keyword, description, syntax_flags) {} + + CmdArgToggle(const CmdArgToggle & cp) : CmdArgBool(cp) {} + + CmdArgToggle(const CmdArg & cp) : CmdArgBool(cp) {} + +- virtual ~CmdArgToggle(void); ++ virtual ~CmdArgToggle(); + + CmdArgToggle & + operator=(const CmdArgToggle & cp) +@@ -890,7 +900,7 @@ + operator=(int new_value) + { val = (new_value) ? 1 : 0; return *this; } + +- operator int(void) const { return val; } ++ operator int() const { return val; } + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -929,10 +939,10 @@ + char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArg(optchar, keyword, description, syntax_flags), ref(bool_arg) {} + +- virtual ~CmdArgBoolRef(void); ++ virtual ~CmdArgBoolRef(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -949,10 +959,10 @@ + char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArg(optchar, keyword, description, syntax_flags), ref(bool_arg) {} + +- virtual ~CmdArgClearRef(void); ++ virtual ~CmdArgClearRef(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -967,10 +977,10 @@ + char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =CmdArg::isOPT) ++ unsigned int syntax_flags =CmdArg::isOPT) + : CmdArg(optchar, keyword, description, syntax_flags), ref(bool_arg) {} + +- virtual ~CmdArgToggleRef(void); ++ virtual ~CmdArgToggleRef(); + + virtual int + operator()(const char * & arg, CmdLine & cmd); +@@ -978,5 +988,7 @@ + protected: + CmdArgBool & ref; + } ; ++ ++} // namespace cmdline + + #endif /* _usr_include_cmdargs_h */ diff --git a/devel/cmdline/patches/patch-ay b/devel/cmdline/patches/patch-ay new file mode 100644 index 00000000000..4443b50b54c --- /dev/null +++ b/devel/cmdline/patches/patch-ay @@ -0,0 +1,169 @@ +$NetBSD: patch-ay,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdline.c.orig Thu Jan 2 13:33:32 1997 ++++ src/lib/cmdline.c +@@ -18,21 +18,31 @@ + // - Added cmd_nargs_parsed field to CmdLine + // - Added cmd_description field to CmdLine + // - Added exit_handler() and quit() member-functions to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <stdarg.h> +-#include <string.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cstdarg> ++#include <cstring> ++#include <cctype> ++#include <iostream> + + #include "cmdline.h" + #include "cmdargs.h" + #include "arglist.h" + #include "states.h" + +-#define va_CmdArgP(ap) va_arg(ap, CmdArg *) ++namespace cmdline { + ++using std::cerr; ++using std::exit; ++using std::strcpy; ++using std::strrchr; ++ ++#define va_CmdArgP(ap) va_arg(ap, CmdArg *) + + //------------------------------------------------------------------- init_args + +@@ -139,12 +149,12 @@ + # ifdef vms + char * ver; + // remove leading directory and/or device name +- p1 = ::strrchr(filename, ':'); +- p2 = ::strrchr(filename, ']'); ++ p1 = strrchr(filename, ':'); ++ p2 = strrchr(filename, ']'); + # else + // remove leading directory and/or drive name +- p1 = ::strrchr(filename, '/'); +- p2 = ::strrchr(filename, '\\'); ++ p1 = strrchr(filename, '/'); ++ p2 = strrchr(filename, '\\'); + # endif + if ((p1 == NULL) && (p2 == NULL)) { + start = filename ; +@@ -157,15 +167,15 @@ + } + + str = new char[strlen(start) + 1]; +- (void) ::strcpy(str, start); ++ strcpy(str, start); + + // remove the extension +- ext = ::strrchr(str, '.'); ++ ext = strrchr(str, '.'); + if (ext) *ext = '\0' ; + + # ifdef vms + // remove the version +- ver = ::strrchr(str, ';'); ++ ver = strrchr(str, ';'); + if (ver) *ver = '\0' ; + # endif + +@@ -173,7 +183,7 @@ + + #else + +- char * p = ::strrchr(filename, '/') ; ++ char * p = strrchr(filename, '/') ; + return (p == NULL) ? filename : (p + 1) ; + + #endif /* if (vms || msdos || os2) */ +@@ -197,7 +207,7 @@ + cmd_quit_handler(NULL) + { + name(cmdname); +- ::init_args(cmd_args); ++ init_args(cmd_args); + } + + // Constructor with a name and CmdArgs +@@ -215,7 +225,7 @@ + cmd_quit_handler(NULL) + { + name(cmdname); +- ::init_args(cmd_args); ++ init_args(cmd_args); + + CmdArgListListIter iter(cmd_args); + CmdArgList * arg_list = iter(); +@@ -244,7 +254,7 @@ + cmd_quit_handler(NULL) + { + if (cmdarg1 == NULL) return; +- ::init_args(cmd_args); ++ init_args(cmd_args); + + CmdArgListListIter iter(cmd_args); + CmdArgList * arg_list = iter(); +@@ -259,7 +269,7 @@ + + + // Destructor +-CmdLine::~CmdLine(void) ++CmdLine::~CmdLine() + { + delete cmd_args; + +@@ -278,14 +288,14 @@ + #if (defined(vms) || defined(msdos) || defined(os2)) + delete [] cmd_name; + #endif +- cmd_name = ::filebasename((progname) ? progname : unknown_progname); ++ cmd_name = filebasename((progname) ? progname : unknown_progname); + } + + + // Print an error message prefix and return a reference to the + // error output stream for this command + ostream & +-CmdLine::error(unsigned quiet) const ++CmdLine::error(unsigned int quiet) const + { + ostream * os = (cmd_err) ? cmd_err : &cerr ; + if (cmd_name && *cmd_name && !quiet) *os << cmd_name << ": " ; +@@ -310,7 +320,7 @@ + if (cmd_quit_handler != NULL) { + (*cmd_quit_handler)(status); + } else { +- ::exit(status); ++ exit(status); + } + } + +@@ -338,7 +348,7 @@ + } + } + +-CmdLineCmdArgIter::~CmdLineCmdArgIter(void) ++CmdLineCmdArgIter::~CmdLineCmdArgIter() + { + delete iter; + } +@@ -347,8 +357,9 @@ + // Returns NULL if we are already at the end of the list. + // + CmdArg * +-CmdLineCmdArgIter::operator()(void) ++CmdLineCmdArgIter::operator()() + { + return (iter) ? iter->operator()() : NULL ; + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-az b/devel/cmdline/patches/patch-az new file mode 100644 index 00000000000..1edf86d7d29 --- /dev/null +++ b/devel/cmdline/patches/patch-az @@ -0,0 +1,615 @@ +$NetBSD: patch-az,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdline.h.orig Thu Jan 2 13:33:32 1997 ++++ src/lib/cmdline.h +@@ -16,16 +16,26 @@ + // - Added cmd_description field to CmdLine + // - Added exit_handler() and quit() member-functions to CmdLine + // - Added ALLOW_PLUS to list of CmdLine configuration flags ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Add declarations from arglist.h. + //-^^--------------------------------------------------------------------- + + #ifndef _usr_include_cmdline_h + #define _usr_include_cmdline_h + +-class ostream ; +-class istream ; ++#include <iosfwd> ++#include <fifolist.h> ++ ++namespace cmdline { ++ ++class CmdArg ; + class CmdLine ; +-class CmdArgListIter ; +-class CmdArgListList ; ++ ++DECLARE_FIFO_LIST(CmdArgList, CmdArg); ++DECLARE_FIFO_LIST(CmdArgListList, CmdArgList); + + //----------------------------------------------------------------------------- + +@@ -110,7 +120,7 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =isOPTVALREQ); ++ unsigned int syntax_flags =isOPTVALREQ); + + // Create an option that takes no value. + // +@@ -123,7 +133,7 @@ + CmdArg(char optchar, + const char * keyword, + const char * description, +- unsigned syntax_flags =isOPT); ++ unsigned int syntax_flags =isOPT); + + // Create a positional argument. + // +@@ -142,18 +152,18 @@ + // + CmdArg(const char * value, + const char * description, +- unsigned syntax_flags =isPOSVALREQ); ++ unsigned int syntax_flags =isPOSVALREQ); + + + CmdArg(const CmdArg & cp); + +- virtual ~CmdArg(void); ++ virtual ~CmdArg(); + + // over-ride this function to return a non-zero value if you + // wish the argument to be ignored (except for usage messages). + // + virtual int +- is_dummy(void); ++ is_dummy(); + + // Here is the "primary" function that makes everything work ... + // +@@ -204,12 +214,12 @@ + operator()(const char * & arg, CmdLine & cmd) = 0; + + // Retrieve the syntax flags for this argument. +- unsigned +- syntax(void) const { return arg_syntax; } ++ unsigned int ++ syntax() const { return arg_syntax; } + + // Get the flags that say how this argument was specified. +- unsigned +- flags(void) const { return arg_flags; } ++ unsigned int ++ flags() const { return arg_flags; } + + // Get the sequence number corresponding to the last + // time this argument was matched on the command-line. +@@ -218,65 +228,65 @@ + // will be zero, otherwise it will be 'N' where the last + // time this argument was matched, it was the 'N'th argument + // encountered. +- unsigned +- sequence(void) const { return arg_sequence; } ++ unsigned int ++ sequence() const { return arg_sequence; } + + // Get the character (short-option) name of this argument. + // Returns '\0' if there isnt one. + char +- char_name(void) const { return arg_char_name; } ++ char_name() const { return arg_char_name; } + + // Get the keyword (long-option) name of this argument + // Returns NULL if there isnt one. + const char * +- keyword_name(void) const { return arg_keyword_name; } ++ keyword_name() const { return arg_keyword_name; } + + // Get the value name of this argument. + // Returns NULL if this argument takes no value. + const char * +- value_name(void) const { return arg_value_name; } ++ value_name() const { return arg_value_name; } + + // Get the description (help-message) of this argument. + const char * +- description(void) const { return arg_description; } ++ description() const { return arg_description; } + + // If we were compiled for dubugging, then dump this argument + virtual void +- dump(ostream & os, unsigned level =0) const; ++ dump(std::ostream & os, unsigned int level =0) const; + + private: + // Member functions for internal use + + void +- adjust_syntax(void); ++ adjust_syntax(); + + void +- parse_description(void); ++ parse_description(); + + void +- parse_value(void); ++ parse_value(); + + void +- flags(unsigned newflags) { arg_flags = newflags; } ++ flags(unsigned int newflags) { arg_flags = newflags; } + + void +- set(unsigned flags) { arg_flags |= flags; } ++ set(unsigned int flags) { arg_flags |= flags; } + + void +- clear(unsigned flags =~0) { arg_flags &= ~flags; } ++ clear(unsigned int flags =~0) { arg_flags &= ~flags; } + + // set sequence number + void +- sequence(unsigned num) { arg_sequence = num; } ++ sequence(unsigned int num) { arg_sequence = num; } + + // Private data members + +- unsigned alloc_value_name : 1 ; ++ unsigned int alloc_value_name : 1 ; + +- unsigned arg_flags : 8 ; +- unsigned arg_syntax : 8 ; ++ unsigned int arg_flags : 8 ; ++ unsigned int arg_syntax : 8 ; + +- unsigned arg_sequence; ++ unsigned int arg_sequence; + + char arg_char_name; + const char * arg_keyword_name; +@@ -293,19 +303,19 @@ + // + class CmdLineArgIter { + public: +- CmdLineArgIter(void); ++ CmdLineArgIter(); + +- virtual ~CmdLineArgIter(void); ++ virtual ~CmdLineArgIter(); + + // Return the current argument and advance to the next one. + // Returns NULL if we are already at the end of the arguments + // + virtual const char * +- operator()(void) = 0; ++ operator()() = 0; + + // Are the args returned by operator() pointing to temporary storage? + virtual int +- is_temporary(void) const = 0; ++ is_temporary() const = 0; + + private: + CmdLineArgIter(const CmdLineArgIter &) ; +@@ -326,14 +336,14 @@ + CmdArgvIter(const char * const argv[]) + : array(argv), index(0), count(-1) {} + +- virtual ~CmdArgvIter(void); ++ virtual ~CmdArgvIter(); + + virtual const char * +- operator()(void); ++ operator()(); + + // is_temporary returns 0 for CmdArgvIter + virtual int +- is_temporary(void) const; ++ is_temporary() const; + + // Restart using a different string array. + void +@@ -367,10 +377,10 @@ + public: + CmdStrTokIter(const char * tokens, const char * delimiters =0); + +- virtual ~CmdStrTokIter(void); ++ virtual ~CmdStrTokIter(); + + virtual const char * +- operator()(void); ++ operator()(); + + // Reset using a new token-string and delimiter set. + void +@@ -378,7 +388,7 @@ + + // Get the current delimiter set + const char * +- delimiters(void) const { return seps; } ++ delimiters() const { return seps; } + + // Change the current delimiter set + void +@@ -386,7 +396,7 @@ + + // is_temporary returns 1 for CmdStrTokIter + virtual int +- is_temporary(void) const; ++ is_temporary() const; + + private: + CmdStrTokIter(const CmdStrTokIter &) ; +@@ -411,21 +421,21 @@ + // + class CmdIstreamIter : public CmdLineArgIter { + public: +- static const unsigned MAX_LINE_LEN ; ++ static const unsigned int MAX_LINE_LEN ; + +- CmdIstreamIter(istream & input); ++ CmdIstreamIter(std::istream & input); + +- virtual ~CmdIstreamIter(void); ++ virtual ~CmdIstreamIter(); + + virtual const char * +- operator()(void); ++ operator()(); + + // is_temporary returns 1 for CmdIstreamIter + virtual int +- is_temporary(void) const; ++ is_temporary() const; + + private: +- istream & is ; ++ std::istream & is ; + CmdStrTokIter * tok_iter ; + } ; + +@@ -496,11 +506,11 @@ + + CmdLine(CmdArg * cmdarg1 ...); // last arg should be NULL + +- virtual ~CmdLine(void); ++ virtual ~CmdLine(); + + // Get the command name. + const char * +- name(void) const { return cmd_name; } ++ name() const { return cmd_name; } + + // Specify a command name. + void +@@ -508,7 +518,7 @@ + + // Get the command description. + const char * +- description(void) const { return cmd_description; } ++ description() const { return cmd_description; } + + // Specify a command description. + void +@@ -548,11 +558,11 @@ + } ; + + // Print usage on the given output stream using the given verboseness +- ostream & +- usage(ostream & os, CmdUsageLevel level =DEFAULT_USAGE) const ; ++ std::ostream & ++ usage(std::ostream & os, CmdUsageLevel level =DEFAULT_USAGE) const ; + + // Print usage on the CmdLine's error-outstream +- ostream & ++ std::ostream & + usage(CmdUsageLevel level =DEFAULT_USAGE) const ; + + // Obtain the current status of the command. The status will be +@@ -560,8 +570,8 @@ + // to a combination of CmdStatus bitmasks telling us precisely + // what went wrong. + // +- unsigned +- status(void) const { return cmd_status; } ++ unsigned int ++ status() const { return cmd_status; } + + // Print an error message prefix on the error output stream + // associated with this command. The prefix printed is the +@@ -577,8 +587,8 @@ + // (which may be useful if you wish only to obtain a reference + // this CmdLine's error-outstream). + // +- ostream & +- error(unsigned quiet =0) const; ++ std::ostream & ++ error(unsigned int quiet =0) const; + + // If the QUIET-flag is not set, then we need to know where + // to print any error messages (the default is cerr). +@@ -587,27 +597,27 @@ + // for error messages. + // + void +- error(ostream & os) { cmd_err = &os; } ++ error(std::ostream & os) { cmd_err = &os; } + + // + // Get & set the command-parsing-flags + // + + // Get the current set of command-flags +- unsigned +- flags(void) const { return cmd_flags; } ++ unsigned int ++ flags() const { return cmd_flags; } + + // Specify a new set of command-flags + void +- flags(unsigned newflags) { cmd_flags = newflags; } ++ flags(unsigned int newflags) { cmd_flags = newflags; } + + // Set only the given command-flags + void +- set(unsigned flags) { cmd_flags |= flags; } ++ set(unsigned int flags) { cmd_flags |= flags; } + + // Clear only the given command-flags + void +- clear(unsigned flags =~0) { cmd_flags &= ~flags; } ++ clear(unsigned int flags =~0) { cmd_flags &= ~flags; } + + // + // We are somewhat flexible in the way we parse arguments. +@@ -632,33 +642,33 @@ + // + enum { NO_PROCESSING = 0, AUTO_PROCESSING = 1 } ; + +- unsigned ++ unsigned int + parse(CmdLineArgIter & arg_iter, int processing =AUTO_PROCESSING) ; + + // Perform the necessary pre-processing. + // Return the resultant command status. + // +- unsigned +- prologue(void) ; ++ unsigned int ++ prologue() ; + + // Parse a single argument (pre- and post- processing is + // NOT performed). + // +- unsigned ++ unsigned int + parse_arg(const char * arg) ; + + // Perform the necessary post-processing. + // Return the resultant command status. + // +- unsigned +- epilogue(void) ; ++ unsigned int ++ epilogue() ; + + // + // Find out the number of arguments parsed so far + // + +- unsigned +- nargs_parsed(void) const { return cmd_nargs_parsed; } ++ unsigned int ++ nargs_parsed() const { return cmd_nargs_parsed; } + + // + // Exception handling (well -- not really) +@@ -685,7 +695,7 @@ + // Get the current quit-handler (returns NULL if there isnt one) + // + quit_func_t +- quit_handler(void) const { return cmd_quit_handler; } ++ quit_handler() const { return cmd_quit_handler; } + + + // +@@ -714,16 +724,16 @@ + // + + // get the release number +- static unsigned +- release(void); ++ static unsigned int ++ release(); + + // get the patchlevel number +- static unsigned +- patchlevel(void); ++ static unsigned int ++ patchlevel(); + + // get the SCCS identifier string + static const char * +- ident(void); ++ ident(); + + // + // These next few functions are used internally but are general +@@ -740,7 +750,7 @@ + // partial-match, and str_NONE otherwise. + // + static strmatch_t +- strmatch(const char * src, const char * attempt, unsigned len =0); ++ strmatch(const char * src, const char * attempt, unsigned int len =0); + + // Print a hanging indented paragraph on an outstream. Long lines + // are broken at word boundaries and are wrapped to line up with +@@ -753,12 +763,12 @@ + // is the second sentence. etc ... + // + static void +- strindent(ostream & os, +- unsigned maxcols, +- unsigned margin, +- const char * title, +- unsigned indent, +- const char * text); ++ strindent(std::ostream & os, ++ unsigned int maxcols, ++ unsigned int margin, ++ const char * title, ++ unsigned int indent, ++ const char * text); + + // + // Debugging stuff ... +@@ -766,24 +776,24 @@ + + // If we were compiled for dubugging, then dump this command + virtual void +- dump(ostream & os, unsigned level =0) const; ++ dump(std::ostream & os, unsigned int level =0) const; + + // If we were compiled for dubugging, then dump the argument list + virtual void +- dump_args(ostream & os, unsigned level =0) const; ++ dump_args(std::ostream & os, unsigned int level =0) const; + + private: + // Private data members +- unsigned cmd_parse_state : 8 ; +- unsigned cmd_state : 8 ; +- unsigned cmd_flags : 16 ; +- unsigned cmd_status : 16 ; +- unsigned cmd_nargs_parsed ; ++ unsigned int cmd_parse_state : 8 ; ++ unsigned int cmd_state : 8 ; ++ unsigned int cmd_flags : 16 ; ++ unsigned int cmd_status : 16 ; ++ unsigned int cmd_nargs_parsed ; + const char * cmd_name ; + const char * cmd_description ; + CmdArg * cmd_matched_arg ; + CmdArgListList * cmd_args ; +- ostream * cmd_err ; ++ std::ostream * cmd_err ; + quit_func_t cmd_quit_handler ; + + // Disallow copying and assignment +@@ -803,16 +813,16 @@ + handle_arg(CmdArg * cmdarg, const char * & arg); + + void +- ck_need_val(void); ++ ck_need_val(); + + CmdLineSyntax +- syntax(void) const; ++ syntax() const; + +- unsigned ++ unsigned int + prompt_user(CmdArg * cmdarg); + +- unsigned +- missing_args(void); ++ unsigned int ++ missing_args(); + + CmdArg * + opt_match(char optchar) const; +@@ -824,47 +834,47 @@ + int match_value =0) const; + + CmdArg * +- pos_match(void) const; ++ pos_match() const; + +- unsigned ++ unsigned int + parse_option(const char * arg); + +- unsigned ++ unsigned int + parse_keyword(const char * arg); + +- unsigned ++ unsigned int + parse_value(const char * arg); + +- ostream & ++ std::ostream & + arg_error(const char * error_str, const CmdArg * cmdarg) const; + +- unsigned ++ unsigned int + fmt_arg(const CmdArg * cmdarg, + char * buf, +- unsigned bufsize, ++ unsigned int bufsize, + CmdLineSyntax syntax, + CmdUsageLevel level) const; + + static CmdUsageLevel +- get_usage_level(void); ++ get_usage_level(); + +- unsigned +- print_synopsis(CmdLineSyntax syntax, +- ostream & os, +- int cols) const; ++ unsigned int ++ print_synopsis(CmdLineSyntax syntax, ++ std::ostream & os, ++ int cols) const; + + void + print_descriptions(CmdLineSyntax syntax, +- ostream & os, ++ std::ostream & os, + int cols, +- unsigned longest) const; ++ unsigned int longest) const; + + } ; + + + // "os << cmd" is equivalent to "cmd.usage(os)" +-inline ostream & +-operator <<(ostream & os, CmdLine & cmd) { return cmd.usage(os); } ++inline std::ostream & ++operator <<(std::ostream & os, CmdLine & cmd) { return cmd.usage(os); } + + + //----------------------------------------------------------------------------- +@@ -879,13 +889,13 @@ + + CmdLineCmdArgIter(CmdLine * cmd); + +- virtual ~CmdLineCmdArgIter(void); ++ virtual ~CmdLineCmdArgIter(); + + // Return the current argument and advance to the next one. + // Returns NULL if we are already at the end of the list. + // + CmdArg * +- operator()(void); ++ operator()(); + + private: + CmdLineCmdArgIter(const CmdLineCmdArgIter &); +@@ -895,5 +905,7 @@ + + CmdArgListIter * iter; + } ; ++ ++} // namespace cmdline + + #endif /* _usr_include_cmdline_h */ diff --git a/devel/cmdline/patches/patch-ba b/devel/cmdline/patches/patch-ba new file mode 100644 index 00000000000..d170dea3be8 --- /dev/null +++ b/devel/cmdline/patches/patch-ba @@ -0,0 +1,102 @@ +$NetBSD: patch-ba,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/cmdtest.c.orig Thu Jan 2 13:33:33 1997 ++++ src/lib/cmdtest.c +@@ -9,13 +9,18 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Attached a description to the command. ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <ctype.h> ++#include <cstdlib> ++#include <cctype> ++#include <iostream> + #include <cmdargs.h> + ++using namespace cmdline; ++ + //---------------------------------------------------------------- CmdArgModCmd + + // CmdArgModCmd is a special argument that we use for testing. +@@ -34,7 +39,7 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags =CmdArg::isOPTVALOPT); ++ unsigned int syntax_flags =CmdArg::isOPTVALOPT); + + virtual + ~CmdArgModCmd(void); +@@ -47,14 +52,14 @@ + const char * keyword, + const char * value, + const char * description, +- unsigned syntax_flags) ++ unsigned int syntax_flags) + : CmdArg(optchar, keyword, value, description, syntax_flags) {} + + CmdArgModCmd::~CmdArgModCmd(void) {} + + int CmdArgModCmd::operator()(const char * & arg, CmdLine & cmd) + { +- unsigned new_flags = 0; ++ unsigned int new_flags = 0; + for (const char * p = arg ; *p ; p++) { + char ch = *p; + if (isupper(ch)) ch = tolower(ch); +@@ -142,7 +147,7 @@ + cout << "xflag=" << (xflag ? "ON" : "OFF") << endl ; + cout << "count=" << count << endl ; + +- unsigned sflags = str.flags(); ++ unsigned int sflags = str.flags(); + if ((sflags & CmdArg::GIVEN) && (! (sflags & CmdArg::VALGIVEN))) { + cout << "No string given on command-line!" << endl ; + } else { +@@ -154,20 +159,20 @@ + cout << "why=\"" << why << "\"" << endl ; + cout << "who=\"" << who << "\"" << endl ; + +- unsigned nints = ints.count(); ++ unsigned int nints = ints.count(); + for (int i = 0; i < nints ; i++) { + cout << "int[" << i << "]=" << ints[i] << endl ; + } + +- unsigned ngrps = grps.count(); +- for (i = 0; i < ngrps ; i++) { ++ unsigned int ngrps = grps.count(); ++ for (int i = 0; i < ngrps ; i++) { + cout << "groups[" << i << "]=\"" << grps[i] << "\"" << endl ; + } + + cout << "name=\"" << name << "\"" << endl ; + +- unsigned nfiles = files.count(); +- for (i = 0; i < nfiles ; i++) { ++ unsigned int nfiles = files.count(); ++ for (int i = 0; i < nfiles ; i++) { + cout << "files[" << i << "]=\"" << files[i] << "\"" << endl ; + } + } +@@ -223,12 +228,12 @@ + name = NULL; + + cout << "Parsing the command-line ..." << endl ; +- unsigned status = cmd.parse(argv_iter); ++ unsigned int status = cmd.parse(argv_iter); + if (status) cmd.error() << "parsing errors occurred!" << endl ; + + print_args(); + +- unsigned dbg_flags = debug.flags(); ++ unsigned int dbg_flags = debug.flags(); + if ((dbg_flags & CmdArg::GIVEN) && (! (dbg_flags & CmdArg::VALGIVEN))) { + debug = 1; + } diff --git a/devel/cmdline/patches/patch-bb b/devel/cmdline/patches/patch-bb new file mode 100644 index 00000000000..0cc19b038de --- /dev/null +++ b/devel/cmdline/patches/patch-bb @@ -0,0 +1,208 @@ +$NetBSD: patch-bb,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/dump.c.orig Thu Jan 2 13:33:33 1997 ++++ src/lib/dump.c +@@ -13,18 +13,23 @@ + // - Added arg_sequence field to CmdArg + // - Added cmd_nargs_parsed field to CmdLine + // - Added cmd_description field to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + + #include "cmdline.h" + + #ifdef DEBUG_CMDLINE +-# include <iostream.h> +-# include <string.h> ++# include <iostream> + +-# include "arglist.h" + # include "states.h" + #endif + ++namespace cmdline { ++ ++using std::ostream; + + #ifdef DEBUG_CMDLINE + +@@ -32,7 +37,7 @@ + // The number of spaces to indent is 3x the indent level + // + static ostream & +-indent(ostream & os, unsigned level) ++indent(ostream & os, unsigned int level) + { + os.width(level * 3); + return (os << ""); +@@ -42,7 +47,7 @@ + // Dump the arg_syntax field of a CmdArg in a mnemonic format + // + static ostream & +-dump_arg_syntax(ostream & os, unsigned syntax) ++dump_arg_syntax(ostream & os, unsigned int syntax) + { + if (syntax & CmdArg::isREQ) { + os << "isREQ" ; +@@ -78,7 +83,7 @@ + + // Dump the arg_flags field of a CmdArg in a mnemonic format + static ostream & +-dump_arg_flags(ostream & os, unsigned flags) ++dump_arg_flags(ostream & os, unsigned int flags) + { + if (flags & CmdArg::GIVEN) { + os << "GIVEN" ; +@@ -109,7 +114,7 @@ + + // Dump the cmd_flags field of a CmdLine in a mnemonic format + static ostream & +-dump_cmd_flags(ostream & os, unsigned flags) ++dump_cmd_flags(ostream & os, unsigned int flags) + { + if (flags & CmdLine::NO_ABORT) { + os << "NO_ABORT" ; +@@ -147,7 +152,7 @@ + + // Dump the status of a CmdLine in a mnemonic format + static ostream & +-dump_cmd_status(ostream & os, unsigned status) ++dump_cmd_status(ostream & os, unsigned int status) + { + if (! status) { + os << "NO_ERROR"; +@@ -189,7 +194,7 @@ + + // Dump the state of a CmdLine in a mnemonic format + static ostream & +-dump_cmd_state(ostream & os, unsigned state) ++dump_cmd_state(ostream & os, unsigned int state) + { + if (! state) { + os << "NO_OPTIONS"; +@@ -215,7 +220,7 @@ + + // Dump the parse_state of a CmdLine in a mnemonic format + static ostream & +-dump_cmd_parse_state(ostream & os, unsigned parse_state) ++dump_cmd_parse_state(ostream & os, unsigned int parse_state) + { + switch (parse_state) { + case cmd_START_STATE : +@@ -264,9 +269,9 @@ + + // Dump the arguments (including the default arguments) in an arg_list + static ostream & +-dump_cmd_args(ostream & os, CmdArgListList * arg_list, unsigned level) ++dump_cmd_args(ostream & os, CmdArgListList * arg_list, unsigned int level) + { +- ::indent(os, level) << "CmdLine::cmd_args {\n" ; ++ indent(os, level) << "CmdLine::cmd_args {\n" ; + + CmdArgListListIter list_iter(arg_list); + for (CmdArgList * alist = list_iter() ; alist ; alist = list_iter()) { +@@ -276,7 +281,7 @@ + } + } + +- ::indent(os, level) << "}" << endl; ++ indent(os, level) << "}" << endl; + return os; + } + +@@ -285,72 +290,73 @@ + + // Dump a CmdArg + void +-CmdArg::dump(ostream & os, unsigned level) const ++CmdArg::dump(ostream & os, unsigned int level) const + { + #ifdef DEBUG_CMDLINE +- ::indent(os, level) << "CmdArg {\n" ; ++ indent(os, level) << "CmdArg {\n" ; + +- ::indent(os, level + 1) << "option='" << char(arg_char_name) << "', " ++ indent(os, level + 1) << "option='" << char(arg_char_name) << "', " + << "keyword=\"" << arg_keyword_name << "\", " + << "value=\"" << arg_value_name << "\"\n" ; + +- ::indent(os, level + 1) << "syntax=" ; ++ indent(os, level + 1) << "syntax=" ; + dump_arg_syntax(os, arg_syntax) << "\n"; + +- ::indent(os, level + 1) << "flags=" ; ++ indent(os, level + 1) << "flags=" ; + dump_arg_flags(os, arg_flags) << "\n"; + +- ::indent(os, level + 1) << "sequence=" << arg_sequence << "\n"; ++ indent(os, level + 1) << "sequence=" << arg_sequence << "\n"; + +- ::indent(os, level) << "}" << endl; ++ indent(os, level) << "}" << endl; + #endif + } + + + // Dump a CmdLine + void +-CmdLine::dump(ostream & os, unsigned level) const ++CmdLine::dump(ostream & os, unsigned int level) const + { + #ifdef DEBUG_CMDLINE +- ::indent(os, level) << "CmdLine {\n" ; ++ indent(os, level) << "CmdLine {\n" ; + +- ::indent(os, level + 1) << "name=\"" << cmd_name << "\"\n"; ++ indent(os, level + 1) << "name=\"" << cmd_name << "\"\n"; + +- ::indent(os, level + 1) << "description=\"" << cmd_description << "\"\n"; ++ indent(os, level + 1) << "description=\"" << cmd_description << "\"\n"; + +- ::indent(os, level + 1) << "flags=" ; ++ indent(os, level + 1) << "flags=" ; + dump_cmd_flags(os, cmd_flags) << "\n"; + +- ::indent(os, level + 1) << "status=" ; ++ indent(os, level + 1) << "status=" ; + dump_cmd_status(os, cmd_status) << "\n"; + +- ::indent(os, level + 1) << "state=" ; ++ indent(os, level + 1) << "state=" ; + dump_cmd_state(os, cmd_state) << "\n"; + +- ::indent(os, level + 1) << "parse_state=" ; ++ indent(os, level + 1) << "parse_state=" ; + dump_cmd_parse_state(os, cmd_parse_state) << "\n"; + +- ::indent(os, level + 1); ++ indent(os, level + 1); + if (cmd_matched_arg == NULL) { + os << "matched_arg=NULL\n"; + } else { + os << "matched_arg=" << (void *)cmd_matched_arg << "\n"; + } + +- ::indent(os, level + 1) << "# valid-args-parsed=" ++ indent(os, level + 1) << "# valid-args-parsed=" + << cmd_nargs_parsed << "\n" ; + +- ::indent(os, level) << "}" << endl; ++ indent(os, level) << "}" << endl; + #endif + } + + + // Dump the arguments of a CmdLine + void +-CmdLine::dump_args(ostream & os, unsigned level) const ++CmdLine::dump_args(ostream & os, unsigned int level) const + { + #ifdef DEBUG_CMDLINE + dump_cmd_args(os, cmd_args, level); + #endif + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bc b/devel/cmdline/patches/patch-bc new file mode 100644 index 00000000000..cba0681406b --- /dev/null +++ b/devel/cmdline/patches/patch-bc @@ -0,0 +1,100 @@ +$NetBSD: patch-bc,v 1.1.1.1 2000/08/25 16:15:53 jlam Exp $ + +--- src/lib/fifolist.c.orig Thu Jan 2 13:33:33 1997 ++++ src/lib/fifolist.c +@@ -6,9 +6,14 @@ + // + // ^HISTORY: + // 03/21/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Moved template code to fifolist.h from this file + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> ++#include <cstdlib> + #include "cmdline.h" + #include "fifolist.h" + +@@ -16,10 +21,12 @@ + # define NULL 0L + #endif + ++namespace cmdline { ++ + //------------------------------------------------------------- GenericFifoList + + // Destructor +-GenericFifoList::~GenericFifoList(void) { ++GenericFifoList::~GenericFifoList() { + GenericFifoListNode * nd = head; + head = NULL; + while (nd) { +@@ -48,7 +55,7 @@ + + // Remove an item off the front + void * +-GenericFifoList::remove(void) { ++GenericFifoList::remove() { + if (head == NULL) return NULL; + GenericFifoListNode * nd = head; + void * result = head->contents; +@@ -61,10 +68,10 @@ + + //--------------------------------------------------------- GenericFifoListIter + +-GenericFifoListIter::~GenericFifoListIter(void) {} ++GenericFifoListIter::~GenericFifoListIter() {} + + void * +-GenericFifoListIter::operator()(void) { ++GenericFifoListIter::operator()() { + void * result = NULL; + if (current) { + result = current->contents; +@@ -75,11 +82,11 @@ + + //-------------------------------------------------------- GenericFifoListArray + +-GenericFifoListArray::~GenericFifoListArray(void) {} ++GenericFifoListArray::~GenericFifoListArray() {} + + void * +-GenericFifoListArray::operator[](unsigned ndx) { +- unsigned max_index = count(); ++GenericFifoListArray::operator[](unsigned int ndx) { ++ unsigned int max_index = count(); + if (! max_index--) return NULL; // check for underflow + if (ndx > max_index) return NULL; // check for overflow + +@@ -104,27 +111,4 @@ + return current->contents; + } + +-//-------------------------------------------------------------------- FifoList +- +-#ifdef TEMPLATES +- +- // Destructor +-template <class Type> +-FifoList<Type>::~FifoList(void) { +- GenericFifoListNode * nd = head; +- head = NULL; +- while (nd) { +- GenericFifoListNode * to_delete = nd; +- nd = nd->next; +- if (del_items) delete (Type *)to_delete->contents; +- delete to_delete; +- } +-} +- +-template <class Type> +-FifoListIter<Type>::~FifoListIter(void) {} +- +-template <class Type> +-FifoListArray<Type>::~FifoListArray(void) {} +- +-#endif ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bd b/devel/cmdline/patches/patch-bd new file mode 100644 index 00000000000..b8c85a167bf --- /dev/null +++ b/devel/cmdline/patches/patch-bd @@ -0,0 +1,242 @@ +$NetBSD: patch-bd,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/fifolist.h.orig Thu Jan 2 13:33:34 1997 ++++ src/lib/fifolist.h +@@ -22,6 +22,11 @@ + // + // ^HISTORY: + // 03/21/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Moved template code from fifolist.c to this header file + //-^^--------------------------------------------------------------------- + + #ifndef _fifolist_h +@@ -35,6 +40,7 @@ + # endif + #endif + ++namespace cmdline { + + // GenericFifoList - a FIFO linked list of void * pointers + // +@@ -51,41 +57,41 @@ + : next(nd), contents(val) {} + } ; + +- unsigned mod : 1; +- unsigned del_items : 1; +- unsigned num_items ; ++ unsigned int mod : 1; ++ unsigned int del_items : 1; ++ unsigned int num_items ; + GenericFifoListNode * head; + GenericFifoListNode * tail; + +- GenericFifoList(void) ++ GenericFifoList() + : head(0), tail(0), num_items(0), del_items(0), mod(0) {} + + // Remove the first item from the list + void * +- remove(void); ++ remove(); + + // Add an item to the end of the list + void + add(void * item); + + public: +- virtual ~GenericFifoList(void); ++ virtual ~GenericFifoList(); + + // Was the list modified since the last time we checked? + int +- modified(void) { return (mod) ? (mod = 0, 1) : 0 ; } ++ modified() { return (mod) ? (mod = 0, 1) : 0 ; } + + // Is the list empty? + int +- is_empty(void) const { return (num_items == 0); } ++ is_empty() const { return (num_items == 0); } + + // How many items are in the list? +- unsigned +- count(void) const { return num_items; } ++ unsigned int ++ count() const { return num_items; } + + // Is the list responsible for deleting the items it contains? + int +- self_cleaning(void) const { return int(del_items); } ++ self_cleaning() const { return int(del_items); } + + // Tell the list who is responsible for deleting the items it contains? + void +@@ -112,10 +118,10 @@ + // returns NULL if at end-of-list + // + void * +- operator()(void); ++ operator()(); + + public: +- virtual ~GenericFifoListIter(void); ++ virtual ~GenericFifoListIter(); + + } ; + +@@ -124,7 +130,7 @@ + class GenericFifoListArray { + private: + GenericFifoList & list; +- unsigned index; ++ unsigned int index; + GenericFifoList::GenericFifoListNode * current; + + protected: +@@ -135,7 +141,7 @@ + : list(*fifo_list), index(0), current(fifo_list->head) {} + + // How many items are in the array? +- unsigned count(void) const { return list.count(); } ++ unsigned int count() const { return list.count(); } + + // Return a specified item in the array. + // NOTE: the programmer is responsible for making sure the given index +@@ -146,27 +152,27 @@ + // cause a NULL pointer dereferencing error! + // + void * +- operator[](unsigned ndx); ++ operator[](unsigned int ndx); + + public: +- virtual ~GenericFifoListArray(void); ++ virtual ~GenericFifoListArray(); + + } ; + +-#ifdef TEMPLATES ++#if 1 // TEMPLATES + + template <class Type> + class FifoList : public GenericFifoList { + public: +- FifoList(void) {} ++ FifoList() {} + +- virtual ~FifoList(void); ++ virtual ~FifoList(); + + void + add(Type * item) { GenericFifoList::add((void *)item); } + + Type * +- remove(void) { return (Type *) GenericFifoList::remove(); } ++ remove() { return (Type *) GenericFifoList::remove(); } + } ; + + template <class Type> +@@ -175,10 +181,10 @@ + FifoListIter(FifoList<Type> & list) : GenericFifoListIter(list) {} + FifoListIter(FifoList<Type> * list) : GenericFifoListIter(list) {} + +- virtual ~FifoListIter(void); ++ virtual ~FifoListIter(); + + Type * +- operator()(void) { return (Type *) GenericFifoListIter::operator()(); } ++ operator()() { return (Type *) GenericFifoListIter::operator()(); } + } ; + + template <class Type> +@@ -187,13 +193,31 @@ + FifoListArray(FifoList<Type> & list) : GenericFifoListArray(list) {} + FifoListArray(FifoList<Type> * list) : GenericFifoListArray(list) {} + +- virtual ~FifoListArray(void); ++ virtual ~FifoListArray(); + + Type & +- operator[](unsigned ndx) ++ operator[](unsigned int ndx) + { return *((Type *) GenericFifoListArray::operator[](ndx)); } + } ; + ++template <class Type> ++FifoList<Type>::~FifoList() { ++ GenericFifoListNode * nd = head; ++ head = NULL; ++ while (nd) { ++ GenericFifoListNode * to_delete = nd; ++ nd = nd->next; ++ if (del_items) delete (Type *)to_delete->contents; ++ delete to_delete; ++ } ++} ++ ++template <class Type> ++FifoListIter<Type>::~FifoListIter() {} ++ ++template <class Type> ++FifoListArray<Type>::~FifoListArray() {} ++ + #define DECLARE_FIFO_LIST(Name,Type) \ + typedef FifoList<Type> Name; \ + typedef FifoListIter<Type> name2(Name,Iter); \ +@@ -204,9 +228,9 @@ + #define DECLARE_FIFO_LIST(Name,Type) \ + class Name : public GenericFifoList { \ + public: \ +- Name(void) {} \ ++ Name() {} \ + \ +- virtual ~Name(void) { \ ++ virtual ~Name() { \ + GenericFifoListNode * nd = head; \ + head = 0; \ + while (nd) { \ +@@ -221,7 +245,7 @@ + add(Type * item) { GenericFifoList::add((void *)item); } \ + \ + Type * \ +- remove(void) { return (Type *) GenericFifoList::remove(); } \ ++ remove() { return (Type *) GenericFifoList::remove(); } \ + \ + friend class name2(Name,Iter); \ + } ; \ +@@ -231,10 +255,10 @@ + name2(Name,Iter)(Name & list) : GenericFifoListIter(list) {} \ + name2(Name,Iter)(Name * list) : GenericFifoListIter(list) {} \ + \ +- virtual ~ name2(Name,Iter)(void) {} \ ++ virtual ~ name2(Name,Iter)() {} \ + \ + Type * \ +- operator()(void) { return (Type *) GenericFifoListIter::operator()(); } \ ++ operator()() { return (Type *) GenericFifoListIter::operator()(); } \ + } ; \ + \ + class name2(Name,Array) : public GenericFifoListArray { \ +@@ -242,15 +266,15 @@ + name2(Name,Array)(Name & list) : GenericFifoListArray(list) {} \ + name2(Name,Array)(Name * list) : GenericFifoListArray(list) {} \ + \ +- virtual ~ name2(Name,Array)(void) {} \ ++ virtual ~ name2(Name,Array)() {} \ + \ + Type & \ +- operator[](unsigned ndx) \ ++ operator[](unsigned int ndx) \ + { return *((Type *) GenericFifoListArray::operator[](ndx)); } \ + } + + #endif /* TEMPLATES */ + ++} // namespace cmdline + + #endif /* _fifolist_h */ +- diff --git a/devel/cmdline/patches/patch-be b/devel/cmdline/patches/patch-be new file mode 100644 index 00000000000..49f7209cb93 --- /dev/null +++ b/devel/cmdline/patches/patch-be @@ -0,0 +1,98 @@ +$NetBSD: patch-be,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/parse.c.orig Thu Jan 2 13:33:34 1997 ++++ src/lib/parse.c +@@ -14,24 +14,28 @@ + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added cmd_nargs_parsed field to CmdLine + // - Added exit_handler() and quit() member-functions to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <stdlib.h> +-#include <iostream.h> +-#include <ctype.h> +-#include <string.h> ++#include <cstdlib> ++#include <cstring> ++#include <cctype> ++#include <iostream> + + #include "exits.h" + #include "states.h" +-#include "arglist.h" + #include "cmdline.h" + ++namespace cmdline { + + //------- + // ^FUNCTION: CmdLine::prologue - initialize before parsing + // + // ^SYNOPSIS: +-// unsigned CmdLine::prologue(void) ++// unsigned int CmdLine::prologue() + // + // ^PARAMETERS: + // None. +@@ -55,8 +59,8 @@ + // ^ALGORITHM: + // Follow along - its not too complicated. + //-^^---- +-unsigned +-CmdLine::prologue(void) ++unsigned int ++CmdLine::prologue() + { + // reset parse-specific attributes + cmd_parse_state = cmd_START_STATE ; +@@ -80,7 +84,7 @@ + // ^FUNCTION: CmdLine::epilogue - clean up after parsing + // + // ^SYNOPSIS: +-// unsigned CmdLine::epilogue(void) ++// unsigned int CmdLine::epilogue() + // + // ^PARAMETERS: + // None. +@@ -112,8 +116,8 @@ + // - Print usage if required + // - Exit if required + //-^^---- +-unsigned +-CmdLine::epilogue(void) ++unsigned int ++CmdLine::epilogue() + { + if (cmd_err == NULL) cmd_err = &cerr; + +@@ -167,21 +171,22 @@ + // ^ALGORITHM: + // Trivial - just iterate through calling parse_arg. + //-^^---------------- +-unsigned ++unsigned int + CmdLine::parse(CmdLineArgIter & arg_iter, int auto_processing) + { + // NOTE: If arg_iter.is_temporary() is TRUE then we MUST remember + // to set the CmdLine::TEMP flags before parsing (and put it + // back the way it was when we are finished. + // +- if (auto_processing) (void) prologue(); +- unsigned save_flags = cmd_flags; ++ if (auto_processing) prologue(); ++ unsigned int save_flags = cmd_flags; + if (arg_iter.is_temporary()) cmd_flags |= TEMP; + for (const char * arg = arg_iter() ; arg ; arg = arg_iter()) { +- (void) parse_arg(arg); ++ parse_arg(arg); + } + if (arg_iter.is_temporary()) cmd_flags = save_flags; +- if (auto_processing) (void) epilogue(); ++ if (auto_processing) epilogue(); + return cmd_status ; + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bf b/devel/cmdline/patches/patch-bf new file mode 100644 index 00000000000..98a9435ebbc --- /dev/null +++ b/devel/cmdline/patches/patch-bf @@ -0,0 +1,54 @@ +$NetBSD: patch-bf,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/patchlevel.c.orig Thu Jan 2 13:33:35 1997 ++++ src/lib/patchlevel.c +@@ -21,10 +21,17 @@ + // + // 01/11/94 Brad Appleton <bradapp@enteract.com> + // - Modified for patch 4 ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Modified for patch 5 + //-^^--------------------------------------------------------------------- + + #include "cmdline.h" + ++namespace cmdline { ++ + // Record the version-identifier for this configuration of the project. + // + // My source-code management system lets me use a symbolic-name +@@ -33,24 +40,25 @@ + // file that makes up this version of the project. + // + static const char ident[] = +- "@(#)SMS task: cmdline-1.04" ; ++ "@(#)SMS task: cmdline-1.05" ; + + + // Release and patchlevel information + #define CMDLINE_RELEASE 1 +-#define CMDLINE_PATCHLEVEL 4 +-#define CMDLINE_IDENT "@(#)CmdLine 1.04" ++#define CMDLINE_PATCHLEVEL 5 ++#define CMDLINE_IDENT "@(#)CmdLine 1.05" + + unsigned +-CmdLine::release(void) { return CMDLINE_RELEASE; } ++CmdLine::release() { return CMDLINE_RELEASE; } + + unsigned +-CmdLine::patchlevel(void) { return CMDLINE_PATCHLEVEL; } ++CmdLine::patchlevel() { return CMDLINE_PATCHLEVEL; } + + const char * +-CmdLine::ident(void) { ++CmdLine::ident() { + static const char Ident[] = CMDLINE_IDENT ; + + return Ident; + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bg b/devel/cmdline/patches/patch-bg new file mode 100644 index 00000000000..c8acdaf2509 --- /dev/null +++ b/devel/cmdline/patches/patch-bg @@ -0,0 +1,108 @@ +$NetBSD: patch-bg,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/private.c.orig Thu Jan 2 13:33:34 1997 ++++ src/lib/private.c +@@ -18,20 +18,29 @@ + // + // 03/03/93 Brad Appleton <bradapp@enteract.com> + // - Added exit_handler() and quit() member-functions to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard ++// - Find readline.h in newer versions of readline + //-^^--------------------------------------------------------------------- + +-#include <iostream.h> +-#include <strstream.h> +-#include <fstream.h> +-#include <stdlib.h> +-#include <string.h> +-#include <ctype.h> ++#include <iostream> ++#include <strstream> ++#include <cctype> ++#include <cstdlib> ++#include <cstring> ++#include <cstdio> + + extern "C" { + int isatty(int fd); + + #ifdef GNU_READLINE +-# include <readline.h> ++# ifdef HAVE_READLINE_H ++# include <readline.h> ++# elif HAVE_READLINE_READLINE_H ++# include <readline/readline.h> ++# endif + #endif + + } +@@ -48,8 +57,14 @@ + + #include "cmdline.h" + #include "states.h" +-#include "arglist.h" + ++namespace cmdline { ++ ++using std::cerr; ++using std::cin; ++using std::isupper; ++using std::ostrstream; ++using std::tolower; + + // Need a portable version of tolower + // +@@ -236,7 +251,7 @@ + // ^FUNCTION: CmdLine::prompt_user - prompt the user for a missing argument + // + // ^SYNOPSIS: +-// unsigned CmdLine::prompt_user(cmdarg); ++// unsigned int CmdLine::prompt_user(cmdarg); + // + // ^PARAMETERS: + // CmdArg * cmdarg; +@@ -274,7 +289,7 @@ + // - if an invalid value was given return ARG_MISSING + // - else return 0 + //-^^---- +-unsigned ++unsigned int + CmdLine::prompt_user(CmdArg * cmdarg) + { + // dont prompt if cin or cerr is not interactive +@@ -316,7 +331,7 @@ + // try to handle the value we read (remember - buf is temporary) + if (! errs) { + const char * arg = buf; +- unsigned save_cmd_flags = cmd_flags; ++ unsigned int save_cmd_flags = cmd_flags; + cmd_flags |= TEMP; + errs = handle_arg(cmdarg, arg); + if (errs) { +@@ -387,7 +402,7 @@ + // ^FUNCTION: CmdLine::missing_args - check for missing required arguments + // + // ^SYNOPSIS: +-// unsigned CmdLine::missing_args(void); ++// unsigned int CmdLine::missing_args(void); + // + // ^PARAMETERS: + // +@@ -424,7 +439,7 @@ + // endfor + // return the current cmd-status + //-^^---- +-unsigned ++unsigned int + CmdLine::missing_args(void) + { + char buf[256]; +@@ -649,3 +664,5 @@ + } //for list_iter + return last_pos_list ; + } ++ ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bh b/devel/cmdline/patches/patch-bh new file mode 100644 index 00000000000..76a585e860e --- /dev/null +++ b/devel/cmdline/patches/patch-bh @@ -0,0 +1,40 @@ +$NetBSD: patch-bh,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/states.h.orig Thu Jan 2 13:33:34 1997 ++++ src/lib/states.h +@@ -9,6 +9,9 @@ + // + // ^HISTORY: + // 03/26/92 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline + //-^^--------------------------------------------------------------------- + + #ifndef _states_h +@@ -16,14 +19,16 @@ + + #include "cmdline.h" + ++namespace cmdline { ++ + #ifdef unix_style + // Default command-flags for a unix-command +- static const unsigned DEFAULT_CMDFLAGS = CmdLine::OPTS_FIRST ; ++ static const unsigned int DEFAULT_CMDFLAGS = CmdLine::OPTS_FIRST ; + #endif + + #ifdef vms_style + // Default command-flags for a vms-command +- static const unsigned DEFAULT_CMDFLAGS = CmdLine::TEMP ; ++ static const unsigned int DEFAULT_CMDFLAGS = CmdLine::TEMP ; + #endif + + // +@@ -67,5 +72,6 @@ + #endif + } ; + ++} // namespace cmdline + + #endif /* _states_h */ diff --git a/devel/cmdline/patches/patch-bi b/devel/cmdline/patches/patch-bi new file mode 100644 index 00000000000..4c45c71226e --- /dev/null +++ b/devel/cmdline/patches/patch-bi @@ -0,0 +1,116 @@ +$NetBSD: patch-bi,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/strindent.c.orig Thu Jan 2 13:33:34 1997 ++++ src/lib/strindent.c +@@ -11,11 +11,15 @@ + // + // ^HISTORY: + // 12/05/91 Brad Appleton <bradapp@enteract.com> Created ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^----------------------------------------------------------------------- + +-#include <iostream.h> +-#include <string.h> +-#include <ctype.h> ++#include <iostream> ++#include <cstring> ++#include <cctype> + + #include "cmdline.h" + +@@ -26,6 +30,7 @@ + // + #define TO_LOWER(c) ((isupper(c)) ? tolower(c) : c) + ++namespace cmdline { + + //------- + // ^FUNCTION: strmatch - match a keyword +@@ -40,7 +45,7 @@ + // const char * attempt; + // -- the "candidate" that may or may not match the keyword + // +-// unsigned len; ++// unsigned int len; + // -- the number of character of "attempt" to consider (==0 if all + // characters of "attempt" should be used). + // +@@ -67,9 +72,9 @@ + // else return str_PARTIAL + //-^^---- + CmdLine::strmatch_t +-CmdLine::strmatch(const char * src, const char * attempt, unsigned len) ++CmdLine::strmatch(const char * src, const char * attempt, unsigned int len) + { +- unsigned i; ++ unsigned int i; + + if (src == attempt) return str_EXACT ; + if ((src == NULL) || (attempt == NULL)) return str_NONE ; +@@ -94,16 +99,16 @@ + // ostream & os; + // -- the stream to which output is sent + // +-// unsigned maxcols; ++// unsigned int maxcols; + // -- the maximum width (in characters) of the output + // +-// unsigned margin; ++// unsigned int margin; + // -- the number of spaces to use as the left margin + // + // char * title; + // -- the paragraph title + // +-// unsigned indent; ++// unsigned int indent; + // -- the distance between the title and the paragraph body + // + // char * text; +@@ -134,10 +139,10 @@ + //-^^----------------------------------------------------------------------- + void + CmdLine::strindent(ostream & os, +- unsigned maxcols, +- unsigned margin, ++ unsigned int maxcols, ++ unsigned int margin, + const char * title, +- unsigned indent, ++ unsigned int indent, + const char * text) + { + // If we were given non-sensical parameters then dont use them +@@ -168,9 +173,9 @@ + // Loop through the paragraph text witing to print until we absolutely + // have to. + // +- unsigned col = margin + indent + 1; +- unsigned index = 0 ; +- unsigned last_white = 0 ; ++ unsigned int col = margin + indent + 1; ++ unsigned int index = 0 ; ++ unsigned int last_white = 0 ; + const char * p = text ; + + while (p[index]) { +@@ -291,8 +296,8 @@ + getsym(const char * sym_name) + { + static char sym_value[256]; +- unsigned long stat; +- unsigned short buflen; ++ unsigned int long stat; ++ unsigned int short buflen; + $DESCRIPTOR(sym_name_d, sym_name); + $DESCRIPTOR(sym_value_d, sym_value); + +@@ -309,3 +314,5 @@ + } + + #endif /* vms */ ++ ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bj b/devel/cmdline/patches/patch-bj new file mode 100644 index 00000000000..4a7a67ab3f2 --- /dev/null +++ b/devel/cmdline/patches/patch-bj @@ -0,0 +1,173 @@ +$NetBSD: patch-bj,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/unix.c.orig Thu Jan 2 13:33:35 1997 ++++ src/lib/unix.c +@@ -19,17 +19,26 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added ALLOW_PLUS to list of CmdLine configuration flags ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <iostream.h> +-#include <strstream.h> +-#include <stdlib.h> +-#include <string.h> ++#include <iostream> ++#include <strstream> ++#include <cstdlib> ++#include <cstring> + + #include "exits.h" + #include "cmdline.h" + #include "states.h" + ++namespace cmdline { ++ ++using std::ostream; ++using std::strpbrk; ++ + // + // Some Helper function for getting and recognizing prefixes + // +@@ -42,7 +51,7 @@ + + // Function to return the option-prefix + inline static const char * +-OptionPrefix(void) { return "-" ; } ++OptionPrefix() { return "-" ; } + + + // Function to tell us if an argument looks like a long-option. +@@ -67,14 +76,14 @@ + + // Function to return the "end-of-options" string + inline static const char * +-EndOptions(void) { return "--" ; } ++EndOptions() { return "--" ; } + + + //------- + // ^FUNCTION: CmdLine::parse_option - parse a Unix option + // + // ^SYNOPSIS: +-// unsigned CmdLine::parse_option(arg); ++// unsigned int CmdLine::parse_option(arg); + // + // ^PARAMETERS: + // const char * arg; +@@ -120,11 +129,11 @@ + // endif + // endfor + //-^^---- +-unsigned ++unsigned int + CmdLine::parse_option(const char * arg) + { + const char * save_arg = arg; +- unsigned save_flags = 0, rc = 0 ; ++ unsigned int save_flags = 0, rc = 0 ; + CmdArg * cmdarg = NULL; + int bad_val; + +@@ -242,7 +251,7 @@ + // ^FUNCTION: CmdLine::parse_keyword - parse a Unix keyword + // + // ^SYNOPSIS: +-// unsigned CmdLine::parse_keyword(arg); ++// unsigned int CmdLine::parse_keyword(arg); + // + // ^PARAMETERS: + // const char * arg; +@@ -285,10 +294,10 @@ + // update the state of the argument. + // endif + //-^^---- +-unsigned ++unsigned int + CmdLine::parse_keyword(const char * arg) + { +- unsigned save_flags = 0, rc = 0 ; ++ unsigned int save_flags = 0, rc = 0 ; + CmdArg * cmdarg = NULL ; + int ambiguous = 0, len = -1, bad_val; + const char * val = NULL ; +@@ -412,7 +421,7 @@ + // ^FUNCTION: CmdLine::parse_value - parse a Unix value + // + // ^SYNOPSIS: +-// unsigned CmdLine::parse_value(arg); ++// unsigned int CmdLine::parse_value(arg); + // + // ^PARAMETERS: + // const char * arg; +@@ -448,10 +457,10 @@ + // endif + // handle the given value and update the argument and command states. + //-^^---- +-unsigned ++unsigned int + CmdLine::parse_value(const char * arg) + { +- unsigned save_flags = 0, rc = 0 ; ++ unsigned int save_flags = 0, rc = 0 ; + int bad_val; + CmdArg * cmdarg = NULL; + +@@ -514,7 +523,7 @@ + // ^FUNCTION: CmdLine::parse_arg - parse an argv[] element unix-style + // + // ^SYNOPSIS: +-// unsigned CmdLine::parse_arg(arg) ++// unsigned int CmdLine::parse_arg(arg) + // + // ^PARAMETERS: + // const char * arg; +@@ -552,7 +561,7 @@ + // call parse_value() + // endif + //-^^---- +-unsigned ++unsigned int + CmdLine::parse_arg(const char * arg) + { + if (arg == NULL) return cmd_status ; +@@ -660,7 +669,7 @@ + // ^FUNCTION: CmdLine::fmt_arg - format an argument for usage messages + // + // ^SYNOPSIS: +-// unsigned CmdLine::fmt_arg(cmdarg, buf, bufsize, syntax, level); ++// unsigned int CmdLine::fmt_arg(cmdarg, buf, bufsize, syntax, level); + // + // ^PARAMETERS: + // const CmdArg * cmdarg; +@@ -669,7 +678,7 @@ + // char * buf; + // -- where to print the formatted result + // +-// unsigned bufsize; ++// unsigned int bufsize; + // -- number of bytes allocated for buf. + // + // CmdLine::CmdLineSyntax syntax; +@@ -695,10 +704,10 @@ + // ^ALGORITHM: + // Its kind of tedious so follow along. + //-^^---- +-unsigned ++unsigned int + CmdLine::fmt_arg(const CmdArg * cmdarg, + char * buf, +- unsigned bufsize, ++ unsigned int bufsize, + CmdLine::CmdLineSyntax syntax, + CmdLine::CmdUsageLevel level) const + { +@@ -819,3 +828,4 @@ + return (oss.pcount() - 1) ; + } + ++} // namespace cmdline diff --git a/devel/cmdline/patches/patch-bk b/devel/cmdline/patches/patch-bk new file mode 100644 index 00000000000..50059a22995 --- /dev/null +++ b/devel/cmdline/patches/patch-bk @@ -0,0 +1,76 @@ +$NetBSD: patch-bk,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ + +--- src/lib/usage.c.orig Thu Jan 2 13:33:35 1997 ++++ src/lib/usage.c +@@ -11,15 +11,25 @@ + // + // 03/01/93 Brad Appleton <bradapp@enteract.com> + // - Added cmd_description field to CmdLine ++// ++// 08/16/00 Johnny Lam <lamj@stat.cmu.edu> ++// - Wrapped in namespace cmdline ++// - Updated to follow ISO C++ standard + //-^^--------------------------------------------------------------------- + +-#include <iostream.h> +-#include <stdlib.h> +-#include <string.h> ++#include <iostream> ++#include <cstdlib> ++#include <cstring> + + #include "cmdline.h" + #include "states.h" +-#include "arglist.h" ++ ++namespace cmdline { ++ ++using std::getenv; ++using std::ostream; ++using std::strlen; ++using std::strtol; + + #ifdef vms + # define getenv getsym +@@ -31,7 +41,7 @@ + // ^FUNCTION: CmdLine::get_usage_level + // + // ^SYNOPSIS: +-// CmdLine::CmdUsageLevel CmdLine::get_usage_level(void) ++// CmdLine::CmdUsageLevel CmdLine::get_usage_level() + // + // ^PARAMETERS: + // NONE. +@@ -61,15 +71,15 @@ + // Read the usage_level from the environment and return it. + //-^^---- + CmdLine::CmdUsageLevel +-CmdLine::get_usage_level(void) ++CmdLine::get_usage_level() + { + long level; +- char * end_scan, * level_str = ::getenv("USAGE_LEVEL"); ++ char * end_scan, * level_str = getenv("USAGE_LEVEL"); + + if (level_str == NULL) return VERBOSE_USAGE ; + if (*level_str == '\0') return NO_USAGE ; + +- level = ::strtol(level_str, &end_scan, 0); ++ level = strtol(level_str, &end_scan, 0); + if (end_scan == level_str) return VERBOSE_USAGE ; + + switch(level) { +@@ -127,7 +137,7 @@ + + // first print the command name + os << usg_prefix << cmd_name ; +- ll = (cmd_name ? ::strlen(cmd_name) : 0) + (sizeof(usg_prefix) - 1); ++ ll = (cmd_name ? strlen(cmd_name) : 0) + (sizeof(usg_prefix) - 1); + + // set margin so that we always start printing arguments in a column + // that is *past* the command name. +@@ -322,3 +332,4 @@ + return usage(*cmd_err, usage_level); + } + ++} // namespace cmdline diff --git a/devel/cmdline/pkg/COMMENT b/devel/cmdline/pkg/COMMENT new file mode 100644 index 00000000000..47ae8fbcd52 --- /dev/null +++ b/devel/cmdline/pkg/COMMENT @@ -0,0 +1 @@ +C++ library for parsing command arguments diff --git a/devel/cmdline/pkg/DESCR b/devel/cmdline/pkg/DESCR new file mode 100644 index 00000000000..651bc43c0db --- /dev/null +++ b/devel/cmdline/pkg/DESCR @@ -0,0 +1,3 @@ +This is CmdLine, a C++ library for parsing command arguments and assigning +the corresponding values to program variables. Also included is cmdparse, +a program to provide an interface to CmdLine for shell-scripts. diff --git a/devel/cmdline/pkg/PLIST b/devel/cmdline/pkg/PLIST new file mode 100644 index 00000000000..135ed7a6971 --- /dev/null +++ b/devel/cmdline/pkg/PLIST @@ -0,0 +1,11 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2000/08/25 16:15:54 jlam Exp $ +bin/cmdparse +include/cmdline.h +include/cmdargs.h +include/fifolist.h +lib/libcmdline.a +lib/libcmdline.la +lib/libcmdline.so.0.0 +man/man1/cmdparse.1 +man/man3/cmdline.3 +man/man3/cmdargs.3 |