home *** CD-ROM | disk | FTP | other *** search
- .\"----------------------------------------------------------------------------
- .\"-- This text was extracted using the following command:
- .\"-- xdoc -man -p '[ \t]*' -s CMD-MACROS ../parseargs.h
- .\"----------------------------------------------------------------------------
- .SH "CMD MACROS"
- \f4<parseargs.h>\fP defines a set of macros to allow a more "self documenting"
- approach to declaring argument-descriptor arrays. The "old-style" is
- still accepted (but if used it is recommended that the \s-1STARTOFARGS\s+1
- macro is used in conjunction with \s-1ENDOFARGS\s+1).
- An example use of these macros (which, with one exception, all begin with
- ``\s-1CMD\s+1'') follows:
- .RS
- .nf
- .ft 4
- #include <parseargs.h>
-
- static BOOL bflag = FALSE;
- static char *arg1 = CHARNULL;
- static char *arg2 = CHARNULL;
-
- static
- CMD_OBJECT
- MyCmd
-
- CMD_NAME
- "mycmd -- one line statement of purpose"
-
- CMD_DESCRIPTION
- "Mycmd will try really really hard to run without errors \\
- and do whatever the heck it is supposed to do. If (God forbid) \\
- something should actually go wrong it will say so."
-
- CMD_ARGUMENTS
- 'H', ARGOPT, argUsage, __ NULL,
- "Help -- display usage and quit",
-
- 'b', ARGOPT, argSBool, __ &bflag,
- "bflag -- turn on `b'-mode (whatever that is)",
-
- ' ', ARGREQ, argStr, __ &arg1,
- "arg1 -- first argument to this spiffy program",
-
- ' ', ARGOPT, argStr, __ &arg2,
- "arg2 -- optional second argument to this spiffy program",
-
- END_ARGUMENTS
- CMD_END
-
- main( int argc, char *argv[] )
- {
- (void) parseargs( argv, MyCmd );
- (void) dostuff();
- exit( 0 );
- }
- .ft R
- .fi
- .RE
-