8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / scadm / sparc / mpxu / common / process_command.c
blobced84005e55afa0b7b0703c9484123d49365f4a8
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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
34 #include <libintl.h>
35 #include <stdio.h>
36 #include <string.h>
37 #include <sys/types.h>
38 #include <unistd.h>
40 #include "adm.h"
43 void
44 ADM_Process_command(int argc, char *argv[])
46 if (strcasecmp(argv[1], "help") == 0)
47 ADM_Process_help();
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) {
89 if (argc == 3) {
90 if (strcasecmp(argv[2], "-v") == 0) {
91 ADM_Process_status(1);
92 } else {
93 (void) fprintf(stderr, "\n%s\n\n",
94 gettext("USAGE: scadm version [-v]"));
96 } else
97 ADM_Process_status(0);
99 } else if (strcasecmp(argv[1], "loghistory") == 0 ||
100 strcasecmp(argv[1], "lhist") == 0) {
102 if (argc == 2) {
103 ADM_Process_event_log(0);
104 } else if (argc == 3 && strcmp(argv[2], "-a") == 0) {
105 ADM_Process_event_log(1);
106 } else {
107 (void) fprintf(stderr, "\n%s\n\n",
108 gettext("USAGE: scadm loghistory [-a]"));
109 exit(-1);
112 } else if (strcasecmp(argv[1], "shownetwork") == 0) {
114 if (argc != 2) {
115 (void) fprintf(stderr, "\n%s\n\n",
116 gettext("USAGE: scadm shownetwork"));
117 exit(-1);
119 ADM_Process_show_network();
121 } else if (strcasecmp(argv[1], "consolehistory") == 0) {
123 if (argc == 2) {
124 ADM_Process_console_log(0);
125 } else if (argc == 3 && strcmp(argv[2], "-a") == 0) {
126 ADM_Process_console_log(1);
127 } else {
128 (void) fprintf(stderr, "\n%s\n\n",
129 gettext("USAGE: scadm consolehistory [-a]"));
130 exit(-1);
133 } else if (strcasecmp(argv[1], "fruhistory") == 0) {
135 if (argc == 2) {
136 ADM_Process_fru_log(0);
137 } else if (argc == 3 && strcmp(argv[2], "-a") == 0) {
138 ADM_Process_fru_log(1);
139 } else {
140 (void) fprintf(stderr, "\n%s\n\n",
141 gettext("USAGE: scadm fruhistory [-a]"));
142 exit(-1);
145 } else {
146 (void) fprintf(stderr, "\n%s - \"%s\"\n",
147 gettext("scadm: command unknown"), argv[1]);
148 ADM_Usage();
149 exit(-1);