4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * process_command.c: parse the command line and call the proper function
31 * to process the command
37 #include <sys/types.h>
44 ADM_Process_command(int argc
, char *argv
[])
46 if (strcasecmp(argv
[1], "help") == 0)
49 else if (strcasecmp(argv
[1], "send_event") == 0)
50 ADM_Process_send_event(argc
, argv
);
52 else if (strcasecmp(argv
[1], "modem_setup") == 0)
53 ADM_Process_modem_setup();
55 else if (strcasecmp(argv
[1], "date") == 0)
56 ADM_Process_date(argc
, argv
);
58 else if (strcasecmp(argv
[1], "set") == 0)
59 ADM_Process_set(argc
, argv
);
61 else if (strcasecmp(argv
[1], "show") == 0)
62 ADM_Process_show(argc
, argv
);
64 else if (strcasecmp(argv
[1], "resetrsc") == 0)
65 ADM_Process_reset(argc
, argv
);
67 else if (strcasecmp(argv
[1], "download") == 0)
68 ADM_Process_download(argc
, argv
);
70 else if (strcasecmp(argv
[1], "useradd") == 0)
71 ADM_Process_useradd(argc
, argv
);
73 else if (strcasecmp(argv
[1], "userdel") == 0)
74 ADM_Process_userdel(argc
, argv
);
76 else if (strcasecmp(argv
[1], "usershow") == 0)
77 ADM_Process_usershow(argc
, argv
);
79 else if (strcasecmp(argv
[1], "userpassword") == 0)
80 ADM_Process_userpassword(argc
, argv
);
82 else if (strcasecmp(argv
[1], "userperm") == 0)
83 ADM_Process_userperm(argc
, argv
);
85 else if (strcasecmp(argv
[1], "status") == 0)
86 ADM_Process_status(0);
88 else if (strcasecmp(argv
[1], "version") == 0) {
90 if (strcasecmp(argv
[2], "-v") == 0) {
91 ADM_Process_status(1);
93 (void) fprintf(stderr
, "\n%s\n\n",
94 gettext("USAGE: scadm version [-v]"));
97 ADM_Process_status(0);
99 } else if (strcasecmp(argv
[1], "loghistory") == 0 ||
100 strcasecmp(argv
[1], "lhist") == 0) {
103 ADM_Process_event_log(0);
104 } else if (argc
== 3 && strcmp(argv
[2], "-a") == 0) {
105 ADM_Process_event_log(1);
107 (void) fprintf(stderr
, "\n%s\n\n",
108 gettext("USAGE: scadm loghistory [-a]"));
112 } else if (strcasecmp(argv
[1], "shownetwork") == 0) {
115 (void) fprintf(stderr
, "\n%s\n\n",
116 gettext("USAGE: scadm shownetwork"));
119 ADM_Process_show_network();
121 } else if (strcasecmp(argv
[1], "consolehistory") == 0) {
124 ADM_Process_console_log(0);
125 } else if (argc
== 3 && strcmp(argv
[2], "-a") == 0) {
126 ADM_Process_console_log(1);
128 (void) fprintf(stderr
, "\n%s\n\n",
129 gettext("USAGE: scadm consolehistory [-a]"));
133 } else if (strcasecmp(argv
[1], "fruhistory") == 0) {
136 ADM_Process_fru_log(0);
137 } else if (argc
== 3 && strcmp(argv
[2], "-a") == 0) {
138 ADM_Process_fru_log(1);
140 (void) fprintf(stderr
, "\n%s\n\n",
141 gettext("USAGE: scadm fruhistory [-a]"));
146 (void) fprintf(stderr
, "\n%s - \"%s\"\n",
147 gettext("scadm: command unknown"), argv
[1]);