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
10 #include <afsconfig.h>
11 #include <afs/param.h>
18 cproc1(struct cmd_syndesc
*as
, void *arock
)
20 printf("in the apple command\n");
25 cproc2(struct cmd_syndesc
*as
, void *arock
)
28 printf("in the pear command\n");
29 printf("number is %s\n", as
->parms
[0].items
->data
);
30 if (as
->parms
[1].items
)
31 printf("running unauthenticated\n");
32 for (ti
= as
->parms
[2].items
; ti
; ti
= ti
->next
) {
33 printf("spotspos %s\n", ti
->data
);
35 if (as
->parms
[8].items
)
36 printf("cell name %s\n", as
->parms
[8].items
->data
);
41 main(int argc
, char **argv
)
43 struct cmd_syndesc
*ts
;
45 ts
= cmd_CreateSyntax("apple", cproc1
, NULL
, 0, "describe apple");
46 cmd_CreateAlias(ts
, "appl");
48 ts
= cmd_CreateSyntax("pear", cproc2
, NULL
, 0, "describe pear");
49 cmd_AddParm(ts
, "-num", CMD_LIST
, 0, "number of pears");
50 cmd_AddParm(ts
, "-noauth", CMD_FLAG
, CMD_OPTIONAL
, "don't authenticate");
51 cmd_AddParm(ts
, "-spotpos", CMD_LIST
, CMD_OPTIONAL
| CMD_EXPANDS
, 0);
53 cmd_AddParm(ts
, "-cell", CMD_SINGLE
, CMD_OPTIONAL
, "cell name");
54 cmd_CreateAlias(ts
, "alias");
56 return cmd_Dispatch(argc
, argv
);