17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate /*
23113f4232Sakaplan * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
287c478bd9Sstevel@tonic-gate /* All Rights Reserved */
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate * getdev.c
327c478bd9Sstevel@tonic-gate *
337c478bd9Sstevel@tonic-gate * Contains
347c478bd9Sstevel@tonic-gate * getdev Writes on the standard output stream a list of devices
357c478bd9Sstevel@tonic-gate * that match certain criteria.
367c478bd9Sstevel@tonic-gate */
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate #include <stdio.h>
397c478bd9Sstevel@tonic-gate #include <errno.h>
407c478bd9Sstevel@tonic-gate #include <stdlib.h>
417c478bd9Sstevel@tonic-gate #include <string.h>
427c478bd9Sstevel@tonic-gate #include <fmtmsg.h>
437c478bd9Sstevel@tonic-gate #include <devmgmt.h>
447c478bd9Sstevel@tonic-gate #include <devtab.h>
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate * Local Definitions
497c478bd9Sstevel@tonic-gate * TRUE Boolean TRUE value
507c478bd9Sstevel@tonic-gate * FALSE Boolean FALSE value
517c478bd9Sstevel@tonic-gate * EX_OK Exit Value if all went well
527c478bd9Sstevel@tonic-gate * EX_ERROR Exit Value if an error occurred
537c478bd9Sstevel@tonic-gate * EX_DEVTAB Exit Value if the device table couldn't be opened
54*2a8bcb4eSToomas Soome
557c478bd9Sstevel@tonic-gate */
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate #ifndef TRUE
587c478bd9Sstevel@tonic-gate #define TRUE (1)
597c478bd9Sstevel@tonic-gate #endif
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate #ifndef FALSE
627c478bd9Sstevel@tonic-gate #define FALSE (0)
637c478bd9Sstevel@tonic-gate #endif
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate #define EX_OK 0
667c478bd9Sstevel@tonic-gate #define EX_ERROR 1
677c478bd9Sstevel@tonic-gate #define EX_DEVTAB 2
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate * Messages:
727c478bd9Sstevel@tonic-gate * M_USAGE Usage error
737c478bd9Sstevel@tonic-gate * M_DEVTAB Can't open the device table
747c478bd9Sstevel@tonic-gate * M_NODEV Device not found in the device table
757c478bd9Sstevel@tonic-gate * M_ERROR Unexpected or internal error
767c478bd9Sstevel@tonic-gate */
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate #define M_USAGE "usage: getdev [-ae] [criterion [...]] [device [...]]"
797c478bd9Sstevel@tonic-gate #define M_DEVTAB "Cannot open the device table: %s"
807c478bd9Sstevel@tonic-gate #define M_NODEV "Device not found in the device table: %s"
817c478bd9Sstevel@tonic-gate #define M_ERROR "Internal error, errno=%d"
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate * Local (Static) Definitions and macros
867c478bd9Sstevel@tonic-gate * buildcriterialist() Builds the criteria list from the command-line
877c478bd9Sstevel@tonic-gate * builddevlist() Builds the device list from the command-line
887c478bd9Sstevel@tonic-gate * lbl Buffer for the standard message label
897c478bd9Sstevel@tonic-gate * txt Buffer for the standard message text
907c478bd9Sstevel@tonic-gate * stdmsg(r,l,s,t) Write a standard message:
917c478bd9Sstevel@tonic-gate * r Recoverability flag
927c478bd9Sstevel@tonic-gate * l Standard label
937c478bd9Sstevel@tonic-gate * s Severity
947c478bd9Sstevel@tonic-gate * t Text
957c478bd9Sstevel@tonic-gate */
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate static char **buildcriterialist();
987c478bd9Sstevel@tonic-gate static char **builddevlist();
997c478bd9Sstevel@tonic-gate
1007c478bd9Sstevel@tonic-gate static char lbl[MM_MXLABELLN+1];
1017c478bd9Sstevel@tonic-gate static char txt[MM_MXTXTLN+1];
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate #define stdmsg(r,l,s,t) (void) fmtmsg(MM_PRINT|MM_UTIL|r,l,s,t,MM_NULLACT,MM_NULLTAG)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate /*
1067c478bd9Sstevel@tonic-gate * getdev [-ae] [criterion [...]] [device [...]]
1077c478bd9Sstevel@tonic-gate *
1087c478bd9Sstevel@tonic-gate * This command generates a list of devices that match the
1097c478bd9Sstevel@tonic-gate * specified criteria.
110*2a8bcb4eSToomas Soome *
1117c478bd9Sstevel@tonic-gate * Options:
1127c478bd9Sstevel@tonic-gate * -a A device must meet all of the criteria to be
1137c478bd9Sstevel@tonic-gate * included in the generated list instead of just
1147c478bd9Sstevel@tonic-gate * one of the criteria (the "and" flag)
1157c478bd9Sstevel@tonic-gate * -e Exclude the devices mentioned from the generated
1167c478bd9Sstevel@tonic-gate * list. If this flag is omitted, the devices in the
1177c478bd9Sstevel@tonic-gate * list are selected from the devices mentioned.
1187c478bd9Sstevel@tonic-gate *
1197c478bd9Sstevel@tonic-gate * Arguments:
1207c478bd9Sstevel@tonic-gate * criterion An <attr><op><value> expression that describes
121*2a8bcb4eSToomas Soome * a device attribute.
1227c478bd9Sstevel@tonic-gate * <attr> is a device attribute
1237c478bd9Sstevel@tonic-gate * <op> may be = != : !: indicating equals, does not
124*2a8bcb4eSToomas Soome * equal, is defined, and is not defined
1257c478bd9Sstevel@tonic-gate * respectively
1267c478bd9Sstevel@tonic-gate * <value> is the attribute value. Currently, the only
1277c478bd9Sstevel@tonic-gate * value supported for the : and !: operators
1287c478bd9Sstevel@tonic-gate * is *
1297c478bd9Sstevel@tonic-gate * device A device to select for or exclude from the generated
1307c478bd9Sstevel@tonic-gate * list
1317c478bd9Sstevel@tonic-gate *
1327c478bd9Sstevel@tonic-gate * Exit values:
1337c478bd9Sstevel@tonic-gate * EX_OK All went well
1347c478bd9Sstevel@tonic-gate * EX_ERROR An error (syntax, internal, or resource) occurred
1357c478bd9Sstevel@tonic-gate * EX_DEVTAB The device-table could not be opened for reading
1367c478bd9Sstevel@tonic-gate */
1377c478bd9Sstevel@tonic-gate
138113f4232Sakaplan int
main(int argc,char ** argv)139113f4232Sakaplan main(int argc, char **argv)
1407c478bd9Sstevel@tonic-gate {
1417c478bd9Sstevel@tonic-gate
142*2a8bcb4eSToomas Soome /*
1437c478bd9Sstevel@tonic-gate * Automatic data
1447c478bd9Sstevel@tonic-gate */
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gate char **arglist; /* List of arguments */
1477c478bd9Sstevel@tonic-gate char **criterialist; /* List of criteria */
1487c478bd9Sstevel@tonic-gate char **devicelist; /* List of devices to search/ignore */
1497c478bd9Sstevel@tonic-gate char **fitdevlist; /* List of devices that fit criteria */
1507c478bd9Sstevel@tonic-gate char *cmdname; /* Simple command name */
1517c478bd9Sstevel@tonic-gate char *device; /* Device name in the list */
1527c478bd9Sstevel@tonic-gate char *devtab; /* The device table name */
1537c478bd9Sstevel@tonic-gate int exitcode; /* Value to return to the caller */
1547c478bd9Sstevel@tonic-gate int sev; /* Message severity */
1557c478bd9Sstevel@tonic-gate int optchar; /* Option character (from getopt()) */
1567c478bd9Sstevel@tonic-gate int andflag; /* TRUE if criteria are to be anded */
1577c478bd9Sstevel@tonic-gate int excludeflag; /* TRUE if exclude "devices" lists */
1587c478bd9Sstevel@tonic-gate int options; /* Options to pass to getdev() */
1597c478bd9Sstevel@tonic-gate int usageerr; /* TRUE if syntax error */
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate /* Build the message label from the (simple) command name */
1637c478bd9Sstevel@tonic-gate if ((cmdname = strrchr(argv[0], '/')) != (char *) NULL) cmdname++;
1647c478bd9Sstevel@tonic-gate else cmdname = argv[0];
1657c478bd9Sstevel@tonic-gate (void) strlcat(strcpy(lbl, "UX:"), cmdname, sizeof(lbl));
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gate /* Write text-component of messages only (goes away in SVR4.1) */
1687c478bd9Sstevel@tonic-gate (void) putenv("MSGVERB=text");
1697c478bd9Sstevel@tonic-gate
170*2a8bcb4eSToomas Soome /*
1717c478bd9Sstevel@tonic-gate * Parse the command line:
1727c478bd9Sstevel@tonic-gate * - Options
1737c478bd9Sstevel@tonic-gate * - Selection criteria
1747c478bd9Sstevel@tonic-gate * - Devices to include or exclude
1757c478bd9Sstevel@tonic-gate */
1767c478bd9Sstevel@tonic-gate
177*2a8bcb4eSToomas Soome /*
178*2a8bcb4eSToomas Soome * Extract options from the command line
1797c478bd9Sstevel@tonic-gate */
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate /* Initializations */
1827c478bd9Sstevel@tonic-gate andflag = FALSE; /* No -a -- Or criteria data */
1837c478bd9Sstevel@tonic-gate excludeflag = FALSE; /* No -e -- Include only mentioned devices */
1847c478bd9Sstevel@tonic-gate usageerr = FALSE; /* No errors on the command line (yet) */
1857c478bd9Sstevel@tonic-gate
186*2a8bcb4eSToomas Soome /*
187*2a8bcb4eSToomas Soome * Loop until all of the command line options have been parced
1887c478bd9Sstevel@tonic-gate */
1897c478bd9Sstevel@tonic-gate opterr = FALSE; /* Don't let getopt() write messages */
1907c478bd9Sstevel@tonic-gate while ((optchar = getopt(argc, argv, "ae")) != EOF) switch (optchar) {
1917c478bd9Sstevel@tonic-gate
1927c478bd9Sstevel@tonic-gate /* -a List devices that fit all of the criteria listed */
193*2a8bcb4eSToomas Soome case 'a':
1947c478bd9Sstevel@tonic-gate if (andflag) usageerr = TRUE;
1957c478bd9Sstevel@tonic-gate else andflag = TRUE;
1967c478bd9Sstevel@tonic-gate break;
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate /* -e Exclude those devices mentioned on the command line */
1997c478bd9Sstevel@tonic-gate case 'e':
2007c478bd9Sstevel@tonic-gate if (excludeflag) usageerr = TRUE;
2017c478bd9Sstevel@tonic-gate else excludeflag = TRUE;
2027c478bd9Sstevel@tonic-gate break;
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate /* Default case -- command usage error */
2057c478bd9Sstevel@tonic-gate case '?':
2067c478bd9Sstevel@tonic-gate default:
2077c478bd9Sstevel@tonic-gate usageerr = TRUE;
2087c478bd9Sstevel@tonic-gate break;
2097c478bd9Sstevel@tonic-gate }
2107c478bd9Sstevel@tonic-gate
2117c478bd9Sstevel@tonic-gate /* If there is a usage error, write an appropriate message and exit */
2127c478bd9Sstevel@tonic-gate if (usageerr) {
2137c478bd9Sstevel@tonic-gate stdmsg(MM_NRECOV, lbl, MM_ERROR, M_USAGE);
2147c478bd9Sstevel@tonic-gate exit(EX_ERROR);
2157c478bd9Sstevel@tonic-gate }
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gate /* Open the device file (if there's one to be opened) */
2187c478bd9Sstevel@tonic-gate if (!_opendevtab("r")) {
2197c478bd9Sstevel@tonic-gate if (devtab = _devtabpath()) {
2207c478bd9Sstevel@tonic-gate (void) snprintf(txt, sizeof(txt), M_DEVTAB, devtab);
2217c478bd9Sstevel@tonic-gate sev = MM_ERROR;
2227c478bd9Sstevel@tonic-gate exitcode = EX_DEVTAB;
2237c478bd9Sstevel@tonic-gate } else {
2247c478bd9Sstevel@tonic-gate (void) sprintf(txt, M_ERROR, errno);
2257c478bd9Sstevel@tonic-gate sev = MM_HALT;
2267c478bd9Sstevel@tonic-gate exitcode = EX_ERROR;
2277c478bd9Sstevel@tonic-gate }
2287c478bd9Sstevel@tonic-gate stdmsg(MM_NRECOV, lbl, sev, txt);
2297c478bd9Sstevel@tonic-gate exit(exitcode);
2307c478bd9Sstevel@tonic-gate }
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gate /* Build the list of criteria and devices */
2337c478bd9Sstevel@tonic-gate arglist = argv + optind;
2347c478bd9Sstevel@tonic-gate criterialist = buildcriterialist(arglist);
2357c478bd9Sstevel@tonic-gate devicelist = builddevlist(arglist);
2367c478bd9Sstevel@tonic-gate options = (excludeflag?DTAB_EXCLUDEFLAG:0)|(andflag?DTAB_ANDCRITERIA:0);
2377c478bd9Sstevel@tonic-gate
238*2a8bcb4eSToomas Soome /*
239*2a8bcb4eSToomas Soome * Get the list of devices that meets the criteria requested. If we
240*2a8bcb4eSToomas Soome * got a list (that might be empty), write that list to the standard
2417c478bd9Sstevel@tonic-gate * output file (stdout).
2427c478bd9Sstevel@tonic-gate */
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate exitcode = 0;
2457c478bd9Sstevel@tonic-gate if (!(fitdevlist = getdev(devicelist, criterialist, options))) {
2467c478bd9Sstevel@tonic-gate exitcode = 1;
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate else for (device = *fitdevlist++ ; device ; device = *fitdevlist++)
2497c478bd9Sstevel@tonic-gate (void) puts(device);
2507c478bd9Sstevel@tonic-gate
2517c478bd9Sstevel@tonic-gate /* Finished */
2527c478bd9Sstevel@tonic-gate return(exitcode);
2537c478bd9Sstevel@tonic-gate }
2547c478bd9Sstevel@tonic-gate
2557c478bd9Sstevel@tonic-gate /*
2567c478bd9Sstevel@tonic-gate * char **buildcriterialist(arglist)
2577c478bd9Sstevel@tonic-gate * char **arglist
2587c478bd9Sstevel@tonic-gate *
2597c478bd9Sstevel@tonic-gate * Build a list of pointers to the criterion on the command-line
2607c478bd9Sstevel@tonic-gate *
2617c478bd9Sstevel@tonic-gate * Arguments:
2627c478bd9Sstevel@tonic-gate * arglist The list of arguments on the command-line
263*2a8bcb4eSToomas Soome *
2647c478bd9Sstevel@tonic-gate * Returns: char **
2657c478bd9Sstevel@tonic-gate * The address of the first item of the list of criterion on the
2667c478bd9Sstevel@tonic-gate * command-line. This is a pointer to malloc()ed space.
2677c478bd9Sstevel@tonic-gate */
2687c478bd9Sstevel@tonic-gate
2697c478bd9Sstevel@tonic-gate static char **
buildcriterialist(arglist)270*2a8bcb4eSToomas Soome buildcriterialist(arglist)
2717c478bd9Sstevel@tonic-gate char **arglist; /* Pointer to the list of argument pointers */
2727c478bd9Sstevel@tonic-gate {
2737c478bd9Sstevel@tonic-gate /*
2747c478bd9Sstevel@tonic-gate * Automatic data
2757c478bd9Sstevel@tonic-gate */
276*2a8bcb4eSToomas Soome
2777c478bd9Sstevel@tonic-gate char **pp; /* Pointer to a criteria */
2787c478bd9Sstevel@tonic-gate char **allocbuf; /* Pointer to the allocated data */
2797c478bd9Sstevel@tonic-gate int ncriteria; /* Number of criteria found */
2807c478bd9Sstevel@tonic-gate
2817c478bd9Sstevel@tonic-gate
2827c478bd9Sstevel@tonic-gate /*
283*2a8bcb4eSToomas Soome * Search the argument list, looking for the end of the list or
284*2a8bcb4eSToomas Soome * the first thing that's not a criteria. (A criteria is a
2857c478bd9Sstevel@tonic-gate * character-string that contains a colon (':') or an equal-sign ('=')
2867c478bd9Sstevel@tonic-gate */
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate pp = arglist;
2897c478bd9Sstevel@tonic-gate ncriteria = 0;
2907c478bd9Sstevel@tonic-gate while (*pp && (strchr(*pp, '=') || strchr(*pp, ':'))) {
2917c478bd9Sstevel@tonic-gate ncriteria++;
2927c478bd9Sstevel@tonic-gate pp++;
2937c478bd9Sstevel@tonic-gate }
2947c478bd9Sstevel@tonic-gate
2957c478bd9Sstevel@tonic-gate if (ncriteria > 0) {
2967c478bd9Sstevel@tonic-gate
2977c478bd9Sstevel@tonic-gate /* Allocate space for the list of criteria pointers */
2987c478bd9Sstevel@tonic-gate allocbuf = (char **) malloc((ncriteria+1)*sizeof(char **));
2997c478bd9Sstevel@tonic-gate
300*2a8bcb4eSToomas Soome /*
301*2a8bcb4eSToomas Soome * Build the list of criteria arguments
3027c478bd9Sstevel@tonic-gate */
3037c478bd9Sstevel@tonic-gate pp = allocbuf; /* Beginning of the list */
3047c478bd9Sstevel@tonic-gate while (*arglist && /* If there's more to do ... */
3057c478bd9Sstevel@tonic-gate (strchr(*arglist, '=') || /* and it's a = criterion ... */
3067c478bd9Sstevel@tonic-gate strchr(*arglist, ':'))) /* or it's a : criterion ... */
3077c478bd9Sstevel@tonic-gate *pp++ = *arglist++; /* Include it in the list */
3087c478bd9Sstevel@tonic-gate *pp = (char *) NULL; /* Terminate the list */
3097c478bd9Sstevel@tonic-gate
3107c478bd9Sstevel@tonic-gate } else allocbuf = (char **) NULL; /* NO criteria */
311*2a8bcb4eSToomas Soome
3127c478bd9Sstevel@tonic-gate
3137c478bd9Sstevel@tonic-gate return (allocbuf);
3147c478bd9Sstevel@tonic-gate }
3157c478bd9Sstevel@tonic-gate
3167c478bd9Sstevel@tonic-gate /*
3177c478bd9Sstevel@tonic-gate * char **builddevlist(arglist)
3187c478bd9Sstevel@tonic-gate * char **arglist
3197c478bd9Sstevel@tonic-gate *
3207c478bd9Sstevel@tonic-gate * Builds a list of pointers to the devices mentioned on the command-
3217c478bd9Sstevel@tonic-gate * line and returns the address of that list.
3227c478bd9Sstevel@tonic-gate *
3237c478bd9Sstevel@tonic-gate * Arguments:
3247c478bd9Sstevel@tonic-gate * arglist The address of the list of arguments to the
3257c478bd9Sstevel@tonic-gate * getdev command.
3267c478bd9Sstevel@tonic-gate *
3277c478bd9Sstevel@tonic-gate * Returns: char **
3287c478bd9Sstevel@tonic-gate * A pointer to the first item in the list of pointers to devices
3297c478bd9Sstevel@tonic-gate * specified on the command-line
3307c478bd9Sstevel@tonic-gate */
3317c478bd9Sstevel@tonic-gate
3327c478bd9Sstevel@tonic-gate static char **
builddevlist(arglist)333*2a8bcb4eSToomas Soome builddevlist(arglist)
3347c478bd9Sstevel@tonic-gate char **arglist; /* Pointer to the list of pointers to args */
3357c478bd9Sstevel@tonic-gate {
3367c478bd9Sstevel@tonic-gate /*
3377c478bd9Sstevel@tonic-gate * Automatic data
3387c478bd9Sstevel@tonic-gate */
3397c478bd9Sstevel@tonic-gate
3407c478bd9Sstevel@tonic-gate /*
341*2a8bcb4eSToomas Soome * Search the argument list, looking for the end of the list or the
342*2a8bcb4eSToomas Soome * first thing that's not a criteria. It is the first device in the
3437c478bd9Sstevel@tonic-gate * list of devices (if any).
3447c478bd9Sstevel@tonic-gate */
3457c478bd9Sstevel@tonic-gate
3467c478bd9Sstevel@tonic-gate while (*arglist && (strchr(*arglist, '=') || strchr(*arglist, ':'))) arglist++;
3477c478bd9Sstevel@tonic-gate
3487c478bd9Sstevel@tonic-gate /* Return a pointer to the argument list. */
3497c478bd9Sstevel@tonic-gate return(*arglist?arglist:(char **) NULL);
3507c478bd9Sstevel@tonic-gate }
351