home *** CD-ROM | disk | FTP | other *** search
- From: brad@amber.ssd.csd.harris.com (Brad Appleton)
- Newsgroups: comp.sources.misc
- Subject: v41i161: cmdline - C++ Library for parsing command-line arguments, Patch04
- Date: 6 Mar 1994 22:58:27 -0600
- Organization: Harris Computer Systems
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2lec9j$ho4@sparky.sterling.com>
- Reply-To: brad@travis.csd.harris.com
- X-Md4-Signature: 3b9547bc42116732c19b423cc7a3d12e
-
- Submitted-by: brad@amber.ssd.csd.harris.com (Brad Appleton)
- Posting-number: Volume 41, Issue 161
- Archive-name: cmdline/patch04
- Environment: C++
- Patch-To: cmdline: Volume 31, Issue 47-54
-
- This is patch-level 4 of "CmdLine": a C++ library for parsing
- command arguments and assigning the corresponding values to program
- variables. "CmdLine" includes "cmdparse", a program to provide an
- interface to CmdLine for shell-scripts.
-
- To apply this patch:
- --------------------
- 0) save this article to a file in your "CmdLine" source directory
-
- 1) "cd" to your CmdLine source directory
-
- 2) Remove all lines in the sharfile (the file you saved in #0)
- that precede the line that starts with "#! /bin/sh".
-
- 3) Run the command "sh sharfile" (or whatever you named your sharfile).
- This will create a file named "PATCH04" in your current directory,
-
- 4) Run "patch -p0 < PATCH04"
-
- For those of you who are unfamiliar with "CmdLine" and "cmdparse",
- an overview is included later on in this article. You can send
- e-mail to me at brad@ssd.csd.harris.com if you want the complete
- C++ source.
-
- Changes in this release:
- ------------------------
-
- - fixed a slight bug in keyword matching which only reared its ugly head
- in unusual situations. The problem was an uninitialized variable.
-
- - removed the PRINT/NOPRINT enum constants to CmdLine::error() use the
- existing constant CmdLine::QUIET instead.
-
- - beefed up some of the comments in the public header files and updated
- the man page with some of the interface changes.
-
- ------------------------------------------------------------------------------
-
-
- An overview of CmdLine and cmdparse
- ===================================
-
- by Brad Appleton <brad@ssd.csd.harris.com>
-
-
-
- Introduction
- ------------
- CmdLine is a C++ Library for parsing command-line arguments. It is
- approximately 2000 lines of C++ code (excluding comments).
-
- Cmdparse is a command-line interface to CmdLine for Unix shell-scripts.
- It is approximately 1200 lines of C++ code (excluding comments).
-
-
- CmdLine(3C++)
- -------------
- CmdLine is a set of classes to parse command-line arguments. Unlike
- getopt() and its variants, CmdLine does more than just split up the
- command-line into some canonical form. CmdLine will actually parse
- the command-line, assigning the appropriate command-line values to
- the corresponding objects, and will verify the command-line syntax
- (and print a usage message if necessary) all in one member function
- call. Furthermore, many features of CmdLine's parsing behavior are
- configurable at run-time. These features include the following:
-
- o Prompting the user for missing arguments.
- o Allowing keywords (-count=4) and/or options (-c4).
- o Ignoring bad syntax instead of terminating.
- o Ignoring upper/lower case on the command-line.
- o Suppressing the printing of syntax error messages.
- o Controlling the verboseness of usage messages.
- o Controlling whether or not options may be processed
- after positional parameters have been seen.
-
- CmdLine also allows for options that take an optional argument, options
- that take a (possibly optional) list of one or more arguments, sticky
- options (options whose argument must reside in the same token as the
- option itself), and options whose argument must reside in a separate
- token from the option itself.
-
- CmdLine consists of a set of C++ classes to parse arguments from an
- input source called a CmdLineArgIter (which is a base class for iterating
- over arguments from an arbitrary input source). Argument iterators are
- defined for an argv[] array (with or without a corresponding argc), for
- a string of tokens that are separated by a given set of delimiters, and
- for an input-stream. Users can easily extend CmdLine to parse arguments
- from other input sources simply by creating their own argument iterator
- classes derived from the CmdLineArgIter class defined in <cmdline.h>.
-
- Command-line arguments are themselves objects that contain a specific
- command-line interface, and a function that performs the desired actions
- when its corresponding argument is seen on the command line. Predefined
- command-line argument types (derived from the abstract class CmdArg in
- <cmdline.h>) exist for boolean, integer, floating-point, character, and
- string arguments, and for lists of integers, floats, and strings. These
- predefined subclasses of CmdArg may be found in <cmdargs.h>. Users can
- also create their own command-argument types on the fly by defining and
- implementing an appropriate subclass of the CmdArg class.
-
- Using CmdLine is relatively easy - you need to construct your arguments,
- your command-line, and your argument iterator. Then all that is left to
- do is call the "parse" member function of your CmdLine object. The
- following is a simple example:
-
- #include <stdlib.h>
- #include <iostream.h>
- #include <cmdargs.h>
-
- int main(int argc, char * argv[])
- {
- // Declare arguments
- CmdArgInt count('c', "count", "number", "number of copies to print.");
- CmdArgBool xflag('x', "xmode", "turn on 'x'-mode.");
- CmdArgChar fdsep('s', "separator", "char", "field-separator to use.");
- CmdArgStr input("input-file", "input file to read.");
- CmdArgStrList output("[output-file ...]", "where to print output.");
-
- // Declare command object and its argument-iterator
- CmdLine cmd(*argv, &count, &xflag, &fdsep, &input, &output, NULL);
- CmdArgvIter arg_iter(--argc, ++argv);
-
- // Initialize arguments to appropriate default values.
- count = 1;
- xflag = 0;
- fdsep = ',';
-
- // Parse arguments
- cmd.parse(arg_iter);
-
- // Print arguments
- cout << "count=" << count << endl ;
- cout << "xflag=" << (xflag ? "ON" : "OFF") << endl ;
- cout << "fdsep='" << (char) fdsep << "'" << endl ;
- cout << "input=\"" << input << "\"" << endl ;
-
- for (int i = 0 ; i < output.count() ; i++) {
- cout << "output[" << i << "]=" << output[i] << endl ;
- }
-
- return 0;
- }
-
-
- The Unix command-line syntax for the above program would be as follows:
-
- Usage: progname [-c number] [-x] [-s char] input-file [output-file ...]
-
- Options/Arguments:
- -c number number of copies to print.
- -x turn on 'x'-mode.
- -s char field-separator to use.
- input-file input file to read.
- output-file ... where to print output.
-
-
- The Unix command-line syntax using long-options (keywords) for the above
- program would be as follows:
-
- Usage: progname [--count number] [--xmode] [--separator char]
- input-file [output-file ...]
-
- Options/Arguments:
- --count number number of copies to print.
- --xmode turn on 'x'-mode.
- --separator char field-separator to use.
- input-file input file to read.
- output-file ... where to print output.
-
- If desired, one can set a configuration flag at run-time to allow "+"
- to also be recognized (in addition to "--") as a long-option prefix.
-
- By default, CmdLine allows both options and long-options to appear on the
- command-line. You can instruct CmdLine to disallow one or the other however.
- As an "extra", when options are disallowed, the "-" prefix is assumed to
- denote a long-option instead of an option (hence either "-" or "--" denotes
- a keyword in this case). Using this feature, CmdLine can be used to supply
- the type of long-option syntax that is now becoming quite popular in the
- Unix world. Using this "new" syntax, the command-line syntax for the above
- command would be the following:
-
- Usage: progname [-count number] [-xmode] [-separator char]
- input-file [output-file ...]
-
- Options/Arguments:
- -count number number of copies to print.
- -xmode turn on 'x'-mode.
- -separator char field-separator to use.
- input-file input file to read.
- output-file ... where to print output.
-
-
- It should be mentioned that, when long-options are used, only a unique
- prefix of the keyword needs to be given (and character-case is ignored).
- Hence, in the above example, "-x", "-X", and "-xm" will match "-xmode".
-
-
- cmdparse(1)
- -----------
- Using "cmdparse" is even easier than using CmdLine. You declare your
- arguments in a string and then you invoke cmdparse with the command
- line of your shell-script and cmdparse will output a script of variable
- settings for you to evaluate. The following is an example (using the
- same arguments as in our sample program):
-
- #!/bin/sh
- NAME="`/bin/basename $0`"
-
- ARGS='
- ArgInt count "[c|count number]" "number of copies to print."
- ArgBool xflag "[x|xmode]" "turn on x-mode."
- ArgChar fdsep "[s|separator char]" "field-separator to use."
- ArgStr input "input-file" "input file to read."
- ArgStr output "[output-file ...]" "where to print output."
- '
-
- if cmdparse -shell=sh -decls="$ARGS" -- $NAME "$@" > tmp$$
- then
- . tmp$$
- /bin/rm -f tmp$$
- else
- EXITVAL=$?
- /bin/rm -f tmp$$
- exit $EXITVAL
- fi
-
- echo "xflag=" $xflag
- echo "count=" $count
- echo "fdsep=" $fdsep
- echo "input=" $input
- if [ "$output" ] ; then
- echo "output=" $output
- fi
-
-
- Note that you declare the syntax of an argument differently for cmdparse
- than for CmdLine. The syntax for a single argument for cmdparse looks like
- the following:
-
- <arg-type> <arg-name> <syntax> <description>
-
- Where <arg-type> is one of the following:
-
- ArgInt -- an integer value (or list of values)
- ArgFloat -- a floating-point value (or list of values)
- ArgChar -- a character value (or list of values)
- ArgStr -- a string value (or list of values)
- ArgBool -- a boolean flag that is turned ON
- ArgClear -- a boolean flag that is turned OFF
- ArgToggle -- a boolean flag that is toggled
- ArgUsage -- print usage and exit
- ArgDummy -- a dummy argument
-
- If desired, the leading "Arg" portion may be omitted from the type-name.
-
- <arg-name> is simply the name of the variable in your script that you wish
- to contain the resultant value from the command-line. Any default value
- must be assigned to the variable before invoking cmdparse.
-
- <syntax> and <description> *MUST* be enclosed in either single or double
- quotes! <description> is simply that, the description of the argument.
-
- <syntax> is a little trickier, there are three basic forms of syntax:
-
- 1) "c|keyword" -- an option that takes no value
- 2) "c|keyword value" -- an option that takes a value
- 3) "value" -- a positional parameter
-
- Note that the option-character MUST precede the keyword-name and that
- there must be NO spaces surrounding the '|' in "c|keyword"!
-
- Any "optional" parts of the argument should appear inside square-brackets
- ('[' and ']') and a list of values is denoted by an ellipsis (" ...").
- Most options will be inside of square brackets to reflect the fact that
- they are "optional".
-
- Some example <syntax> strings follow:
-
- "c|keyword" -- a required option
- "[c|keyword]" -- an option with no value
- "[c|keyword value]" -- an option that takes a value
- "[c|keyword [value]]" -- an option that takes an optional value
- "[c|keyword value ...]" -- an option that takes 1 or more values
- "[c|keyword [value ...]]" -- an option that takes 0 or more values
- "value" -- a required positional parameter
- "[value]" -- an optional positional-parameter
- "[c|keyword] value" -- a required argument that may be matched
- either positionally or by keyword!
-
-
- Further Information
- -------------------
- This is just a brief overview of what the CmdLine package can do. Please
- read the documentation for a more thorough explanation of this products'
- capabilities and limitations!
-
- _______________________"And miles to go before I sleep."_______________________
- Brad Appleton, Senior Software Engineer Harris Computer Systems Division
- E-mail: brad@ssd.csd.harris.com 2101 W. Cypress Creek Rd., M/S 161
- Phone : (305) 973-5190 Fort Lauderdale, FL USA 33309-1892
- ~~~~~~~~~~~~~~~~~~~~Disclaimer: I said it, not my employer!~~~~~~~~~~~~~~~~~~~~
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: PATCH04
- # Wrapped by brad@amber on Tue Mar 1 18:27:10 1994
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'PATCH04' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'PATCH04'\"
- else
- echo shar: Extracting \"'PATCH04'\" \(16575 characters\)
- sed "s/^X//" >'PATCH04' <<'END_OF_FILE'
- X*** Overview.OLD Tue Mar 01 18:25:50 1994
- X--- Overview Fri Feb 04 15:12:19 1994
- X***************
- X*** 22,28 ****
- X getopt() and its variants, CmdLine does more than just split up the
- X command-line into some canonical form. CmdLine will actually parse
- X the command-line, assigning the appropriate command-line values to
- X! the corresponding variables, and will verify the command-line syntax
- X (and print a usage message if necessary) all in one member function
- X call. Furthermore, many features of CmdLine's parsing behavior are
- X configurable at run-time. These features include the following:
- X--- 22,28 ----
- X getopt() and its variants, CmdLine does more than just split up the
- X command-line into some canonical form. CmdLine will actually parse
- X the command-line, assigning the appropriate command-line values to
- X! the corresponding objects, and will verify the command-line syntax
- X (and print a usage message if necessary) all in one member function
- X call. Furthermore, many features of CmdLine's parsing behavior are
- X configurable at run-time. These features include the following:
- X***************
- X*** 225,231 ****
- X
- X <syntax> is a little trickier, there are three basic forms of syntax:
- X
- X! 1) "c|keyword" -- an option the takes no value
- X 2) "c|keyword value" -- an option that takes a value
- X 3) "value" -- a positional parameter
- X
- X--- 225,231 ----
- X
- X <syntax> is a little trickier, there are three basic forms of syntax:
- X
- X! 1) "c|keyword" -- an option that takes no value
- X 2) "c|keyword value" -- an option that takes a value
- X 3) "value" -- a positional parameter
- X
- X*** README.OLD Tue Mar 01 18:25:53 1994
- X--- README Tue Mar 01 18:24:21 1994
- X***************
- X*** 130,136 ****
- X
- X ACKNOWLEDGEMENTS
- X ================
- X! CmdLine is a C++ rewrite of ParseArgs. The author of this software would
- X like to thank Eric Allman and Peter da Silva for their great ideas.
- X
- X
- X--- 130,136 ----
- X
- X ACKNOWLEDGEMENTS
- X ================
- X! CmdLine is a C++ re-design of ParseArgs. The author of this software would
- X like to thank Eric Allman and Peter da Silva for their great ideas.
- X
- X
- X***************
- X*** 139,147 ****
- X For an introduction -- look at the file "Overview" in the distribution!
- X
- X The documentation is in Unix manpage format (troff with the -man macros)
- X! and may be found in the "doc" directory but you should be able to find
- X! out quite a bit by reading the comments in the source files (especially
- X! in <cmdline.h> and <cmdargs.h>) and by looking at the sample test-program(s).
- X
- X
- X HISTORY
- X--- 139,150 ----
- X For an introduction -- look at the file "Overview" in the distribution!
- X
- X The documentation is in Unix manpage format (troff with the -man macros)
- X! and may be found in the "doc" directory. The man-pages only cover the most
- X! commonly used features. If you want to become an advanced user or gain a
- X! more thorough understanding of the package you should read the header files
- X! <cmdline.h> and <cmdargs.h>. Ample comments are provided particularly for
- X! this purpose. There is also a test-program provided which tests most of
- X! the features of the package.
- X
- X
- X HISTORY
- X***************
- X*** 211,216 ****
- X--- 214,220 ----
- X 10/26/93 Brad Appleton <brad@ssd.csd.harris.com>
- X -----------------------------------------------------------------------------
- X - documented "secret" arguments in cmdparse(1)
- X+
- X - fixed the following bug:
- X CmdLine did not properly handle an "interrupted" positional-list.
- X For example, If I have a program whose syntax is:
- X***************
- X*** 225,228 ****
- X--- 229,243 ----
- X CmdLine was not correctly recognizing that "arg2" was part of
- X the the previously specified positional list. This has been
- X fixed!
- X+
- X+ 02/10/94 Brad Appleton <brad@ssd.csd.harris.com>
- X+ -----------------------------------------------------------------------------
- X+ - fixed a slight bug in keyword matching which only reared its ugly head
- X+ in unusual situations. The problem was an uninitialized variable.
- X+
- X+ - removed the PRINT/NOPRINT enum constants to CmdLine::error() use the
- X+ existing constant CmdLine::QUIET instead.
- X+
- X+ - beefed up some of the comments in the public header files and updated
- X+ the man page with some of the interface changes.
- X
- X*** doc/classes.man.OLD Tue Mar 01 18:25:58 1994
- X--- doc/classes.man Thu Feb 10 11:23:27 1994
- X***************
- X*** 350,358 ****
- X .sp 2p
- X OPTS_FIRST = 0x008, // No options after positional parameters
- X .sp 2p
- X! OPTS_ONLY = 0x010, // Don't accept short-options
- X .sp 2p
- X! KWDS_ONLY = 0x020, // Don't accept long-options
- X .sp 2p
- X TEMP = 0x040, // Assume all arg-strings are temporary
- X .sp 2p
- X--- 350,358 ----
- X .sp 2p
- X OPTS_FIRST = 0x008, // No options after positional parameters
- X .sp 2p
- X! OPTS_ONLY = 0x010, // Don't accept long-options
- X .sp 2p
- X! KWDS_ONLY = 0x020, // Don't accept short-options
- X .sp 2p
- X TEMP = 0x040, // Assume all arg-strings are temporary
- X .sp 2p
- X***************
- X*** 363,368 ****
- X--- 363,371 ----
- X // when we see an unmatched option,
- X // we will try to see if it matches
- X // a keyword (and vice-versa).
- X+ .sp 2p
- X+ ALLOW_PLUS = 0x200, // Allow "+" (as well as "--") as a prefix
- X+ // indicating long-options.
- X } ;
- X
- X // Get the current set of command-flags
- X*** src/cmd/syntax.c.OLD Tue Mar 01 18:26:14 1994
- X--- src/cmd/syntax.c Thu Feb 17 09:44:12 1994
- X***************
- X*** 31,37 ****
- X // const char * & dest;
- X // -- where to house the duplicated token
- X //
- X! // SyntaxFSM::token_t src;
- X // -- the token to copy.
- X //
- X // ^DESCRIPTION:
- X--- 31,37 ----
- X // const char * & dest;
- X // -- where to house the duplicated token
- X //
- X! // const SyntaxFSM::token_t & src;
- X // -- the token to copy.
- X //
- X // ^DESCRIPTION:
- X***************
- X*** 50,56 ****
- X // Trivial.
- X //-^^----------------
- X void
- X! copy_token(const char * & dest, SyntaxFSM::token_t src)
- X {
- X char * tok = new char[src.len + 1] ;
- X ::strncpy(tok, src.start, src.len);
- X--- 50,56 ----
- X // Trivial.
- X //-^^----------------
- X void
- X! copy_token(const char * & dest, const SyntaxFSM::token_t & src)
- X {
- X char * tok = new char[src.len + 1] ;
- X ::strncpy(tok, src.start, src.len);
- X*** src/lib/argiter.c.OLD Tue Mar 01 18:26:18 1994
- X--- src/lib/argiter.c Thu Feb 10 14:33:25 1994
- X***************
- X*** 107,112 ****
- X--- 107,118 ----
- X delete tok_iter;
- X }
- X
- X+ #ifdef vms
- X+ enum { c_COMMENT = '#' } ;
- X+ #else
- X+ enum { c_COMMENT = '!' } ;
- X+ #endif
- X+
- X // Iterator function -- operator()
- X //
- X // What we do is this: for each line of text in the istream, we use
- X***************
- X*** 129,135 ****
- X is.getline(buf, sizeof(buf));
- X char * ptr = buf;
- X while (isspace(*ptr)) ++ptr;
- X! if (*ptr && (*ptr != CmdIstreamIter::c_COMMENT)) {
- X if (tok_iter) {
- X tok_iter->reset(ptr);
- X } else {
- X--- 135,141 ----
- X is.getline(buf, sizeof(buf));
- X char * ptr = buf;
- X while (isspace(*ptr)) ++ptr;
- X! if (*ptr && (*ptr != c_COMMENT)) {
- X if (tok_iter) {
- X tok_iter->reset(ptr);
- X } else {
- X*** src/lib/cmdargs.h.OLD Tue Mar 01 18:26:23 1994
- X--- src/lib/cmdargs.h Fri Feb 11 16:46:47 1994
- X***************
- X*** 141,147 ****
- X
- X // Look under "List Arguments" for a CmdArg that is a list of ints
- X
- X! // CmdArgIntCompiler is the base class for all arguments need to
- X // convert the string given on the command-line into an integer.
- X //
- X class CmdArgIntCompiler : public CmdArg {
- X--- 141,147 ----
- X
- X // Look under "List Arguments" for a CmdArg that is a list of ints
- X
- X! // CmdArgIntCompiler is the base class for all arguments that need to
- X // convert the string given on the command-line into an integer.
- X //
- X class CmdArgIntCompiler : public CmdArg {
- X*** src/lib/cmdline.c.OLD Tue Mar 01 18:26:27 1994
- X--- src/lib/cmdline.c Thu Feb 10 14:45:06 1994
- X***************
- X*** 285,294 ****
- X // Print an error message prefix and return a reference to the
- X // error output stream for this command
- X ostream &
- X! CmdLine::error(int print) const
- X {
- X ostream * os = (cmd_err) ? cmd_err : &cerr ;
- X! if (print && cmd_name && *cmd_name) *os << cmd_name << ": " ;
- X return *os;
- X }
- X
- X--- 285,294 ----
- X // Print an error message prefix and return a reference to the
- X // error output stream for this command
- X ostream &
- X! CmdLine::error(unsigned quiet) const
- X {
- X ostream * os = (cmd_err) ? cmd_err : &cerr ;
- X! if (cmd_name && *cmd_name && !quiet) *os << cmd_name << ": " ;
- X return *os;
- X }
- X
- X*** src/lib/cmdline.h.OLD Tue Mar 01 18:26:31 1994
- X--- src/lib/cmdline.h Fri Feb 11 16:48:53 1994
- X***************
- X*** 99,107 ****
- X //
- X // Some examples:
- X //
- X! // CmdArg('c', "count", "number", "specify the # of copies to use);
- X //
- X! // CmdArg('d', "debug", "[level]". "turn on debugging and optionally"
- X // "specify the debug level");
- X //
- X // CmdArg('l', "list", "items ...", "specify a list of items.");
- X--- 99,107 ----
- X //
- X // Some examples:
- X //
- X! // CmdArg('c', "count", "number", "specify the # of copies to use");
- X //
- X! // CmdArg('d', "debug", "[level]", "turn on debugging and optionally "
- X // "specify the debug level");
- X //
- X // CmdArg('l', "list", "items ...", "specify a list of items.");
- X***************
- X*** 197,203 ****
- X // After we have done our "magic" and set the reference parameter
- X // "arg", this function should return a value of 0 if everything
- X // is A-OK and "arg" was a correctly specified value for this type of
- X! // of argument. If something went wrong (like a syntax error in "arg"),
- X // then we should return a non-zero value.
- X //
- X virtual int
- X--- 197,203 ----
- X // After we have done our "magic" and set the reference parameter
- X // "arg", this function should return a value of 0 if everything
- X // is A-OK and "arg" was a correctly specified value for this type of
- X! // argument. If something went wrong (like a syntax error in "arg"),
- X // then we should return a non-zero value.
- X //
- X virtual int
- X***************
- X*** 413,424 ****
- X public:
- X static const unsigned MAX_LINE_LEN ;
- X
- X- #ifdef vms
- X- enum { c_COMMENT = '!' } ;
- X- #else
- X- enum { c_COMMENT = '#' } ;
- X- #endif
- X-
- X CmdIstreamIter(istream & input);
- X
- X virtual ~CmdIstreamIter(void);
- X--- 413,418 ----
- X***************
- X*** 455,462 ****
- X PROMPT_USER = 0x002, // Prompt the user for missing required args
- X NO_ABORT = 0x004, // Dont quit upon syntax error
- X OPTS_FIRST = 0x008, // No options after positional parameters
- X! OPTS_ONLY = 0x010, // Dont accept short-options
- X! KWDS_ONLY = 0x020, // Dont accept long-options
- X TEMP = 0x040, // Assume all arg-strings are temporary
- X QUIET = 0x080, // Dont print syntax error messages
- X NO_GUESSING = 0x100, // Dont guess if cant match an option.
- X--- 449,456 ----
- X PROMPT_USER = 0x002, // Prompt the user for missing required args
- X NO_ABORT = 0x004, // Dont quit upon syntax error
- X OPTS_FIRST = 0x008, // No options after positional parameters
- X! OPTS_ONLY = 0x010, // Dont accept long-options
- X! KWDS_ONLY = 0x020, // Dont accept short-options
- X TEMP = 0x040, // Assume all arg-strings are temporary
- X QUIET = 0x080, // Dont print syntax error messages
- X NO_GUESSING = 0x100, // Dont guess if cant match an option.
- X***************
- X*** 578,590 ****
- X //
- X // my_cmd.error() << "This is what went wrong!" << endl;
- X //
- X! // If NOPRINT is given as a parameter, then nothing
- X! // is printed.
- X //
- X- enum { NOPRINT = 0, PRINT = 1 } ;
- X-
- X ostream &
- X! error(int print =PRINT) const;
- X
- X // If the QUIET-flag is not set, then we need to know where
- X // to print any error messages (the default is cerr).
- X--- 572,584 ----
- X //
- X // my_cmd.error() << "This is what went wrong!" << endl;
- X //
- X! // If QUIET (or for that matter, any non-zero value) is given
- X! // as a parameter, then nothing is printed on the ostream
- X! // (which may be useful if you wish only to obtain a reference
- X! // this CmdLine's error-outstream).
- X //
- X ostream &
- X! error(unsigned quiet =0) const;
- X
- X // If the QUIET-flag is not set, then we need to know where
- X // to print any error messages (the default is cerr).
- X***************
- X*** 672,681 ****
- X
- X typedef void (* quit_func_t)(int);
- X
- X! // When a fatal error is encounteredi or when parsing needs to
- X // terminate immediately, the quit() member function is called.
- X // If the programmer has used quit_handler() to setup his own
- X! // handler-function, that that function is called; otherwise
- X // exit() is called with the given status.
- X //
- X void
- X--- 666,675 ----
- X
- X typedef void (* quit_func_t)(int);
- X
- X! // When a fatal error is encountered or when parsing needs to
- X // terminate immediately, the quit() member function is called.
- X // If the programmer has used quit_handler() to setup his own
- X! // handler-function, then that function is called; otherwise
- X // exit() is called with the given status.
- X //
- X void
- X***************
- X*** 749,755 ****
- X strmatch(const char * src, const char * attempt, unsigned len =0);
- X
- X // Print a hanging indented paragraph on an outstream. Long lines
- X! // are broken at word boundaries and are warpped to line up with
- X // the rest of the paragraph. The format looks like the following
- X // (text starts on a new line is the strlen(title) >= indent):
- X //
- X--- 743,749 ----
- X strmatch(const char * src, const char * attempt, unsigned len =0);
- X
- X // Print a hanging indented paragraph on an outstream. Long lines
- X! // are broken at word boundaries and are wrapped to line up with
- X // the rest of the paragraph. The format looks like the following
- X // (text starts on a new line is the strlen(title) >= indent):
- X //
- X*** src/lib/patchlevel.c.OLD Tue Mar 01 18:26:38 1994
- X--- src/lib/patchlevel.c Tue Jan 11 10:49:01 1994
- X***************
- X*** 18,23 ****
- X--- 18,26 ----
- X //
- X // 10/08/93 Brad Appleton <brad@ssd.csd.harris.com>
- X // - Modified for patch 3
- X+ //
- X+ // 01/11/94 Brad Appleton <brad@ssd.csd.harris.com>
- X+ // - Modified for patch 4
- X //-^^---------------------------------------------------------------------
- X
- X #include "cmdline.h"
- X***************
- X*** 30,42 ****
- X // file that makes up this version of the project.
- X //
- X static const char ident[] =
- X! "@(#)SMS task: cmdline-1.03" ;
- X
- X
- X // Release and patchlevel information
- X #define CMDLINE_RELEASE 1
- X! #define CMDLINE_PATCHLEVEL 3
- X! #define CMDLINE_IDENT "@(#)CmdLine 1.03"
- X
- X unsigned
- X CmdLine::release(void) { return CMDLINE_RELEASE; }
- X--- 33,45 ----
- X // file that makes up this version of the project.
- X //
- X static const char ident[] =
- X! "@(#)SMS task: cmdline-1.04" ;
- X
- X
- X // Release and patchlevel information
- X #define CMDLINE_RELEASE 1
- X! #define CMDLINE_PATCHLEVEL 4
- X! #define CMDLINE_IDENT "@(#)CmdLine 1.04"
- X
- X unsigned
- X CmdLine::release(void) { return CMDLINE_RELEASE; }
- X*** src/lib/private.c.OLD Tue Mar 01 18:26:41 1994
- X--- src/lib/private.c Tue Jan 11 10:49:21 1994
- X***************
- X*** 580,586 ****
- X if (cmdarg->is_dummy()) continue;
- X
- X // attempt to match this keyword
- X! strmatch_t result ;
- X const char * source = cmdarg->keyword_name();
- X if (source && *source) {
- X result = strmatch(source, kwd, len) ;
- X--- 580,586 ----
- X if (cmdarg->is_dummy()) continue;
- X
- X // attempt to match this keyword
- X! strmatch_t result = str_NONE ;
- X const char * source = cmdarg->keyword_name();
- X if (source && *source) {
- X result = strmatch(source, kwd, len) ;
- END_OF_FILE
- if test 16575 -ne `wc -c <'PATCH04'`; then
- echo shar: \"'PATCH04'\" unpacked with wrong size!
- fi
- # end of 'PATCH04'
- fi
- echo shar: End of shell archive.
- exit 0
-
- exit 0 # Just in case...
-