2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #define __CMD_INCL__ 1
12 #include <afs/param.h>
15 #define CMD_FLAG 1 /* no parms */
16 #define CMD_SINGLE 2 /* one parm */
17 #define CMD_LIST 3 /* two parms */
20 #define CMD_ALIAS 1 /* this is an alias */
21 #define CMD_ADMIN 2 /* admin. command, show only with -admin */
22 #define CMD_HIDDEN 4 /* A hidden command - similar to CMD_HIDE */
24 #define CMD_HELPPARM (CMD_MAXPARMS-1)/* last one is used by -help switch */
25 #define CMD_MAXPARMS 64 /* max number of parm types to a cmd line */
27 /* parse items are here */
29 struct cmd_item *next;
34 char *name; /* switch name */
35 int type; /* flag, single or list */
36 struct cmd_item *items; /* list of cmd items */
37 afs_int32 flags; /* flags */
38 char *help; /* optional help descr */
41 /* cmd_parmdesc flags */
42 #define CMD_REQUIRED 0
43 #define CMD_OPTIONAL 1
44 #define CMD_EXPANDS 2 /* if list, try to eat tokens through eoline, instead of just 1 */
45 #define CMD_HIDE 4 /* A hidden option */
46 #define CMD_PROCESSED 8
49 struct cmd_syndesc *next; /* next one in system list */
50 struct cmd_syndesc *nextAlias; /* next in alias chain */
51 struct cmd_syndesc *aliasOf; /* back ptr for aliases */
52 char *name; /* subcommand name */
53 char *a0name; /* command name from argv[0] */
54 char *help; /* help description */
57 int nParms; /* number of parms */
58 afs_int32 flags; /* random flags */
59 struct cmd_parmdesc parms[CMD_MAXPARMS]; /* parms themselves */
62 extern struct cmd_syndesc *cmd_CreateSyntax(
69 extern cmd_SetBeforeProc(
74 extern cmd_SetAfterProc(
79 extern int cmd_CreateAlias(
80 struct cmd_syndesc *as,
85 struct cmd_syndesc *as,
89 extern int cmd_AddParm(
90 struct cmd_syndesc *as,
106 extern cmd_ParseLine(
113 #endif /* __CMD_INCL__ */