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>
19 static cproc1 (as, arock)
21 struct cmd_syndesc *as; {
22 printf("in the apple command\n");
26 static cproc2 (as, arock)
28 struct cmd_syndesc *as; {
29 register struct cmd_item *ti;
30 printf("in the pear command\n");
31 printf("number is %s\n", as->parms[0].items->data);
32 if (as->parms[1].items) printf("running unauthenticated\n");
33 for(ti=as->parms[2].items; ti; ti=ti->next) {
34 printf("spotspos %s\n", ti->data);
36 if (as->parms[8].items)
37 printf("cell name %s\n", as->parms[8].items->data);
41 static void cproc3(as, arock)
43 struct cmd_syndesc *as; {
50 register struct cmd_syndesc *ts;
57 initialize_cmd_error_table();
59 ts = cmd_CreateSyntax("apple", cproc1, (char *) 0, "describe apple");
61 ts = cmd_CreateSyntax("pear", cproc2, (char *) 0, "describe pear");
62 cmd_AddParm(ts, "-num", CMD_LIST, 0, "number of pears");
63 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");
64 cmd_AddParm(ts, "-spotpos", CMD_LIST, CMD_OPTIONAL | CMD_EXPANDS, 0);
66 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
67 cmd_CreateAlias(ts, "alias");
69 ts = cmd_CreateSyntax("quit", cproc3, 0, "quit");
74 if (tp == (char *) 0) break;
75 code = cmd_ParseLine(tline, tv, &tc, 100);
77 printf("itest: parsing failure: %s\n", error_message(code));
80 code = cmd_Dispatch(tc, tv);
83 printf("itest: execution failed: %s\n", error_message(code));