/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#define CMD_FLAG 1 /* no parms */
#define CMD_SINGLE 2 /* one parm */
#define CMD_LIST 3 /* two parms */
+#define CMD_SINGLE_OR_FLAG 4 /* one parm or flag */
/* syndesc flags */
#define CMD_ALIAS 1 /* this is an alias */
struct cmd_item *items; /* list of cmd items */
afs_int32 flags; /* flags */
char *help; /* optional help descr */
+ struct cmd_item *aliases; /* optional aliases */
};
/* cmd_parmdesc flags */
char *name; /* subcommand name */
char *a0name; /* command name from argv[0] */
char *help; /* help description */
- int (*proc) (struct cmd_syndesc * ts, char *arock);
- char *rock;
+ int (*proc) (struct cmd_syndesc * ts, void *arock);
+ void *rock;
int nParms; /* number of parms */
afs_int32 flags; /* random flags */
struct cmd_parmdesc parms[CMD_MAXPARMS]; /* parms themselves */
extern struct cmd_syndesc *cmd_CreateSyntax(char *namep,
int (*aprocp) (struct cmd_syndesc
- * ts, char *arock),
- char *rockp, char *helpp);
+ * ts, void *arock),
+ void *rockp, char *helpp);
extern int
- cmd_SetBeforeProc(int (*aproc) (struct cmd_syndesc * ts, char *beforeRock),
- char *arock);
+ cmd_SetBeforeProc(int (*aproc) (struct cmd_syndesc * ts, void *beforeRock),
+ void *arock);
extern int
- cmd_SetAfterProc(int (*aproc) (struct cmd_syndesc * ts, char *afterRock),
- char *arock);
+ cmd_SetAfterProc(int (*aproc) (struct cmd_syndesc * ts, void *afterRock),
+ void *arock);
extern int cmd_CreateAlias(struct cmd_syndesc *as, char *aname);
extern int cmd_Seek(struct cmd_syndesc *as, int apos);
extern int cmd_AddParm(struct cmd_syndesc *as, char *aname, int atype,
afs_int32 aflags, char *ahelp);
+extern int cmd_AddParmAtOffset(struct cmd_syndesc *as, char *name, int atype,
+ afs_int32 aflags, char *ahelp, int ref);
+extern int cmd_AddParmAlias(struct cmd_syndesc *as, int pos, char *alias);
extern int cmd_Dispatch(int argc, char **argv);
extern int cmd_FreeArgv(char **argv);
extern int cmd_ParseLine(char *aline, char **argv, afs_int32 * an,
afs_int32 amaxn);
-extern int cmd_IsAdministratorCommand(register struct cmd_syndesc *as);
-extern void PrintSyntax(register struct cmd_syndesc *as);
-extern void PrintFlagHelp(register struct cmd_syndesc *as);
+extern int cmd_IsAdministratorCommand(struct cmd_syndesc *as);
+extern void cmd_DisablePositionalCommands(void);
+extern void cmd_DisableAbbreviations(void);
+extern void PrintSyntax(struct cmd_syndesc *as);
+extern void PrintFlagHelp(struct cmd_syndesc *as);
+
+extern int cmd_Parse(int argc, char **argv, struct cmd_syndesc **outsyntax);
+extern void cmd_FreeOptions(struct cmd_syndesc **ts);
+extern int cmd_OptionAsInt(struct cmd_syndesc *syn, int pos, int *value);
+extern int cmd_OptionAsUint(struct cmd_syndesc *, int, unsigned int *);
+extern int cmd_OptionAsString(struct cmd_syndesc *syn, int pos, char **value);
+extern int cmd_OptionAsList(struct cmd_syndesc *syn, int pos, struct cmd_item **);
+extern int cmd_OptionAsFlag(struct cmd_syndesc *syn, int pos, int *value);
+extern int cmd_OptionPresent(struct cmd_syndesc *syn, int pos);
#endif /* __CMD_INCL__ */