Debian Codegraph @

terps/tads/tads2/cmd.h

raw symbols SCIP
1 /*
2 $Header: d:/cvsroot/tads/TADS2/CMD.H,v 1.2 1999/05/17 02:52:11 MJRoberts Exp $
3 */
4
5 /*
6 * Copyright (c) 1992, 2002 Michael J. Roberts. All Rights Reserved.
7 *
8 * Please see the accompanying license file, LICENSE.TXT, for information
9 * on using and copying this software.
10 */
11 /*
12 Name
13 cmd.h - interface to command line option service routines
14 Function
15 defines command line option service routine interfaces
16 Notes
17 none
18 Modified
19 04/04/92 MJRoberts - creation
20 */
21
22 #ifndef CMD_INCLUDED
23 #define CMD_INCLUDED
24
25 /*
26 * Get argument to an option. Option can be rammed up against option
27 * letter(s) with no space, or can be separated by a space. argp is a
28 * pointer to the pointer to the current position in the argv[] array;
29 * ip is a pointer to the index in the argv[] array. Both *argpp and
30 * *ip are incremented if the next word must be read. argc is the total
31 * number of arguments. ofs gives the number of characters (NOT
32 * including the '-') in this option flag; most options will have ofs==1
33 * since they are of the form '-x'. usagefn is a function to call if
34 * the parsing fails; it is not expected to return, but should signal an
35 * error instead.
36 */
37 char *cmdarg(struct errcxdef *ec, char ***argpp, int *ip, int argc,
38 int ofs, void (*usagefn)(struct errcxdef*));
39
40
41 /*
42 * Read a toggle argument. prv is the previous value (prior to this
43 * switch) of the parameter (TRUE or FALSE). argp is a pointer to the
44 * current argument word. ofs is the length of this option flag, NOT
45 * including the '-'; most options have ofs==1 since they are of the
46 * form '-x'. If the option is followed by '+', the value returned is
47 * TRUE; if it's followed by '-', the value is FALSE; if followed by
48 * nothing, the option is the logical inverse of the previous value. If
49 * it's followed by any other character, we call the usage callback,
50 * which is not expected to return, but should signal an error.
51 */
52 int cmdtog(struct errcxdef *ec, int prv, char *argp, int ofs,
53 void (*usagefn)(struct errcxdef*));
54
55 #endif /* CMD_INCLUDED */