xref: /onnv-gate/usr/src/cmd/bnu/sysfiles.c (revision 13093:48f2dbca79a2)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*13093SRoger.Faulkner@Oracle.COM  * Common Development and Distribution License (the "License").
6*13093SRoger.Faulkner@Oracle.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*13093SRoger.Faulkner@Oracle.COM 
220Sstevel@tonic-gate /*
23*13093SRoger.Faulkner@Oracle.COM  * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include "uucp.h"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <unistd.h>
320Sstevel@tonic-gate #include "sysfiles.h"
330Sstevel@tonic-gate #include <sys/stropts.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * manage systems files (Systems, Devices, and Dialcodes families).
370Sstevel@tonic-gate  *
380Sstevel@tonic-gate  * also manage new file Devconfig, allows per-device setup.
390Sstevel@tonic-gate  * present use is to specify what streams modules to push/pop for
400Sstevel@tonic-gate  * AT&T TLI/streams network.
410Sstevel@tonic-gate  *
420Sstevel@tonic-gate  * TODO:
430Sstevel@tonic-gate  *    call bsfix()?
440Sstevel@tonic-gate  *    combine the 3 versions of everything (sys, dev, and dial) into one.
450Sstevel@tonic-gate  *    allow arbitrary classes of service.
460Sstevel@tonic-gate  *    need verifysys() for uucheck.
470Sstevel@tonic-gate  *    nameserver interface?
480Sstevel@tonic-gate  *    pass sysname (or 0) to getsysline().  (might want reg. exp. or NS processing
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /* private variables */
520Sstevel@tonic-gate static void tokenize(), nameparse(), setfile(), setioctl(),
530Sstevel@tonic-gate 	scansys(), scancfg(), setconfig();
54*13093SRoger.Faulkner@Oracle.COM static int namematch(), nextdialers(), nextdevices(), nextsystems(), getaline();
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /* pointer arrays might be dynamically allocated */
570Sstevel@tonic-gate static char *Systems[64] = {0};	/* list of Systems files */
580Sstevel@tonic-gate static char *Devices[64] = {0};	/* list of Devices files */
590Sstevel@tonic-gate static char *Dialers[64] = {0};	/* list of Dialers files */
600Sstevel@tonic-gate static char *Pops[64] = {0};	/* list of STREAMS modules to be popped */
610Sstevel@tonic-gate static char *Pushes[64] = {0};	/* list of STREAMS modules to be pushed */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate static int nsystems;		/* index into list of Systems files */
640Sstevel@tonic-gate static int ndevices;		/* index into list of Devices files */
650Sstevel@tonic-gate static int ndialers;		/* index into list of Dialers files */
660Sstevel@tonic-gate static int npops;		/* index into list of STREAMS modules */
670Sstevel@tonic-gate 							/*to be popped */
680Sstevel@tonic-gate static int npushes;		/* index into list of STREAMS modules */
690Sstevel@tonic-gate 							/*to be pushed */
700Sstevel@tonic-gate 
710Sstevel@tonic-gate GLOBAL unsigned connecttime = CONNECTTIME;
720Sstevel@tonic-gate GLOBAL unsigned expecttime = EXPECTTIME;
730Sstevel@tonic-gate GLOBAL unsigned msgtime = MSGTIME;
740Sstevel@tonic-gate 
750Sstevel@tonic-gate static FILE *fsystems;
760Sstevel@tonic-gate static FILE *fdevices;
770Sstevel@tonic-gate static FILE *fdialers;
780Sstevel@tonic-gate 
790Sstevel@tonic-gate static char errformat[BUFSIZ];
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /* this might be dynamically allocated */
820Sstevel@tonic-gate #define NTOKENS 16
830Sstevel@tonic-gate static char *tokens[NTOKENS], **tokptr;
840Sstevel@tonic-gate 
850Sstevel@tonic-gate /* export these */
860Sstevel@tonic-gate EXTERN void sysreset(), devreset(), dialreset(), setdevcfg(), setservice();
870Sstevel@tonic-gate EXTERN char *strsave();
880Sstevel@tonic-gate 
890Sstevel@tonic-gate /* import these */
900Sstevel@tonic-gate extern char *strcpy(), *strtok(), *strchr(), *strsave();
910Sstevel@tonic-gate EXTERN int eaccess();
920Sstevel@tonic-gate 
930Sstevel@tonic-gate /*
940Sstevel@tonic-gate  * setservice init's Systems, Devices, Dialers lists from Sysfiles
950Sstevel@tonic-gate  */
960Sstevel@tonic-gate GLOBAL void
setservice(service)970Sstevel@tonic-gate setservice(service)
980Sstevel@tonic-gate char *service;
990Sstevel@tonic-gate {
1000Sstevel@tonic-gate 	char	*prev = _uu_setlocale(LC_ALL, "C");
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 	setconfig();
1030Sstevel@tonic-gate 	scansys(service);
1040Sstevel@tonic-gate 	(void) _uu_resetlocale(LC_ALL, prev);
1050Sstevel@tonic-gate 	return;
1060Sstevel@tonic-gate }
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate /*
1090Sstevel@tonic-gate  * setdevcfg init's Pops, Pushes lists from Devconfig
1100Sstevel@tonic-gate  */
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate GLOBAL void
setdevcfg(service,device)1130Sstevel@tonic-gate setdevcfg(service, device)
1140Sstevel@tonic-gate char *service, *device;
1150Sstevel@tonic-gate {
1160Sstevel@tonic-gate 	char	*prev = _uu_setlocale(LC_ALL, "C");
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate 	scancfg(service, device);
1190Sstevel@tonic-gate 	(void) _uu_resetlocale(LC_ALL, prev);
1200Sstevel@tonic-gate 	return;
1210Sstevel@tonic-gate }
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate /*	administrative files access */
1240Sstevel@tonic-gate GLOBAL int
sysaccess(type)1250Sstevel@tonic-gate sysaccess(type)
1260Sstevel@tonic-gate int type;
1270Sstevel@tonic-gate {
1280Sstevel@tonic-gate 	switch (type) {
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate 	case ACCESS_SYSTEMS:
1310Sstevel@tonic-gate 		return(access(Systems[nsystems], R_OK));
1320Sstevel@tonic-gate 	case ACCESS_DEVICES:
1330Sstevel@tonic-gate 		return(access(Devices[ndevices], R_OK));
1340Sstevel@tonic-gate 	case ACCESS_DIALERS:
1350Sstevel@tonic-gate 		return(access(Dialers[ndialers], R_OK));
1360Sstevel@tonic-gate 	case EACCESS_SYSTEMS:
1370Sstevel@tonic-gate 		return(eaccess(Systems[nsystems], R_OK));
1380Sstevel@tonic-gate 	case EACCESS_DEVICES:
1390Sstevel@tonic-gate 		return(eaccess(Devices[ndevices], R_OK));
1400Sstevel@tonic-gate 	case EACCESS_DIALERS:
1410Sstevel@tonic-gate 		return(eaccess(Dialers[ndialers], R_OK));
1420Sstevel@tonic-gate 	default:
1430Sstevel@tonic-gate 		(void)sprintf(errformat, "bad access type %d", type);
1440Sstevel@tonic-gate 		logent(errformat, "sysaccess");
1450Sstevel@tonic-gate 		return(FAIL);
1460Sstevel@tonic-gate 	}
1470Sstevel@tonic-gate }
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate /*
1510Sstevel@tonic-gate  * read Sysfiles, set up lists of Systems/Devices/Dialers file names.
1520Sstevel@tonic-gate  * allow multiple entries for a given service, allow a service
1530Sstevel@tonic-gate  * type to describe resources more than once, e.g., systems=foo:baz systems=bar.
1540Sstevel@tonic-gate  */
1550Sstevel@tonic-gate static void
scansys(service)1560Sstevel@tonic-gate scansys(service)
1570Sstevel@tonic-gate char *service;
1580Sstevel@tonic-gate {	FILE *f;
1590Sstevel@tonic-gate 	char *tok, buf[BUFSIZ];
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate 	Systems[0] = Devices[0] = Dialers[0] = NULL;
1620Sstevel@tonic-gate 	if ((f = fopen(SYSFILES, "r")) != 0) {
163*13093SRoger.Faulkner@Oracle.COM 		while (getaline(f, buf) > 0) {
1640Sstevel@tonic-gate 			/* got a (logical) line from Sysfiles */
1650Sstevel@tonic-gate 			/* strtok's of this buf continue in tokenize() */
1660Sstevel@tonic-gate 			tok = strtok(buf, " \t");
1670Sstevel@tonic-gate 			if (namematch("service=", tok, service)) {
1680Sstevel@tonic-gate 				tokenize();
1690Sstevel@tonic-gate 				nameparse();
1700Sstevel@tonic-gate 			}
1710Sstevel@tonic-gate 		}
1720Sstevel@tonic-gate 		(void) fclose(f);
1730Sstevel@tonic-gate 	}
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate 	/* if didn't find entries in Sysfiles, use defaults */
1760Sstevel@tonic-gate 	if (Systems[0] == NULL) {
1770Sstevel@tonic-gate 		Systems[0] = strsave(SYSTEMS);
1780Sstevel@tonic-gate 		ASSERT(Systems[0] != NULL, Ct_ALLOCATE, "scansys: Systems", 0);
1790Sstevel@tonic-gate 		Systems[1] = NULL;
1800Sstevel@tonic-gate 	}
1810Sstevel@tonic-gate 	if (Devices[0] == NULL) {
1820Sstevel@tonic-gate 		Devices[0] = strsave(DEVICES);
1830Sstevel@tonic-gate 		ASSERT(Devices[0] != NULL, Ct_ALLOCATE, "scansys: Devices", 0);
1840Sstevel@tonic-gate 		Devices[1] = NULL;
1850Sstevel@tonic-gate 	}
1860Sstevel@tonic-gate 	if (Dialers[0] == NULL) {
1870Sstevel@tonic-gate 		Dialers[0] = strsave(DIALERS);
1880Sstevel@tonic-gate 		ASSERT(Dialers[0] != NULL, Ct_ALLOCATE, "scansys: Dialers", 0);
1890Sstevel@tonic-gate 		Dialers[1] = NULL;
1900Sstevel@tonic-gate 	}
1910Sstevel@tonic-gate 	return;
1920Sstevel@tonic-gate }
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate /*
1960Sstevel@tonic-gate  * read Devconfig.  allow multiple entries for a given service, allow a service
1970Sstevel@tonic-gate  * type to describe resources more than once, e.g., push=foo:baz push=bar.
1980Sstevel@tonic-gate  */
1990Sstevel@tonic-gate static void
scancfg(service,device)2000Sstevel@tonic-gate scancfg(service, device)
2010Sstevel@tonic-gate char *service, *device;
2020Sstevel@tonic-gate {	FILE *f;
2030Sstevel@tonic-gate 	char *tok, buf[BUFSIZ];
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate 	/* (re)initialize device-specific information */
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate 	npops = npushes = 0;
2080Sstevel@tonic-gate 	Pops[0] = Pushes[0] = NULL;
2090Sstevel@tonic-gate 	connecttime = CONNECTTIME;
2100Sstevel@tonic-gate 	expecttime = EXPECTTIME;
2110Sstevel@tonic-gate 	msgtime = MSGTIME;
2120Sstevel@tonic-gate 
2130Sstevel@tonic-gate 	if ((f = fopen(DEVCONFIG, "r")) != 0) {
214*13093SRoger.Faulkner@Oracle.COM 		while (getaline(f, buf) > 0) {
2150Sstevel@tonic-gate 			/* got a (logical) line from Devconfig */
2160Sstevel@tonic-gate 			/* strtok's of this buf continue in tokenize() */
2170Sstevel@tonic-gate 			tok = strtok(buf, " \t");
2180Sstevel@tonic-gate 			if (namematch("service=", tok, service)) {
2190Sstevel@tonic-gate 				tok = strtok((char *)0, " \t");
2200Sstevel@tonic-gate 				if ( namematch("device=", tok, device)) {
2210Sstevel@tonic-gate 					tokenize();
2220Sstevel@tonic-gate 					nameparse();
2230Sstevel@tonic-gate 				}
2240Sstevel@tonic-gate 			}
2250Sstevel@tonic-gate 		}
2260Sstevel@tonic-gate 		(void) fclose(f);
2270Sstevel@tonic-gate 	}
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate 	return;
2300Sstevel@tonic-gate 
2310Sstevel@tonic-gate }
2320Sstevel@tonic-gate 
2330Sstevel@tonic-gate /*
2340Sstevel@tonic-gate  *  given a file pointer and buffer, construct logical line in buffer
2350Sstevel@tonic-gate  *  (i.e., concatenate lines ending in '\').  return length of line
2360Sstevel@tonic-gate  *  ASSUMES that buffer is BUFSIZ long!
2370Sstevel@tonic-gate  */
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate static int
getaline(f,line)240*13093SRoger.Faulkner@Oracle.COM getaline(f, line)
2410Sstevel@tonic-gate FILE *f;
2420Sstevel@tonic-gate char *line;
2430Sstevel@tonic-gate {	char *lptr, *lend;
2440Sstevel@tonic-gate 
2450Sstevel@tonic-gate 	lptr = line;
2460Sstevel@tonic-gate 	while (fgets(lptr, (line + BUFSIZ) - lptr, f) != NULL) {
2470Sstevel@tonic-gate 		lend = lptr + strlen(lptr);
2480Sstevel@tonic-gate 		if (lend == lptr || lend[-1] != '\n')
2490Sstevel@tonic-gate 			/* empty buf or line too long! */
2500Sstevel@tonic-gate 			break;
2510Sstevel@tonic-gate 		*--lend = '\0'; /* lop off ending '\n' */
2520Sstevel@tonic-gate 		if ( lend == line ) /* empty line - ignore */
2530Sstevel@tonic-gate 			continue;
2540Sstevel@tonic-gate 		lptr = lend;
2550Sstevel@tonic-gate 		if (lend[-1] != '\\')
2560Sstevel@tonic-gate 			break;
2570Sstevel@tonic-gate 		/* continuation */
2580Sstevel@tonic-gate 		lend[-1] = ' ';
2590Sstevel@tonic-gate 	}
2600Sstevel@tonic-gate 	return(lptr - line);
2610Sstevel@tonic-gate }
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate /*
2640Sstevel@tonic-gate  * given a label (e.g., "service=", "device="), a name ("cu", "uucico"),
2650Sstevel@tonic-gate  *  and a line:  if line begins with the label and if the name appears
2660Sstevel@tonic-gate  * in a colon-separated list of names following the label, return true;
2670Sstevel@tonic-gate  * else return false
2680Sstevel@tonic-gate  */
2690Sstevel@tonic-gate static int
namematch(label,line,name)2700Sstevel@tonic-gate namematch(label, line, name)
2710Sstevel@tonic-gate char *label, *line, *name;
2720Sstevel@tonic-gate {	char *lend;
2730Sstevel@tonic-gate 
2740Sstevel@tonic-gate 	if (strncmp(label, line, strlen(label)) != SAME) {
2750Sstevel@tonic-gate 		return(FALSE);	/* probably a comment line */
2760Sstevel@tonic-gate 	}
2770Sstevel@tonic-gate 	line += strlen(label);
2780Sstevel@tonic-gate 	if (*line == '\0')
2790Sstevel@tonic-gate 		return(FALSE);
2800Sstevel@tonic-gate 	/*
2810Sstevel@tonic-gate 	 * can't use strtok() in the following because scansys(),
2820Sstevel@tonic-gate 	 * scancfg() do an initializing call to strtok() before
2830Sstevel@tonic-gate 	 * coming here and then CONTINUE calling strtok() in tokenize(),
2840Sstevel@tonic-gate 	 * after returning from namematch().
2850Sstevel@tonic-gate 	 */
2860Sstevel@tonic-gate 	while ((lend = strchr(line, ':')) != NULL) {
2870Sstevel@tonic-gate 		*lend = '\0';
2880Sstevel@tonic-gate 		if (strcmp(line, name) == SAME)
2890Sstevel@tonic-gate 			return(TRUE);
2900Sstevel@tonic-gate 		line = lend+1;
2910Sstevel@tonic-gate 	}
2920Sstevel@tonic-gate 	return(strcmp(line, name) == SAME);
2930Sstevel@tonic-gate }
2940Sstevel@tonic-gate 
2950Sstevel@tonic-gate /*
2960Sstevel@tonic-gate  * tokenize() continues pulling tokens out of a buffer -- the
2970Sstevel@tonic-gate  * initializing call to strtok must have been made before calling
2980Sstevel@tonic-gate  * tokenize() -- and starts stuffing 'em into tokptr.
2990Sstevel@tonic-gate  */
3000Sstevel@tonic-gate static void
tokenize()3010Sstevel@tonic-gate tokenize()
3020Sstevel@tonic-gate {	char *tok;
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate 	tokptr = tokens;
3050Sstevel@tonic-gate 	while ((tok = strtok((char *) NULL, " \t")) != NULL) {
3060Sstevel@tonic-gate 		*tokptr++ = tok;
3070Sstevel@tonic-gate 		if (tokptr - tokens >= NTOKENS)
3080Sstevel@tonic-gate 			break;
3090Sstevel@tonic-gate 	}
3100Sstevel@tonic-gate 	*tokptr = NULL;
3110Sstevel@tonic-gate 	return;
3120Sstevel@tonic-gate }
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate /*
3150Sstevel@tonic-gate  * look at top token in array: should be line of the form
3160Sstevel@tonic-gate  *	name=item1:item2:item3...
3170Sstevel@tonic-gate  * if name is one we recognize, then call set[file|ioctl] to set up
3180Sstevel@tonic-gate  * corresponding list.  otherwise, log bad name.
3190Sstevel@tonic-gate  */
3200Sstevel@tonic-gate static void
nameparse()3210Sstevel@tonic-gate nameparse()
3220Sstevel@tonic-gate {	char **line, *equals;
3230Sstevel@tonic-gate 	int temp;
3240Sstevel@tonic-gate 
3250Sstevel@tonic-gate #define setuint(a,b,c) a = ( ((temp = atoi(b)) <= 0) ? (c) : temp )
3260Sstevel@tonic-gate 
3270Sstevel@tonic-gate 	for (line = tokens; (line - tokens) < NTOKENS && *line; line++) {
3280Sstevel@tonic-gate 		equals = strchr(*line, '=');
3290Sstevel@tonic-gate 		if (equals == NULL)
3300Sstevel@tonic-gate 			continue;	/* may be meaningful someday? */
3310Sstevel@tonic-gate 		*equals = '\0';
3320Sstevel@tonic-gate 		/* ignore entry with empty rhs */
3330Sstevel@tonic-gate 		if (*++equals == '\0')
3340Sstevel@tonic-gate 			continue;
3350Sstevel@tonic-gate 		if (strcmp(*line, "systems") == SAME)
3360Sstevel@tonic-gate 			setfile(Systems, equals);
3370Sstevel@tonic-gate 		else if (strcmp(*line, "devices") == SAME)
3380Sstevel@tonic-gate 			setfile(Devices, equals);
3390Sstevel@tonic-gate 		else if (strcmp(*line, "dialers") == SAME)
3400Sstevel@tonic-gate 			setfile(Dialers, equals);
3410Sstevel@tonic-gate 		else if (strcmp(*line, "pop") == SAME)
3420Sstevel@tonic-gate 			setioctl(Pops, equals);
3430Sstevel@tonic-gate 		else if (strcmp(*line, "push") == SAME)
3440Sstevel@tonic-gate 			setioctl(Pushes, equals);
3450Sstevel@tonic-gate 		else if (strcmp(*line, "connecttime") == SAME)
3460Sstevel@tonic-gate 			setuint(connecttime, equals, CONNECTTIME);
3470Sstevel@tonic-gate 		else if (strcmp(*line, "expecttime") == SAME)
3480Sstevel@tonic-gate 			setuint(expecttime, equals, EXPECTTIME);
3490Sstevel@tonic-gate 		else if (strcmp(*line, "msgtime") == SAME)
3500Sstevel@tonic-gate 			setuint(msgtime, equals, MSGTIME);
3510Sstevel@tonic-gate 		else {
3520Sstevel@tonic-gate 			(void)sprintf(errformat,"unrecognized label %s",*line);
3530Sstevel@tonic-gate 			logent(errformat, "Sysfiles|Devconfig");
3540Sstevel@tonic-gate 		}
3550Sstevel@tonic-gate 	}
3560Sstevel@tonic-gate 	return;
3570Sstevel@tonic-gate }
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate /*
3600Sstevel@tonic-gate  * given the list for a particular type (systems, devices,...)
3610Sstevel@tonic-gate  * and a line of colon-separated files, add 'em to list
3620Sstevel@tonic-gate  */
3630Sstevel@tonic-gate 
3640Sstevel@tonic-gate static void
setfile(type,line)3650Sstevel@tonic-gate setfile(type, line)
3660Sstevel@tonic-gate char **type, *line;
3670Sstevel@tonic-gate {	char **tptr, *tok;
3680Sstevel@tonic-gate 	char expandpath[BUFSIZ];
3690Sstevel@tonic-gate 
3700Sstevel@tonic-gate 	if (*line == 0)
3710Sstevel@tonic-gate 		return;
3720Sstevel@tonic-gate 	tptr = type;
3730Sstevel@tonic-gate 	while (*tptr)		/* skip over existing entries to*/
3740Sstevel@tonic-gate 		tptr++;		/* concatenate multiple entries */
3750Sstevel@tonic-gate 
3760Sstevel@tonic-gate 	for (tok = strtok(line, ":"); tok != NULL;
3770Sstevel@tonic-gate 	tok = strtok((char *) NULL, ":")) {
3780Sstevel@tonic-gate 		expandpath[0] = '\0';
3790Sstevel@tonic-gate 		if ( *tok != '/' )
3800Sstevel@tonic-gate 			/* by default, file names are relative to SYSDIR */
3810Sstevel@tonic-gate 			sprintf(expandpath, "%s/", SYSDIR);
3820Sstevel@tonic-gate 		strcat(expandpath, tok);
3830Sstevel@tonic-gate 		if (eaccess(expandpath, R_OK) != 0)
3840Sstevel@tonic-gate 			/* if we can't read it, no point in adding to list */
3850Sstevel@tonic-gate 			continue;
3860Sstevel@tonic-gate 		*tptr = strsave(expandpath);
3870Sstevel@tonic-gate 		ASSERT(*tptr != NULL, Ct_ALLOCATE, "setfile: tptr", 0);
3880Sstevel@tonic-gate 		tptr++;
3890Sstevel@tonic-gate 	}
3900Sstevel@tonic-gate 	return;
3910Sstevel@tonic-gate }
3920Sstevel@tonic-gate 
3930Sstevel@tonic-gate /*
3940Sstevel@tonic-gate  * given the list for a particular ioctl (push, pop)
3950Sstevel@tonic-gate  * and a line of colon-separated modules, add 'em to list
3960Sstevel@tonic-gate  */
3970Sstevel@tonic-gate 
3980Sstevel@tonic-gate static void
setioctl(type,line)3990Sstevel@tonic-gate setioctl(type, line)
4000Sstevel@tonic-gate char **type, *line;
4010Sstevel@tonic-gate {	char **tptr, *tok;
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate 	if (*line == 0)
4040Sstevel@tonic-gate 		return;
4050Sstevel@tonic-gate 	tptr = type;
4060Sstevel@tonic-gate 	while (*tptr)		/* skip over existing entries to*/
4070Sstevel@tonic-gate 		tptr++;		/* concatenate multiple entries */
4080Sstevel@tonic-gate 	for (tok = strtok(line, ":"); tok != NULL;
4090Sstevel@tonic-gate 	tok = strtok((char *) NULL, ":")) {
4100Sstevel@tonic-gate 		*tptr = strsave(tok);
4110Sstevel@tonic-gate 		ASSERT(*tptr != NULL, Ct_ALLOCATE, "setioctl: tptr", 0);
4120Sstevel@tonic-gate 		tptr++;
4130Sstevel@tonic-gate 	}
4140Sstevel@tonic-gate 	return;
4150Sstevel@tonic-gate }
4160Sstevel@tonic-gate 
4170Sstevel@tonic-gate /*
4180Sstevel@tonic-gate  * reset Systems files
4190Sstevel@tonic-gate  */
4200Sstevel@tonic-gate GLOBAL void
sysreset()4210Sstevel@tonic-gate sysreset()
4220Sstevel@tonic-gate {
4230Sstevel@tonic-gate 	if (fsystems)
4240Sstevel@tonic-gate 		fclose(fsystems);
4250Sstevel@tonic-gate 	fsystems = NULL;
4260Sstevel@tonic-gate 	nsystems = 0;
4270Sstevel@tonic-gate 	devreset();
4280Sstevel@tonic-gate 	return;
4290Sstevel@tonic-gate }
4300Sstevel@tonic-gate 
4310Sstevel@tonic-gate /*
4320Sstevel@tonic-gate  * reset Devices files
4330Sstevel@tonic-gate  */
4340Sstevel@tonic-gate GLOBAL void
devreset()4350Sstevel@tonic-gate devreset()
4360Sstevel@tonic-gate {
4370Sstevel@tonic-gate 	if (fdevices)
4380Sstevel@tonic-gate 		fclose(fdevices);
4390Sstevel@tonic-gate 	fdevices = NULL;
4400Sstevel@tonic-gate 	ndevices = 0;
4410Sstevel@tonic-gate 	dialreset();
4420Sstevel@tonic-gate 	return;
4430Sstevel@tonic-gate }
4440Sstevel@tonic-gate 
4450Sstevel@tonic-gate /*
4460Sstevel@tonic-gate  * reset Dialers files
4470Sstevel@tonic-gate  */
4480Sstevel@tonic-gate GLOBAL void
dialreset()4490Sstevel@tonic-gate dialreset()
4500Sstevel@tonic-gate {
4510Sstevel@tonic-gate 	if (fdialers)
4520Sstevel@tonic-gate 		fclose(fdialers);
4530Sstevel@tonic-gate 	fdialers = NULL;
4540Sstevel@tonic-gate 	ndialers = 0;
4550Sstevel@tonic-gate 	return;
4560Sstevel@tonic-gate }
4570Sstevel@tonic-gate 
4580Sstevel@tonic-gate /*
4590Sstevel@tonic-gate  * get next line from Systems file
4600Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
4610Sstevel@tonic-gate  */
4620Sstevel@tonic-gate GLOBAL int
getsysline(buf,len)4630Sstevel@tonic-gate getsysline(buf, len)
4640Sstevel@tonic-gate char *buf;
4650Sstevel@tonic-gate {
4660Sstevel@tonic-gate 	char	*prev = _uu_setlocale(LC_ALL, "C");
4670Sstevel@tonic-gate 
4680Sstevel@tonic-gate 	if (Systems[0] == NULL)
4690Sstevel@tonic-gate 		/* not initialized via setservice() - use default */
4700Sstevel@tonic-gate 		setservice("uucico");
4710Sstevel@tonic-gate 
4720Sstevel@tonic-gate 	/* initialize devices and dialers whenever a new line is read */
4730Sstevel@tonic-gate 	/* from systems */
4740Sstevel@tonic-gate 	devreset();
4750Sstevel@tonic-gate 	if (fsystems == NULL)
4760Sstevel@tonic-gate 		if (nextsystems() == FALSE) {
4770Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
4780Sstevel@tonic-gate 			return(FALSE);
4790Sstevel@tonic-gate 		}
4800Sstevel@tonic-gate 
4810Sstevel@tonic-gate 	ASSERT(len >= BUFSIZ, "BUFFER TOO SMALL", "getsysline", 0);
4820Sstevel@tonic-gate 	for(;;) {
483*13093SRoger.Faulkner@Oracle.COM 		while (getaline(fsystems, buf) != NULL)
4840Sstevel@tonic-gate 		    if ((*buf != '#') && (*buf != ' ') &&
4850Sstevel@tonic-gate 			(*buf != '\t') && (*buf != '\n')) {
4860Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
4870Sstevel@tonic-gate 			return(TRUE);
4880Sstevel@tonic-gate 		}
4890Sstevel@tonic-gate 		if (nextsystems() == FALSE) {
4900Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
4910Sstevel@tonic-gate 			return(FALSE);
4920Sstevel@tonic-gate 		}
4930Sstevel@tonic-gate 	}
4940Sstevel@tonic-gate }
4950Sstevel@tonic-gate 
4960Sstevel@tonic-gate /*
4970Sstevel@tonic-gate  * move to next systems file.  return TRUE if successful, FALSE if not
4980Sstevel@tonic-gate  */
4990Sstevel@tonic-gate static int
nextsystems()5000Sstevel@tonic-gate nextsystems()
5010Sstevel@tonic-gate {
5020Sstevel@tonic-gate 	devreset();
5030Sstevel@tonic-gate 
5040Sstevel@tonic-gate 	if (fsystems != NULL) {
5050Sstevel@tonic-gate 		(void) fclose(fsystems);
5060Sstevel@tonic-gate 		nsystems++;
5070Sstevel@tonic-gate 	} else {
5080Sstevel@tonic-gate 		nsystems = 0;
5090Sstevel@tonic-gate 	}
5100Sstevel@tonic-gate 	for ( ; Systems[nsystems] != NULL; nsystems++)
5110Sstevel@tonic-gate 		if ((fsystems = fopen(Systems[nsystems], "r")) != NULL)
5120Sstevel@tonic-gate 			return(TRUE);
5130Sstevel@tonic-gate 	return(FALSE);
5140Sstevel@tonic-gate }
5150Sstevel@tonic-gate 
5160Sstevel@tonic-gate /*
5170Sstevel@tonic-gate  * get next line from Devices file
5180Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
5190Sstevel@tonic-gate  */
5200Sstevel@tonic-gate GLOBAL int
getdevline(buf,len)5210Sstevel@tonic-gate getdevline(buf, len)
5220Sstevel@tonic-gate char *buf;
5230Sstevel@tonic-gate {
5240Sstevel@tonic-gate 	char	*prev = _uu_setlocale(LC_ALL, "C");
5250Sstevel@tonic-gate 
5260Sstevel@tonic-gate 	if (Devices[0] == NULL)
5270Sstevel@tonic-gate 		/* not initialized via setservice() - use default */
5280Sstevel@tonic-gate 		setservice("uucico");
5290Sstevel@tonic-gate 
5300Sstevel@tonic-gate 	if (fdevices == NULL)
5310Sstevel@tonic-gate 		if (nextdevices() == FALSE) {
5320Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5330Sstevel@tonic-gate 			return(FALSE);
5340Sstevel@tonic-gate 		}
5350Sstevel@tonic-gate 	for(;;) {
5360Sstevel@tonic-gate 		if (fgets(buf, len, fdevices) != NULL) {
5370Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5380Sstevel@tonic-gate 			return(TRUE);
5390Sstevel@tonic-gate 		}
5400Sstevel@tonic-gate 		if (nextdevices() == FALSE) {
5410Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5420Sstevel@tonic-gate 			return(FALSE);
5430Sstevel@tonic-gate 		}
5440Sstevel@tonic-gate 	}
5450Sstevel@tonic-gate }
5460Sstevel@tonic-gate 
5470Sstevel@tonic-gate /*
5480Sstevel@tonic-gate  * move to next devices file.  return TRUE if successful, FALSE if not
5490Sstevel@tonic-gate  */
5500Sstevel@tonic-gate static int
nextdevices()5510Sstevel@tonic-gate nextdevices()
5520Sstevel@tonic-gate {
5530Sstevel@tonic-gate 	if (fdevices != NULL) {
5540Sstevel@tonic-gate 		(void) fclose(fdevices);
5550Sstevel@tonic-gate 		ndevices++;
5560Sstevel@tonic-gate 	} else {
5570Sstevel@tonic-gate 		ndevices = 0;
5580Sstevel@tonic-gate 	}
5590Sstevel@tonic-gate 	for ( ; Devices[ndevices] != NULL; ndevices++)
5600Sstevel@tonic-gate 		if ((fdevices = fopen(Devices[ndevices], "r")) != NULL)
5610Sstevel@tonic-gate 			return(TRUE);
5620Sstevel@tonic-gate 	return(FALSE);
5630Sstevel@tonic-gate }
5640Sstevel@tonic-gate 
5650Sstevel@tonic-gate 
5660Sstevel@tonic-gate /*
5670Sstevel@tonic-gate  * get next line from Dialers file
5680Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
5690Sstevel@tonic-gate  */
5700Sstevel@tonic-gate 
5710Sstevel@tonic-gate GLOBAL int
getdialline(buf,len)5720Sstevel@tonic-gate getdialline(buf, len)
5730Sstevel@tonic-gate char *buf;
5740Sstevel@tonic-gate {
5750Sstevel@tonic-gate 	char	*prev = _uu_setlocale(LC_ALL, "C");
5760Sstevel@tonic-gate 
5770Sstevel@tonic-gate 	if (Dialers[0] == NULL)
5780Sstevel@tonic-gate 		/* not initialized via setservice() - use default */
5790Sstevel@tonic-gate 		setservice("uucico");
5800Sstevel@tonic-gate 
5810Sstevel@tonic-gate 	if (fdialers == NULL)
5820Sstevel@tonic-gate 		if (nextdialers() == FALSE) {
5830Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5840Sstevel@tonic-gate 			return(FALSE);
5850Sstevel@tonic-gate 		}
5860Sstevel@tonic-gate 	for(;;) {
5870Sstevel@tonic-gate 		if (fgets(buf, len, fdialers) != NULL) {
5880Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5890Sstevel@tonic-gate 			return(TRUE);
5900Sstevel@tonic-gate 		}
5910Sstevel@tonic-gate 		if (nextdialers() == FALSE) {
5920Sstevel@tonic-gate 			(void) _uu_resetlocale(LC_ALL, prev);
5930Sstevel@tonic-gate 			return(FALSE);
5940Sstevel@tonic-gate 		}
5950Sstevel@tonic-gate 	}
5960Sstevel@tonic-gate }
5970Sstevel@tonic-gate 
5980Sstevel@tonic-gate /*
5990Sstevel@tonic-gate  * move to next dialers file.  return TRUE if successful, FALSE if not
6000Sstevel@tonic-gate  */
6010Sstevel@tonic-gate static int
nextdialers()6020Sstevel@tonic-gate nextdialers()
6030Sstevel@tonic-gate {
6040Sstevel@tonic-gate 	if (fdialers) {
6050Sstevel@tonic-gate 		(void) fclose(fdialers);
6060Sstevel@tonic-gate 		ndialers++;
6070Sstevel@tonic-gate 	} else {
6080Sstevel@tonic-gate 		ndialers = 0;
6090Sstevel@tonic-gate 	}
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate 	for ( ; Dialers[ndialers] != NULL; ndialers++)
6120Sstevel@tonic-gate 		if ((fdialers = fopen(Dialers[ndialers], "r")) != NULL)
6130Sstevel@tonic-gate 			return(TRUE);
6140Sstevel@tonic-gate 	return(FALSE);
6150Sstevel@tonic-gate }
6160Sstevel@tonic-gate 
6170Sstevel@tonic-gate /*
6180Sstevel@tonic-gate  * get next module to be popped
6190Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
6200Sstevel@tonic-gate  */
6210Sstevel@tonic-gate static int
getpop(buf,len,optional)6220Sstevel@tonic-gate getpop(buf, len, optional)
6230Sstevel@tonic-gate char *buf;
6240Sstevel@tonic-gate int len, *optional;
6250Sstevel@tonic-gate {
6260Sstevel@tonic-gate 	int slen;
6270Sstevel@tonic-gate 
6280Sstevel@tonic-gate 	if ( Pops[0] == NULL || Pops[npops] == NULL )
6290Sstevel@tonic-gate 		return(FALSE);
6300Sstevel@tonic-gate 
6310Sstevel@tonic-gate 	/*	if the module name is enclosed in parentheses,	*/
6320Sstevel@tonic-gate 	/*	is optional. set flag & strip parens		*/
6330Sstevel@tonic-gate 	slen = strlen(Pops[npops]) - 1;
6340Sstevel@tonic-gate 	if ( Pops[npops][0] == '('  && Pops[npops][slen] == ')' ) {
6350Sstevel@tonic-gate 		*optional = 1;
6360Sstevel@tonic-gate 		len = ( slen < len ? slen : len );
6370Sstevel@tonic-gate 		strncpy(buf, &(Pops[npops++][1]), len);
6380Sstevel@tonic-gate 	} else {
6390Sstevel@tonic-gate 		*optional = 0;
6400Sstevel@tonic-gate 		strncpy(buf, Pops[npops++], len);
6410Sstevel@tonic-gate 	}
6420Sstevel@tonic-gate 	buf[len-1] = '\0';
6430Sstevel@tonic-gate 	return(TRUE);
6440Sstevel@tonic-gate }
6450Sstevel@tonic-gate 
6460Sstevel@tonic-gate /*
6470Sstevel@tonic-gate  * get next module to be pushed
6480Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
6490Sstevel@tonic-gate  */
6500Sstevel@tonic-gate static int
getpush(buf,len)6510Sstevel@tonic-gate getpush(buf, len)
6520Sstevel@tonic-gate char *buf;
6530Sstevel@tonic-gate int len;
6540Sstevel@tonic-gate {
6550Sstevel@tonic-gate 	if ( Pushes[0] == NULL || Pushes[npushes] == NULL )
6560Sstevel@tonic-gate 		return(FALSE);
6570Sstevel@tonic-gate 	strncpy(buf, Pushes[npushes++], len);
6580Sstevel@tonic-gate 	return(TRUE);
6590Sstevel@tonic-gate }
6600Sstevel@tonic-gate 
6610Sstevel@tonic-gate /*
6620Sstevel@tonic-gate  * pop/push requested modules
6630Sstevel@tonic-gate  * return TRUE if successful, FALSE if not
6640Sstevel@tonic-gate  */
6650Sstevel@tonic-gate GLOBAL int
pop_push(fd)6660Sstevel@tonic-gate pop_push(fd)
6670Sstevel@tonic-gate int fd;
6680Sstevel@tonic-gate {
6690Sstevel@tonic-gate     char	strmod[FMNAMESZ], onstream[FMNAMESZ];
6700Sstevel@tonic-gate     int		optional;
6710Sstevel@tonic-gate     char	*prev = _uu_setlocale(LC_ALL, "C");
6720Sstevel@tonic-gate 
6730Sstevel@tonic-gate     /*	check for streams modules to pop	*/
6740Sstevel@tonic-gate     while ( getpop(strmod, sizeof(strmod), &optional) ) {
6750Sstevel@tonic-gate 	DEBUG(5, (optional ? "pop_push: optionally POPing %s\n"
6760Sstevel@tonic-gate 			   : "pop_push: POPing %s\n" ), strmod);
6770Sstevel@tonic-gate 	if ( ioctl(fd, I_LOOK, onstream) == -1 ) {
6780Sstevel@tonic-gate 	    DEBUG(5, "pop_push: I_LOOK on fd %d failed ", fd);
6790Sstevel@tonic-gate 	    DEBUG(5, "errno %d\n", errno);
6800Sstevel@tonic-gate 	    (void) _uu_resetlocale(LC_ALL, prev);
6810Sstevel@tonic-gate 	    return(FALSE);
6820Sstevel@tonic-gate 	}
6830Sstevel@tonic-gate 	if ( strcmp(strmod, onstream) != SAME ) {
6840Sstevel@tonic-gate 	    if ( optional )
6850Sstevel@tonic-gate 		continue;
6860Sstevel@tonic-gate 	    DEBUG(5, "pop_push: I_POP: %s not there\n", strmod);
6870Sstevel@tonic-gate 	    (void) _uu_resetlocale(LC_ALL, prev);
6880Sstevel@tonic-gate 	    return(FALSE);
6890Sstevel@tonic-gate 	}
6900Sstevel@tonic-gate 	if ( ioctl(fd, I_POP, 0) == -1 ) {
6910Sstevel@tonic-gate 	    DEBUG(5, "pop_push: I_POP on fd %d failed ", fd);
6920Sstevel@tonic-gate 	    DEBUG(5, "errno %d\n", errno);
6930Sstevel@tonic-gate 	    (void) _uu_resetlocale(LC_ALL, prev);
6940Sstevel@tonic-gate 	    return(FALSE);
6950Sstevel@tonic-gate 	}
6960Sstevel@tonic-gate     }
6970Sstevel@tonic-gate 
6980Sstevel@tonic-gate     /*	check for streams modules to push	*/
6990Sstevel@tonic-gate     while ( getpush(strmod, sizeof(strmod)) ) {
7000Sstevel@tonic-gate 	DEBUG(5, "pop_push: PUSHing %s\n", strmod);
7010Sstevel@tonic-gate 	if ( ioctl(fd, I_PUSH, strmod) == -1 ) {
7020Sstevel@tonic-gate 	    DEBUG(5, "pop_push: I_PUSH on fd %d failed ", fd);
7030Sstevel@tonic-gate 	    DEBUG(5, "errno %d\n", errno);
7040Sstevel@tonic-gate 	    (void) _uu_resetlocale(LC_ALL, prev);
7050Sstevel@tonic-gate 	    return(FALSE);
7060Sstevel@tonic-gate 	}
7070Sstevel@tonic-gate     }
7080Sstevel@tonic-gate     (void) _uu_resetlocale(LC_ALL, prev);
7090Sstevel@tonic-gate     return(TRUE);
7100Sstevel@tonic-gate }
7110Sstevel@tonic-gate 
7120Sstevel@tonic-gate /*
7130Sstevel@tonic-gate  * 	return name of currently open Systems file
7140Sstevel@tonic-gate  */
7150Sstevel@tonic-gate GLOBAL char *
currsys()7160Sstevel@tonic-gate currsys()
7170Sstevel@tonic-gate {
7180Sstevel@tonic-gate 	return(Systems[nsystems]);
7190Sstevel@tonic-gate }
7200Sstevel@tonic-gate 
7210Sstevel@tonic-gate /*
7220Sstevel@tonic-gate  * 	return name of currently open Devices file
7230Sstevel@tonic-gate  */
7240Sstevel@tonic-gate GLOBAL char *
currdev()7250Sstevel@tonic-gate currdev()
7260Sstevel@tonic-gate {
7270Sstevel@tonic-gate 	return(Devices[ndevices]);
7280Sstevel@tonic-gate }
7290Sstevel@tonic-gate 
7300Sstevel@tonic-gate /*
7310Sstevel@tonic-gate  * 	return name of currently open Dialers file
7320Sstevel@tonic-gate  */
7330Sstevel@tonic-gate GLOBAL char *
currdial()7340Sstevel@tonic-gate currdial()
7350Sstevel@tonic-gate {
7360Sstevel@tonic-gate 	return(Dialers[ndialers]);
7370Sstevel@tonic-gate }
7380Sstevel@tonic-gate 
7390Sstevel@tonic-gate /*
7400Sstevel@tonic-gate  * set configuration parameters provided in Config file
7410Sstevel@tonic-gate  */
7420Sstevel@tonic-gate static void
setconfig()7430Sstevel@tonic-gate setconfig()
7440Sstevel@tonic-gate {
7450Sstevel@tonic-gate     FILE *f;
7460Sstevel@tonic-gate     char buf[BUFSIZ];
7470Sstevel@tonic-gate     char *tok;
7480Sstevel@tonic-gate     extern char _ProtoCfg[];
7490Sstevel@tonic-gate 
7500Sstevel@tonic-gate     if ((f = fopen(CONFIG, "r")) != 0) {
751*13093SRoger.Faulkner@Oracle.COM 	while (getaline(f, buf) > 0) {
7520Sstevel@tonic-gate 	    /* got a (logical) line from Config file */
7530Sstevel@tonic-gate 	    tok = strtok(buf, " \t");
7540Sstevel@tonic-gate 	    if ( (tok != NULL) && (*tok != '#') ) {
7550Sstevel@tonic-gate 		/* got a token */
7560Sstevel@tonic-gate 
7570Sstevel@tonic-gate 		/* this probably should be table driven when
7580Sstevel@tonic-gate 		 * the list of configurable parameters grows.
7590Sstevel@tonic-gate 		 */
7600Sstevel@tonic-gate 		if (strncmp("Protocol=", tok, strlen("Protocol=")) == SAME) {
7610Sstevel@tonic-gate 		    tok += strlen("Protocol=");
7620Sstevel@tonic-gate 		    if ( *tok != '\0' ) {
7630Sstevel@tonic-gate 			if ( _ProtoCfg[0] != '\0' ) {
7640Sstevel@tonic-gate 			    DEBUG(7, "Protocol string %s ", tok);
7650Sstevel@tonic-gate 			    DEBUG(7, "overrides %s\n", _ProtoCfg);
7660Sstevel@tonic-gate 		        }
7670Sstevel@tonic-gate 		        strcpy(_ProtoCfg, tok);
7680Sstevel@tonic-gate 		    }
7690Sstevel@tonic-gate 	        } else {
7700Sstevel@tonic-gate 		    DEBUG(7, "Unknown configuration parameter %s\n", tok);
7710Sstevel@tonic-gate 	        }
7720Sstevel@tonic-gate 	    }
7730Sstevel@tonic-gate 	}
7740Sstevel@tonic-gate     }
7750Sstevel@tonic-gate }
776