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
14 static cproc1 (as, arock)
16 struct cmd_syndesc *as; {
17 printf("in the apple command\n");
21 static cproc2 (as, arock)
23 struct cmd_syndesc *as; {
24 register struct cmd_item *ti;
25 printf("in the pear command\n");
26 printf("number is %s\n", as->parms[0].items->data);
27 if (as->parms[1].items) printf("running unauthenticated\n");
28 for(ti=as->parms[2].items; ti; ti=ti->next) {
29 printf("spotspos %s\n", ti->data);
31 if (as->parms[8].items)
32 printf("cell name %s\n", as->parms[8].items->data);
36 static void cproc3(as, arock)
38 struct cmd_syndesc *as; {
45 register struct cmd_syndesc *ts;
52 initialize_cmd_error_table();
54 ts = cmd_CreateSyntax("apple", cproc1, (char *) 0, "describe apple");
56 ts = cmd_CreateSyntax("pear", cproc2, (char *) 0, "describe pear");
57 cmd_AddParm(ts, "-num", CMD_LIST, 0, "number of pears");
58 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");
59 cmd_AddParm(ts, "-spotpos", CMD_LIST, CMD_OPTIONAL | CMD_EXPANDS, 0);
61 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");
62 cmd_CreateAlias(ts, "alias");
64 ts = cmd_CreateSyntax("quit", cproc3, 0, "quit");
69 if (tp == (char *) 0) break;
70 code = cmd_ParseLine(tline, tv, &tc, 100);
72 printf("itest: parsing failure: %s\n", error_message(code));
75 code = cmd_Dispatch(tc, tv);
78 printf("itest: execution failed: %s\n", error_message(code));