xref: /illumos-gate/usr/src/cmd/fcinfo/fcinfo.c (revision bbf21555)
1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
222a8164dfSZhong Wang  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fcf3ce44SJohn Forte  * Use is subject to license terms.
24fcf3ce44SJohn Forte  */
25fcf3ce44SJohn Forte 
26fcf3ce44SJohn Forte #include <fcinfo.h>
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte 
29fcf3ce44SJohn Forte 
30fcf3ce44SJohn Forte #define	VERSION_STRING_MAX_LEN	10
31fcf3ce44SJohn Forte /*
32fcf3ce44SJohn Forte  * Version number:
33fcf3ce44SJohn Forte  *  MAJOR - This should only change when there is an incompatible change made
34fcf3ce44SJohn Forte  *  to the interfaces or the output.
35fcf3ce44SJohn Forte  *
36fcf3ce44SJohn Forte  *  MINOR - This should change whenever there is a new command or new feature
37fcf3ce44SJohn Forte  *  with no incompatible change.
38fcf3ce44SJohn Forte  */
39fcf3ce44SJohn Forte #define	VERSION_STRING_MAJOR	    "1"
40fcf3ce44SJohn Forte #define	VERSION_STRING_MINOR	    "0"
41fcf3ce44SJohn Forte 
42fcf3ce44SJohn Forte #define	OPTIONSTRING1		"HBA Port WWN"
43fcf3ce44SJohn Forte #define	OPTIONSTRING2		"HBA Node WWN"
44fcf3ce44SJohn Forte /* forward declarations */
45fcf3ce44SJohn Forte static int listHbaPortFunc(int, char **, cmdOptions_t *, void *);
46fcf3ce44SJohn Forte static int listRemotePortFunc(int, char **, cmdOptions_t *, void *);
47fcf3ce44SJohn Forte static int listLogicalUnitFunc(int, char **, cmdOptions_t *, void *);
48fcf3ce44SJohn Forte static int npivCreatePortFunc(int, char **, cmdOptions_t *, void *);
49fcf3ce44SJohn Forte static int npivDeletePortFunc(int, char **, cmdOptions_t *, void *);
50fcf3ce44SJohn Forte static int npivCreatePortListFunc(int, char **, cmdOptions_t *, void *);
51fcf3ce44SJohn Forte static int npivListHbaPortFunc(int, char **, cmdOptions_t *, void *);
52fcf3ce44SJohn Forte static int npivListRemotePortFunc(int, char **, cmdOptions_t *, void *);
532a8164dfSZhong Wang static int fcoeAdmCreatePortFunc(int, char **, cmdOptions_t *, void *);
542a8164dfSZhong Wang static int fcoeListPortsFunc(int, char **, cmdOptions_t *, void *);
552a8164dfSZhong Wang static int fcoeAdmDeletePortFunc(int, char **, cmdOptions_t *, void *);
56a7949318SReed static int fcadmForceLipFunc(int, char **, cmdOptions_t *, void *);
57fcf3ce44SJohn Forte static char *getExecBasename(char *);
58fcf3ce44SJohn Forte 
59fcf3ce44SJohn Forte /*
60fcf3ce44SJohn Forte  * Add new options here
61fcf3ce44SJohn Forte  *
62fcf3ce44SJohn Forte  * Optional option-arguments are not allowed by CLIP
63fcf3ce44SJohn Forte  */
64fcf3ce44SJohn Forte optionTbl_t fcinfolongOptions[] = {
65fcf3ce44SJohn Forte 	{"port", required_argument,	'p', OPTIONSTRING1},
66fcf3ce44SJohn Forte 	{"target", no_argument,		't', NULL},
67fcf3ce44SJohn Forte 	{"initiator", no_argument,	'i', NULL},
68fcf3ce44SJohn Forte 	{"linkstat", no_argument,	'l', NULL},
69fcf3ce44SJohn Forte 	{"scsi-target", no_argument,	's', NULL},
702a8164dfSZhong Wang 	{"fcoe", no_argument,		'e', NULL},
71fcf3ce44SJohn Forte 	{"verbose", no_argument,	'v', NULL},
72fcf3ce44SJohn Forte 	{NULL, 0, 0}
73fcf3ce44SJohn Forte };
74fcf3ce44SJohn Forte 
75fcf3ce44SJohn Forte optionTbl_t fcadmlongOptions[] = {
76fcf3ce44SJohn Forte 	{"port", required_argument,	'p', OPTIONSTRING1},
77fcf3ce44SJohn Forte 	{"node", required_argument,	'n', OPTIONSTRING2},
78fcf3ce44SJohn Forte 	{"linkstat", no_argument,	'l', NULL},
79fcf3ce44SJohn Forte 	{"scsi-target", no_argument,	's', NULL},
802a8164dfSZhong Wang 	{"fcoe-force-promisc", no_argument, 'f', NULL},
812a8164dfSZhong Wang 	{"target", no_argument,		't', NULL},
827ff83669SZhong Wang 	{"initiator", no_argument,	'i', NULL},
83fcf3ce44SJohn Forte 	{NULL, 0, 0}
84fcf3ce44SJohn Forte };
85fcf3ce44SJohn Forte 
86fcf3ce44SJohn Forte /*
87fcf3ce44SJohn Forte  * Add new subcommands here
88fcf3ce44SJohn Forte  */
89fcf3ce44SJohn Forte subCommandProps_t fcinfosubcommands[] = {
902a8164dfSZhong Wang 	{"hba-port", listHbaPortFunc, "itel", NULL, NULL,
91fcf3ce44SJohn Forte 		OPERAND_OPTIONAL_MULTIPLE, "WWN"},
92fcf3ce44SJohn Forte 	{"remote-port", listRemotePortFunc, "lsp", "p", NULL,
93fcf3ce44SJohn Forte 		OPERAND_OPTIONAL_MULTIPLE, "WWN"},
94fcf3ce44SJohn Forte 	{"logical-unit", listLogicalUnitFunc, "v", NULL, NULL,
95fcf3ce44SJohn Forte 		OPERAND_OPTIONAL_MULTIPLE, "OS Device Path"},
96fcf3ce44SJohn Forte 	{"lu", listLogicalUnitFunc, "v", NULL, NULL,
97fcf3ce44SJohn Forte 		OPERAND_OPTIONAL_MULTIPLE, "OS Device Path"},
98fcf3ce44SJohn Forte 	{NULL, 0, NULL, NULL, NULL, 0, NULL, NULL}
99fcf3ce44SJohn Forte };
100fcf3ce44SJohn Forte 
101fcf3ce44SJohn Forte subCommandProps_t fcadmsubcommands[] = {
102fcf3ce44SJohn Forte 	{"create-npiv-port",
103fcf3ce44SJohn Forte 	    npivCreatePortFunc, "pn", NULL, NULL,
104fcf3ce44SJohn Forte 	    OPERAND_MANDATORY_SINGLE,  "WWN"},
105fcf3ce44SJohn Forte 	{"delete-npiv-port",
106fcf3ce44SJohn Forte 	    npivDeletePortFunc, "p", "p", NULL,
107fcf3ce44SJohn Forte 	    OPERAND_MANDATORY_SINGLE,  "WWN"},
108fcf3ce44SJohn Forte 	{"hba-port",
109fcf3ce44SJohn Forte 	    npivListHbaPortFunc, "l", NULL, NULL,
110fcf3ce44SJohn Forte 	    OPERAND_OPTIONAL_MULTIPLE, "WWN"},
111fcf3ce44SJohn Forte 	{"remote-port",
112fcf3ce44SJohn Forte 	    npivListRemotePortFunc, "psl", "p", NULL,
113fcf3ce44SJohn Forte 	    OPERAND_OPTIONAL_MULTIPLE, "WWN"},
114fcf3ce44SJohn Forte 	{"create-port-list",
115fcf3ce44SJohn Forte 	    npivCreatePortListFunc, NULL, NULL, NULL,
116fcf3ce44SJohn Forte 	    OPERAND_NONE, NULL},
1172a8164dfSZhong Wang 	{"create-fcoe-port",
1187ff83669SZhong Wang 	    fcoeAdmCreatePortFunc, "itpnf", NULL, NULL,
1192a8164dfSZhong Wang 		OPERAND_MANDATORY_SINGLE, "Network Interface Name"},
1202a8164dfSZhong Wang 	{"delete-fcoe-port",
1212a8164dfSZhong Wang 	    fcoeAdmDeletePortFunc, NULL, NULL, NULL,
1222a8164dfSZhong Wang 		OPERAND_MANDATORY_SINGLE, "Network Interface Name"},
1232a8164dfSZhong Wang 	{"list-fcoe-ports",
1247ff83669SZhong Wang 	    fcoeListPortsFunc, "it", NULL, NULL,
1252a8164dfSZhong Wang 		OPERAND_NONE, NULL},
126a7949318SReed 	{"force-lip",
127a7949318SReed 	    fcadmForceLipFunc, NULL, NULL, NULL,
128a7949318SReed 		OPERAND_MANDATORY_SINGLE, "WWN"},
129fcf3ce44SJohn Forte 	{NULL, 0, NULL, NULL, NULL, 0, NULL, NULL}
130fcf3ce44SJohn Forte };
1312a8164dfSZhong Wang 
132fcf3ce44SJohn Forte /*
133fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
134fcf3ce44SJohn Forte  */
135fcf3ce44SJohn Forte /*ARGSUSED*/
136fcf3ce44SJohn Forte static int
listHbaPortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)137fcf3ce44SJohn Forte listHbaPortFunc(int objects, char *argv[], cmdOptions_t *options, void *addArgs)
138fcf3ce44SJohn Forte {
139fcf3ce44SJohn Forte 	return (fc_util_list_hbaport(objects, argv, options));
140fcf3ce44SJohn Forte }
141fcf3ce44SJohn Forte 
142fcf3ce44SJohn Forte /*
143fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
144fcf3ce44SJohn Forte  */
145fcf3ce44SJohn Forte /*ARGSUSED*/
146fcf3ce44SJohn Forte static int
listRemotePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)147fcf3ce44SJohn Forte listRemotePortFunc(int objects, char *argv[], cmdOptions_t *options,
148fcf3ce44SJohn Forte     void *addArgs)
149fcf3ce44SJohn Forte {
150fcf3ce44SJohn Forte 	return (fc_util_list_remoteport(objects, argv, options));
151fcf3ce44SJohn Forte }
152fcf3ce44SJohn Forte 
153fcf3ce44SJohn Forte /*
154fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
155fcf3ce44SJohn Forte  */
156fcf3ce44SJohn Forte /*ARGSUSED*/
157fcf3ce44SJohn Forte static int
listLogicalUnitFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)158fcf3ce44SJohn Forte listLogicalUnitFunc(int objects, char *argv[], cmdOptions_t *options,
159fcf3ce44SJohn Forte     void *addArgs)
160fcf3ce44SJohn Forte {
161fcf3ce44SJohn Forte 	return (fc_util_list_logicalunit(objects, argv, options));
162fcf3ce44SJohn Forte }
163fcf3ce44SJohn Forte 
164fcf3ce44SJohn Forte /*
165fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
166fcf3ce44SJohn Forte  */
167fcf3ce44SJohn Forte /*ARGSUSED*/
168fcf3ce44SJohn Forte static int
npivCreatePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)169fcf3ce44SJohn Forte npivCreatePortFunc(int objects, char *argv[],
170fcf3ce44SJohn Forte     cmdOptions_t *options, void *addArgs) {
171fcf3ce44SJohn Forte 	return (fc_util_create_npivport(objects, argv, options));
172fcf3ce44SJohn Forte }
173fcf3ce44SJohn Forte 
174fcf3ce44SJohn Forte static int
npivCreatePortListFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)175fcf3ce44SJohn Forte npivCreatePortListFunc(int objects, char *argv[],
176fcf3ce44SJohn Forte     cmdOptions_t *options, void *addArgs) {
177fcf3ce44SJohn Forte 	if ((objects == 0) && addArgs && options && argv) {
178fcf3ce44SJohn Forte 		objects = 1;
179fcf3ce44SJohn Forte 	}
180fcf3ce44SJohn Forte 	return (fc_util_create_portlist());
181fcf3ce44SJohn Forte }
182fcf3ce44SJohn Forte 
183fcf3ce44SJohn Forte /*
184fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
185fcf3ce44SJohn Forte  */
186fcf3ce44SJohn Forte /*ARGSUSED*/
187fcf3ce44SJohn Forte static int
npivDeletePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)188fcf3ce44SJohn Forte npivDeletePortFunc(int objects, char *argv[],
189fcf3ce44SJohn Forte     cmdOptions_t *options, void *addArgs) {
190fcf3ce44SJohn Forte 	return (fc_util_delete_npivport(objects, argv, options));
191fcf3ce44SJohn Forte }
192fcf3ce44SJohn Forte 
193fcf3ce44SJohn Forte /*
194fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
195fcf3ce44SJohn Forte  */
196fcf3ce44SJohn Forte /*ARGSUSED*/
197fcf3ce44SJohn Forte static int
npivListHbaPortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)198fcf3ce44SJohn Forte npivListHbaPortFunc(int objects, char *argv[],
199fcf3ce44SJohn Forte     cmdOptions_t *options, void *addArgs) {
200fcf3ce44SJohn Forte 	return (fc_util_list_hbaport(objects, argv, options));
201fcf3ce44SJohn Forte }
202fcf3ce44SJohn Forte 
203fcf3ce44SJohn Forte /*
204fcf3ce44SJohn Forte  * Pass in options/arguments, rest of arguments
205fcf3ce44SJohn Forte  */
206fcf3ce44SJohn Forte /*ARGSUSED*/
207fcf3ce44SJohn Forte static int
npivListRemotePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)208fcf3ce44SJohn Forte npivListRemotePortFunc(int objects, char *argv[],
209fcf3ce44SJohn Forte     cmdOptions_t *options, void *addArgs) {
210fcf3ce44SJohn Forte 	return (fc_util_list_remoteport(objects, argv, options));
211fcf3ce44SJohn Forte }
212fcf3ce44SJohn Forte 
2132a8164dfSZhong Wang /*
2142a8164dfSZhong Wang  * Pass in options/arguments, rest of arguments
2152a8164dfSZhong Wang  */
2162a8164dfSZhong Wang /*ARGSUSED*/
2172a8164dfSZhong Wang static int
fcoeAdmCreatePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)2182a8164dfSZhong Wang fcoeAdmCreatePortFunc(int objects, char *argv[], cmdOptions_t *options,
2192a8164dfSZhong Wang     void *addArgs)
2202a8164dfSZhong Wang {
2212a8164dfSZhong Wang 	return (fcoe_adm_create_port(objects, argv, options));
2222a8164dfSZhong Wang }
2232a8164dfSZhong Wang 
2242a8164dfSZhong Wang /*
2252a8164dfSZhong Wang  * Pass in options/arguments, rest of arguments
2262a8164dfSZhong Wang  */
2272a8164dfSZhong Wang /*ARGSUSED*/
2282a8164dfSZhong Wang static int
fcoeAdmDeletePortFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)2292a8164dfSZhong Wang fcoeAdmDeletePortFunc(int objects, char *argv[], cmdOptions_t *options,
2302a8164dfSZhong Wang     void *addArgs)
2312a8164dfSZhong Wang {
2322a8164dfSZhong Wang 	return (fcoe_adm_delete_port(objects, argv));
2332a8164dfSZhong Wang }
2342a8164dfSZhong Wang 
2352a8164dfSZhong Wang /*
2362a8164dfSZhong Wang  * Pass in options/arguments, rest of arguments
2372a8164dfSZhong Wang  */
2382a8164dfSZhong Wang /*ARGSUSED*/
2392a8164dfSZhong Wang static int
fcoeListPortsFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)2402a8164dfSZhong Wang fcoeListPortsFunc(int objects, char *argv[], cmdOptions_t *options,
2412a8164dfSZhong Wang     void *addArgs)
2422a8164dfSZhong Wang {
2432a8164dfSZhong Wang 	return (fcoe_adm_list_ports(options));
2442a8164dfSZhong Wang }
2452a8164dfSZhong Wang 
246a7949318SReed /*
247a7949318SReed  * Pass in options/arguments, rest of arguments
248a7949318SReed  */
249a7949318SReed /*ARGSUSED*/
250a7949318SReed static int
fcadmForceLipFunc(int objects,char * argv[],cmdOptions_t * options,void * addArgs)251a7949318SReed fcadmForceLipFunc(int objects, char *argv[], cmdOptions_t *options,
252a7949318SReed     void *addArgs)
253a7949318SReed {
254a7949318SReed 	return (fc_util_force_lip(objects, argv));
255a7949318SReed }
256a7949318SReed 
257fcf3ce44SJohn Forte /*
258fcf3ce44SJohn Forte  * input:
259fcf3ce44SJohn Forte  *  execFullName - exec name of program (argv[0])
260fcf3ce44SJohn Forte  *
261fcf3ce44SJohn Forte  * Returns:
262fcf3ce44SJohn Forte  *  command name portion of execFullName
263fcf3ce44SJohn Forte  */
264fcf3ce44SJohn Forte static char *
getExecBasename(char * execFullname)265fcf3ce44SJohn Forte getExecBasename(char *execFullname)
266fcf3ce44SJohn Forte {
267fcf3ce44SJohn Forte 	char *lastSlash, *execBasename;
268fcf3ce44SJohn Forte 
269fcf3ce44SJohn Forte 	/* guard against '/' at end of command invocation */
270fcf3ce44SJohn Forte 	for (;;) {
271fcf3ce44SJohn Forte 		lastSlash = strrchr(execFullname, '/');
272fcf3ce44SJohn Forte 		if (lastSlash == NULL) {
273fcf3ce44SJohn Forte 			execBasename = execFullname;
274fcf3ce44SJohn Forte 			break;
275fcf3ce44SJohn Forte 		} else {
276fcf3ce44SJohn Forte 			execBasename = lastSlash + 1;
277fcf3ce44SJohn Forte 			if (*execBasename == '\0') {
278fcf3ce44SJohn Forte 				*lastSlash = '\0';
279fcf3ce44SJohn Forte 				continue;
280fcf3ce44SJohn Forte 			}
281fcf3ce44SJohn Forte 			break;
282fcf3ce44SJohn Forte 		}
283fcf3ce44SJohn Forte 	}
284fcf3ce44SJohn Forte 	return (execBasename);
285fcf3ce44SJohn Forte }
286fcf3ce44SJohn Forte 
287fcf3ce44SJohn Forte /*
288fcf3ce44SJohn Forte  * main calls a parser that checks syntax of the input command against
289fcf3ce44SJohn Forte  * various rules tables.
290fcf3ce44SJohn Forte  *
291fcf3ce44SJohn Forte  * The parser provides usage feedback based upon same tables by calling
292fcf3ce44SJohn Forte  * two usage functions, usage and subUsage, handling command and subcommand
293fcf3ce44SJohn Forte  * usage respectively.
294fcf3ce44SJohn Forte  *
295fcf3ce44SJohn Forte  * The parser handles all printing of usage syntactical errors
296fcf3ce44SJohn Forte  *
297fcf3ce44SJohn Forte  * When syntax is successfully validated, the parser calls the associated
298fcf3ce44SJohn Forte  * function using the subcommands table functions.
299fcf3ce44SJohn Forte  *
300fcf3ce44SJohn Forte  * Syntax is as follows:
301fcf3ce44SJohn Forte  *	command subcommand [options] resource-type [<object>]
302fcf3ce44SJohn Forte  *
303fcf3ce44SJohn Forte  * The return value from the function is placed in funcRet
304fcf3ce44SJohn Forte  */
305fcf3ce44SJohn Forte int
main(int argc,char * argv[])306fcf3ce44SJohn Forte main(int argc, char *argv[])
307fcf3ce44SJohn Forte {
308fcf3ce44SJohn Forte 	synTables_t synTables;
309fcf3ce44SJohn Forte 	char versionString[VERSION_STRING_MAX_LEN];
310fcf3ce44SJohn Forte 	int ret;
311fcf3ce44SJohn Forte 	int funcRet;
312fcf3ce44SJohn Forte 	void *subcommandArgs = NULL;
313fcf3ce44SJohn Forte 
3142a8164dfSZhong Wang 	(void) setlocale(LC_ALL, "");
3152a8164dfSZhong Wang #if	!defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
3162a8164dfSZhong Wang #define	TEXT_DOMAIN "SYS_TEST"	/* Use this only if it weren't */
3172a8164dfSZhong Wang #endif
3182a8164dfSZhong Wang 	(void) textdomain(TEXT_DOMAIN);
3192a8164dfSZhong Wang 
320fcf3ce44SJohn Forte 	/* set global command name */
321fcf3ce44SJohn Forte 	cmdName = getExecBasename(argv[0]);
322fcf3ce44SJohn Forte 
323fcf3ce44SJohn Forte 	sprintf(versionString, "%s.%s",
324fcf3ce44SJohn Forte 	    VERSION_STRING_MAJOR, VERSION_STRING_MINOR);
325fcf3ce44SJohn Forte 	synTables.versionString = versionString;
326fcf3ce44SJohn Forte 	if (strcmp(cmdName, "fcadm") == 0) {
327fcf3ce44SJohn Forte 		synTables.longOptionTbl = &fcadmlongOptions[0];
328fcf3ce44SJohn Forte 		synTables.subCommandPropsTbl = &fcadmsubcommands[0];
329fcf3ce44SJohn Forte 	} else {
330fcf3ce44SJohn Forte 		synTables.longOptionTbl = &fcinfolongOptions[0];
331fcf3ce44SJohn Forte 		synTables.subCommandPropsTbl = &fcinfosubcommands[0];
332fcf3ce44SJohn Forte 	}
333fcf3ce44SJohn Forte 
334fcf3ce44SJohn Forte 	/* call the CLI parser */
335fcf3ce44SJohn Forte 	ret = cmdParse(argc, argv, synTables, subcommandArgs, &funcRet);
336fcf3ce44SJohn Forte 	if (ret == 1) {
337*bbf21555SRichard Lowe 		fprintf(stdout, "%s %s(8)\n",
338fcf3ce44SJohn Forte 		    gettext("For more information, please see"), cmdName);
339fcf3ce44SJohn Forte 		return (1);
340fcf3ce44SJohn Forte 	} else if (ret == -1) {
341fcf3ce44SJohn Forte 		perror(cmdName);
342fcf3ce44SJohn Forte 		return (1);
343fcf3ce44SJohn Forte 	}
344fcf3ce44SJohn Forte 
345fcf3ce44SJohn Forte 	if (funcRet != 0) {
346fcf3ce44SJohn Forte 		return (1);
347fcf3ce44SJohn Forte 	}
348fcf3ce44SJohn Forte 	return (0);
349fcf3ce44SJohn Forte }
350