xref: /onnv-gate/usr/src/cmd/sh/defs.h (revision 9369:4df685ccc8c1)
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
52256Sna195498  * Common Development and Distribution License (the "License").
62256Sna195498  * 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  */
210Sstevel@tonic-gate 
220Sstevel@tonic-gate /*
23*9369SNobutomo.Nakano@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
27527Schin /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28527Schin /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef	_DEFS_H
310Sstevel@tonic-gate #define	_DEFS_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #ifdef	__cplusplus
340Sstevel@tonic-gate extern "C" {
350Sstevel@tonic-gate #endif
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  *	UNIX shell
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /* execute flags */
420Sstevel@tonic-gate #define		XEC_EXECED	01
430Sstevel@tonic-gate #define			XEC_LINKED	02
440Sstevel@tonic-gate #define		XEC_NOSTOP	04
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /* endjobs flags */
470Sstevel@tonic-gate #define			JOB_STOPPED	01
480Sstevel@tonic-gate #define			JOB_RUNNING	02
490Sstevel@tonic-gate 
500Sstevel@tonic-gate /* error exits from various parts of shell */
510Sstevel@tonic-gate #define		ERROR		1
520Sstevel@tonic-gate #define		SYNBAD		2
530Sstevel@tonic-gate #define		SIGFAIL 	2000
540Sstevel@tonic-gate #define		SIGFLG		0200
550Sstevel@tonic-gate 
560Sstevel@tonic-gate /* command tree */
570Sstevel@tonic-gate #define		FPIN		0x0100
580Sstevel@tonic-gate #define		FPOU		0x0200
590Sstevel@tonic-gate #define		FAMP		0x0400
600Sstevel@tonic-gate #define		COMMSK		0x00F0
61*9369SNobutomo.Nakano@Sun.COM #define		CNTMSK		0x000F	/* this bit fields no longer used */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #define		TCOM		0x0000
640Sstevel@tonic-gate #define		TPAR		0x0010
650Sstevel@tonic-gate #define		TFIL		0x0020
660Sstevel@tonic-gate #define		TLST		0x0030
670Sstevel@tonic-gate #define		TIF			0x0040
680Sstevel@tonic-gate #define		TWH			0x0050
690Sstevel@tonic-gate #define		TUN			0x0060
700Sstevel@tonic-gate #define		TSW			0x0070
710Sstevel@tonic-gate #define		TAND		0x0080
720Sstevel@tonic-gate #define		TORF		0x0090
730Sstevel@tonic-gate #define		TFORK		0x00A0
740Sstevel@tonic-gate #define		TFOR		0x00B0
750Sstevel@tonic-gate #define			TFND		0x00C0
760Sstevel@tonic-gate 
770Sstevel@tonic-gate /* execute table */
780Sstevel@tonic-gate #define		SYSSET		1
790Sstevel@tonic-gate #define		SYSCD		2
800Sstevel@tonic-gate #define		SYSEXEC		3
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #ifdef RES	/*	include login code	*/
830Sstevel@tonic-gate #define		SYSLOGIN	4
840Sstevel@tonic-gate #else
850Sstevel@tonic-gate #define		SYSNEWGRP 	4
860Sstevel@tonic-gate #endif
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #define		SYSTRAP		5
890Sstevel@tonic-gate #define		SYSEXIT		6
900Sstevel@tonic-gate #define		SYSSHFT 	7
910Sstevel@tonic-gate #define		SYSWAIT		8
920Sstevel@tonic-gate #define		SYSCONT 	9
930Sstevel@tonic-gate #define		SYSBREAK	10
940Sstevel@tonic-gate #define		SYSEVAL 	11
950Sstevel@tonic-gate #define		SYSDOT		12
960Sstevel@tonic-gate #define		SYSRDONLY 	13
970Sstevel@tonic-gate #define		SYSTIMES 	14
980Sstevel@tonic-gate #define		SYSXPORT	15
990Sstevel@tonic-gate #define		SYSNULL 	16
1000Sstevel@tonic-gate #define		SYSREAD 	17
1010Sstevel@tonic-gate #define			SYSTST		18
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate #ifndef RES	/*	exclude umask code	*/
1040Sstevel@tonic-gate #define		SYSUMASK 	20
1050Sstevel@tonic-gate #define		SYSULIMIT 	21
1060Sstevel@tonic-gate #endif
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate #define		SYSECHO		22
1090Sstevel@tonic-gate #define			SYSHASH		23
1100Sstevel@tonic-gate #define			SYSPWD		24
1110Sstevel@tonic-gate #define		SYSRETURN	25
1120Sstevel@tonic-gate #define			SYSUNS		26
1130Sstevel@tonic-gate #define			SYSMEM		27
1140Sstevel@tonic-gate #define			SYSTYPE  	28
1150Sstevel@tonic-gate #define			SYSGETOPT	29
1160Sstevel@tonic-gate #define		SYSJOBS		30
1170Sstevel@tonic-gate #define		SYSFGBG		31
1180Sstevel@tonic-gate #define		SYSKILL		32
1190Sstevel@tonic-gate #define		SYSSUSP		33
1200Sstevel@tonic-gate #define		SYSSTOP		34
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /* used for input and output of shell */
1230Sstevel@tonic-gate #define		INIO 		19
1240Sstevel@tonic-gate 
1250Sstevel@tonic-gate /* io nodes */
1260Sstevel@tonic-gate #define		USERIO		10
1270Sstevel@tonic-gate #define		IOUFD		15
1285976Snakanon #define		IODOC		0x0010
1295976Snakanon #define		IOPUT		0x0020
1305976Snakanon #define		IOAPP		0x0040
1315976Snakanon #define		IOMOV		0x0080
1325976Snakanon #define		IORDW		0x0100
1335976Snakanon #define		IOSTRIP		0x0200
1345976Snakanon #define		IODOC_SUBST	0x0400
1350Sstevel@tonic-gate #define		INPIPE		0
1360Sstevel@tonic-gate #define		OTPIPE		1
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /* arg list terminator */
1390Sstevel@tonic-gate #define		ENDARGS		0
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate #include	<unistd.h>
142527Schin #include 	"mac.h"
1430Sstevel@tonic-gate #include	"mode.h"
1440Sstevel@tonic-gate #include	"name.h"
1450Sstevel@tonic-gate #include	<signal.h>
1460Sstevel@tonic-gate #include	<sys/types.h>
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /* id's */
1490Sstevel@tonic-gate extern pid_t	mypid;
1500Sstevel@tonic-gate extern pid_t	mypgid;
1510Sstevel@tonic-gate extern pid_t	mysid;
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate /* getopt */
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate extern int		optind;
1560Sstevel@tonic-gate extern int		opterr;
1570Sstevel@tonic-gate extern int 		_sp;
1580Sstevel@tonic-gate extern char 		*optarg;
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate /* use sh-private versions of memory allocation routines */
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate #define		alloc 		malloc
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate /* result type declarations */
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate extern int handle();
1680Sstevel@tonic-gate extern void chktrap();
169527Schin extern void done(int)
170527Schin 	__NORETURN;
1710Sstevel@tonic-gate extern void sh_free();
1720Sstevel@tonic-gate extern unsigned char *make();
1730Sstevel@tonic-gate extern unsigned char *movstr();
1740Sstevel@tonic-gate extern unsigned char *movstrn();
1750Sstevel@tonic-gate extern unsigned char *cwdget();
1760Sstevel@tonic-gate extern struct trenod *cmd();
1770Sstevel@tonic-gate extern struct trenod *makefork();
1780Sstevel@tonic-gate extern struct namnod *lookup();
1790Sstevel@tonic-gate extern struct namnod *findnam();
1800Sstevel@tonic-gate extern struct dolnod *useargs();
1810Sstevel@tonic-gate extern float expr();
1820Sstevel@tonic-gate extern unsigned char *catpath();
1830Sstevel@tonic-gate extern unsigned char *getpath();
1840Sstevel@tonic-gate extern unsigned char *nextpath();
1850Sstevel@tonic-gate extern unsigned char **scan();
1860Sstevel@tonic-gate extern unsigned char *mactrim();
1870Sstevel@tonic-gate extern unsigned char *macro();
188527Schin extern void exname(struct namnod *);
189527Schin extern void printnam(struct namnod *);
190527Schin extern void printro(struct namnod *);
191527Schin extern void printexp(struct namnod *);
1920Sstevel@tonic-gate extern unsigned int readwc();
1930Sstevel@tonic-gate extern unsigned int nextwc();
1940Sstevel@tonic-gate extern unsigned char skipc();
1950Sstevel@tonic-gate extern unsigned char **local_setenv();
1960Sstevel@tonic-gate extern time_t time();
197527Schin extern void exitsh(int)
198527Schin 	__NORETURN;
1992256Sna195498 extern void failed_real(unsigned char *, const char *, unsigned char *)
2002256Sna195498     __NORETURN;
2012256Sna195498 extern void error(const char *) __NORETURN;
202527Schin extern void prf();
203527Schin extern void assign(struct namnod *, unsigned char *);
204527Schin extern void setmode(int);
205527Schin extern void trim(unsigned char *);
206527Schin extern void preacct(unsigned char *);
207*9369SNobutomo.Nakano@Sun.COM extern void addblok(unsigned int);
208*9369SNobutomo.Nakano@Sun.COM extern void freetree(struct trenod *);
209527Schin 
210527Schin 
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate #define		attrib(n, f)		(n->namflg |= f)
2130Sstevel@tonic-gate #define		round(a, b)		(((int)(((char *)(a)+b)-1))&~((b)-1))
2142256Sna195498 #define		closepipe(x)		(close(x[INPIPE]), close(x[OTPIPE]))
2150Sstevel@tonic-gate #define		eq(a, b)		(cf(a, b) == 0)
2160Sstevel@tonic-gate #define		max(a, b)		((a) > (b)?(a):(b))
2170Sstevel@tonic-gate #define		assert(x)
2182256Sna195498 #define		_gettext(s)		(unsigned char *)gettext(s)
2192256Sna195498 
2202256Sna195498 /*
2212256Sna195498  * macros using failed_real(). Only s2 is gettext'd with both functions.
2222256Sna195498  */
2232256Sna195498 #define		failed(s1, s2)		failed_real(s1, s2, NULL)
2242256Sna195498 #define		bfailed(s1, s2, s3)	failed_real(s1, s2, s3)
2252256Sna195498 
2262256Sna195498 /*
2272256Sna195498  * macros using failure_real(). s1 and s2 is gettext'd with gfailure(), but
2282256Sna195498  * only s2 is gettext'd with failure().
2292256Sna195498  */
2302256Sna195498 #define		failure(s1, s2)		failure_real(s1, s2, 0)
2312256Sna195498 #define		gfailure(s1, s2)	failure_real(s1, s2, 1)
2320Sstevel@tonic-gate 
2330Sstevel@tonic-gate /* temp files and io */
2340Sstevel@tonic-gate extern int				output;
2350Sstevel@tonic-gate extern int				ioset;
2360Sstevel@tonic-gate extern struct ionod	*iotemp; /* files to be deleted sometime */
2370Sstevel@tonic-gate extern struct ionod	*fiotemp; /* function files to be deleted sometime */
2380Sstevel@tonic-gate extern struct ionod	*iopend; /* documents waiting to be read at NL */
2390Sstevel@tonic-gate extern struct fdsave	fdmap[];
2400Sstevel@tonic-gate extern int savpipe;
2410Sstevel@tonic-gate 
2420Sstevel@tonic-gate /* substitution */
2430Sstevel@tonic-gate extern int				dolc;
2440Sstevel@tonic-gate extern unsigned char				**dolv;
2450Sstevel@tonic-gate extern struct dolnod	*argfor;
2460Sstevel@tonic-gate extern struct argnod	*gchain;
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate /* stak stuff */
2490Sstevel@tonic-gate #include		"stak.h"
2500Sstevel@tonic-gate 
2510Sstevel@tonic-gate /*
2520Sstevel@tonic-gate  * If non-ANSI C, make const go away.  We bring it back
2530Sstevel@tonic-gate  * at the end of the file to avoid side-effects.
2540Sstevel@tonic-gate  */
2550Sstevel@tonic-gate #ifndef __STDC__
2560Sstevel@tonic-gate #define	const
2570Sstevel@tonic-gate #endif
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate /* string constants */
2600Sstevel@tonic-gate extern const char				atline[];
2610Sstevel@tonic-gate extern const char				readmsg[];
2620Sstevel@tonic-gate extern const char				colon[];
2630Sstevel@tonic-gate extern const char				minus[];
2640Sstevel@tonic-gate extern const char				nullstr[];
2650Sstevel@tonic-gate extern const char				sptbnl[];
2660Sstevel@tonic-gate extern const char				unexpected[];
2670Sstevel@tonic-gate extern const char				endoffile[];
2680Sstevel@tonic-gate extern const char				synmsg[];
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate /* name tree and words */
2710Sstevel@tonic-gate extern const struct sysnod	reserved[];
2720Sstevel@tonic-gate extern const int				no_reserved;
2730Sstevel@tonic-gate extern const struct sysnod	commands[];
2740Sstevel@tonic-gate extern const int				no_commands;
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate extern int				wdval;
2770Sstevel@tonic-gate extern int				wdnum;
2780Sstevel@tonic-gate extern int				fndef;
2790Sstevel@tonic-gate extern int				nohash;
2800Sstevel@tonic-gate extern struct argnod	*wdarg;
2810Sstevel@tonic-gate extern int				wdset;
2820Sstevel@tonic-gate extern BOOL				reserv;
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate /* prompting */
2850Sstevel@tonic-gate extern const char				stdprompt[];
2860Sstevel@tonic-gate extern const char				supprompt[];
2870Sstevel@tonic-gate extern const char				profile[];
2880Sstevel@tonic-gate extern const char				sysprofile[];
2890Sstevel@tonic-gate 
2900Sstevel@tonic-gate /* locale testing */
2910Sstevel@tonic-gate extern const char			localedir[];
2920Sstevel@tonic-gate extern int				localedir_exists;
2930Sstevel@tonic-gate 
2940Sstevel@tonic-gate /* built in names */
2950Sstevel@tonic-gate extern struct namnod	fngnod;
2960Sstevel@tonic-gate extern struct namnod	cdpnod;
2970Sstevel@tonic-gate extern struct namnod	ifsnod;
2980Sstevel@tonic-gate extern struct namnod	homenod;
2990Sstevel@tonic-gate extern struct namnod	mailnod;
3000Sstevel@tonic-gate extern struct namnod	pathnod;
3010Sstevel@tonic-gate extern struct namnod	ps1nod;
3020Sstevel@tonic-gate extern struct namnod	ps2nod;
3030Sstevel@tonic-gate extern struct namnod	mchknod;
3040Sstevel@tonic-gate extern struct namnod	acctnod;
3050Sstevel@tonic-gate extern struct namnod	mailpnod;
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate /* special names */
3080Sstevel@tonic-gate extern unsigned char				flagadr[];
3090Sstevel@tonic-gate extern unsigned char				*pcsadr;
3100Sstevel@tonic-gate extern unsigned char				*pidadr;
3110Sstevel@tonic-gate extern unsigned char				*cmdadr;
3120Sstevel@tonic-gate 
3130Sstevel@tonic-gate /* names always present */
3140Sstevel@tonic-gate extern const char				defpath[];
3150Sstevel@tonic-gate extern const char				mailname[];
3160Sstevel@tonic-gate extern const char				homename[];
3170Sstevel@tonic-gate extern const char				pathname[];
3180Sstevel@tonic-gate extern const char				cdpname[];
3190Sstevel@tonic-gate extern const char				ifsname[];
3200Sstevel@tonic-gate extern const char				ps1name[];
3210Sstevel@tonic-gate extern const char				ps2name[];
3220Sstevel@tonic-gate extern const char				mchkname[];
3230Sstevel@tonic-gate extern const char				acctname[];
3240Sstevel@tonic-gate extern const char				mailpname[];
3250Sstevel@tonic-gate 
3260Sstevel@tonic-gate /* transput */
3270Sstevel@tonic-gate extern unsigned char				tmpout[];
328527Schin extern int 					tmpout_offset;
329527Schin extern unsigned int				serial;
3300Sstevel@tonic-gate 
331527Schin /*
332527Schin  * allow plenty of room for size for temp file name:
333527Schin  * "/tmp/sh"(7) + <pid> (<=6) + <unsigned int #> (<=10) + \0 (1)
334527Schin  */
335527Schin #define			TMPOUTSZ 		32
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate extern struct fileblk	*standin;
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate #define		input		(standin->fdes)
3400Sstevel@tonic-gate #define		eof			(standin->feof)
3410Sstevel@tonic-gate 
3420Sstevel@tonic-gate extern int				peekc;
3430Sstevel@tonic-gate extern int				peekn;
3440Sstevel@tonic-gate extern unsigned char				*comdiv;
3450Sstevel@tonic-gate extern
3460Sstevel@tonic-gate #ifdef __STDC__
3470Sstevel@tonic-gate const
3480Sstevel@tonic-gate #endif
3490Sstevel@tonic-gate char				devnull[];
3500Sstevel@tonic-gate 
3510Sstevel@tonic-gate /* flags */
3520Sstevel@tonic-gate #define			noexec		01
3530Sstevel@tonic-gate #define			sysflg		01
3540Sstevel@tonic-gate #define			intflg		02
3550Sstevel@tonic-gate #define			prompt		04
3560Sstevel@tonic-gate #define			setflg		010
3570Sstevel@tonic-gate #define			errflg		020
3580Sstevel@tonic-gate #define			ttyflg		040
3590Sstevel@tonic-gate #define			forked		0100
3600Sstevel@tonic-gate #define			oneflg		0200
3610Sstevel@tonic-gate #define			rshflg		0400
3620Sstevel@tonic-gate #define			subsh		01000
3630Sstevel@tonic-gate #define			stdflg		02000
3640Sstevel@tonic-gate #define			STDFLG		's'
3650Sstevel@tonic-gate #define			execpr		04000
3660Sstevel@tonic-gate #define			readpr		010000
3670Sstevel@tonic-gate #define			keyflg		020000
3680Sstevel@tonic-gate #define			hashflg		040000
3690Sstevel@tonic-gate #define			nofngflg	0200000
3700Sstevel@tonic-gate #define			exportflg	0400000
3710Sstevel@tonic-gate #define			monitorflg	01000000
3720Sstevel@tonic-gate #define			jcflg		02000000
3730Sstevel@tonic-gate #define			privflg		04000000
3740Sstevel@tonic-gate #define			forcexit	010000000
3750Sstevel@tonic-gate #define			jcoff		020000000
3760Sstevel@tonic-gate #define			pfshflg		040000000
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate extern long				flags;
3790Sstevel@tonic-gate extern int				rwait;	/* flags read waiting */
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate /* error exits from various parts of shell */
3820Sstevel@tonic-gate #include	<setjmp.h>
3830Sstevel@tonic-gate extern jmp_buf			subshell;
3840Sstevel@tonic-gate extern jmp_buf			errshell;
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate /* fault handling */
3870Sstevel@tonic-gate #include	"brkincr.h"
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate extern unsigned			brkincr;
3900Sstevel@tonic-gate #define		MINTRAP		0
3910Sstevel@tonic-gate #define		MAXTRAP		NSIG
3920Sstevel@tonic-gate 
3930Sstevel@tonic-gate #define		TRAPSET		2
3940Sstevel@tonic-gate #define		SIGSET		4
3950Sstevel@tonic-gate #define			SIGMOD		8
3960Sstevel@tonic-gate #define			SIGIGN		16
3970Sstevel@tonic-gate 
3980Sstevel@tonic-gate extern BOOL				trapnote;
3990Sstevel@tonic-gate 
4000Sstevel@tonic-gate /* name tree and words */
4010Sstevel@tonic-gate extern unsigned char				**environ;
4020Sstevel@tonic-gate extern unsigned char				numbuf[];
4030Sstevel@tonic-gate extern const char				export[];
4040Sstevel@tonic-gate extern const char				duperr[];
4050Sstevel@tonic-gate extern const char				readonly[];
4060Sstevel@tonic-gate 
4070Sstevel@tonic-gate /* execflgs */
4080Sstevel@tonic-gate extern int				exitval;
4090Sstevel@tonic-gate extern int				retval;
4100Sstevel@tonic-gate extern BOOL				execbrk;
4110Sstevel@tonic-gate extern int				loopcnt;
4120Sstevel@tonic-gate extern int				breakcnt;
4130Sstevel@tonic-gate extern int				funcnt;
4140Sstevel@tonic-gate extern int				tried_to_exit;
4150Sstevel@tonic-gate 
4160Sstevel@tonic-gate /* messages */
4170Sstevel@tonic-gate extern const char				mailmsg[];
4180Sstevel@tonic-gate extern const char				coredump[];
4190Sstevel@tonic-gate extern const char				badopt[];
4200Sstevel@tonic-gate extern const char				badparam[];
4210Sstevel@tonic-gate extern const char				unset[];
4220Sstevel@tonic-gate extern const char				badsub[];
4230Sstevel@tonic-gate extern const char				nospace[];
4240Sstevel@tonic-gate extern const char				nostack[];
4250Sstevel@tonic-gate extern const char				notfound[];
4260Sstevel@tonic-gate extern const char				badtrap[];
4270Sstevel@tonic-gate extern const char				baddir[];
4280Sstevel@tonic-gate extern const char				badshift[];
4290Sstevel@tonic-gate extern const char				restricted[];
4300Sstevel@tonic-gate extern const char				execpmsg[];
4310Sstevel@tonic-gate extern const char				notid[];
4320Sstevel@tonic-gate extern const char 				badulimit[];
4330Sstevel@tonic-gate extern const char 				ulimit[];
4340Sstevel@tonic-gate extern const char				wtfailed[];
4350Sstevel@tonic-gate extern const char				badcreate[];
4360Sstevel@tonic-gate extern const char				nofork[];
4370Sstevel@tonic-gate extern const char				noswap[];
4380Sstevel@tonic-gate extern const char				piperr[];
4390Sstevel@tonic-gate extern const char				badopen[];
4400Sstevel@tonic-gate extern const char				badnum[];
4410Sstevel@tonic-gate extern const char				badsig[];
4420Sstevel@tonic-gate extern const char				badid[];
4430Sstevel@tonic-gate extern const char				arglist[];
4440Sstevel@tonic-gate extern const char				txtbsy[];
4450Sstevel@tonic-gate extern const char				toobig[];
4460Sstevel@tonic-gate extern const char				badexec[];
4470Sstevel@tonic-gate extern const char				badfile[];
4480Sstevel@tonic-gate extern const char				badreturn[];
4490Sstevel@tonic-gate extern const char				badexport[];
4500Sstevel@tonic-gate extern const char				badunset[];
4510Sstevel@tonic-gate extern const char				nohome[];
4520Sstevel@tonic-gate extern const char				badperm[];
4530Sstevel@tonic-gate extern const char				mssgargn[];
4540Sstevel@tonic-gate extern const char				libacc[];
4550Sstevel@tonic-gate extern const char				libbad[];
4560Sstevel@tonic-gate extern const char				libscn[];
4570Sstevel@tonic-gate extern const char				libmax[];
4580Sstevel@tonic-gate extern const char				emultihop[];
4590Sstevel@tonic-gate extern const char				nulldir[];
4600Sstevel@tonic-gate extern const char				enotdir[];
4610Sstevel@tonic-gate extern const char				enoent[];
4620Sstevel@tonic-gate extern const char				eacces[];
4630Sstevel@tonic-gate extern const char				enolink[];
4640Sstevel@tonic-gate extern const char				exited[];
4650Sstevel@tonic-gate extern const char				running[];
4660Sstevel@tonic-gate extern const char				ambiguous[];
4670Sstevel@tonic-gate extern const char				nosuchjob[];
4680Sstevel@tonic-gate extern const char				nosuchpid[];
4690Sstevel@tonic-gate extern const char				nosuchpgid[];
4700Sstevel@tonic-gate extern const char				usage[];
4710Sstevel@tonic-gate extern const char				nojc[];
4720Sstevel@tonic-gate extern const char				killuse[];
4730Sstevel@tonic-gate extern const char				jobsuse[];
4740Sstevel@tonic-gate extern const char				stopuse[];
4750Sstevel@tonic-gate extern const char				ulimuse[];
4760Sstevel@tonic-gate extern const char				nocurjob[];
4770Sstevel@tonic-gate extern const char				loginsh[];
4780Sstevel@tonic-gate extern const char				jobsstopped[];
4790Sstevel@tonic-gate extern const char				jobsrunning[];
4802256Sna195498 extern const char				nlorsemi[];
4812256Sna195498 extern const char				signalnum[];
4822256Sna195498 extern const char				badpwd[];
4832256Sna195498 extern const char				badlocale[];
4842256Sna195498 extern const char				nobracket[];
4852256Sna195498 extern const char				noparen[];
4862256Sna195498 extern const char				noarg[];
4870Sstevel@tonic-gate 
4880Sstevel@tonic-gate /*	'builtin' error messages	*/
4890Sstevel@tonic-gate 
4900Sstevel@tonic-gate extern const char				btest[];
4910Sstevel@tonic-gate extern const char				badop[];
4920Sstevel@tonic-gate 
4930Sstevel@tonic-gate #ifndef __STDC__
4940Sstevel@tonic-gate #undef const 					/* bring back const */
4950Sstevel@tonic-gate #endif
4960Sstevel@tonic-gate 
4970Sstevel@tonic-gate /*	fork constant	*/
4980Sstevel@tonic-gate 
4990Sstevel@tonic-gate #define		FORKLIM 	32
5000Sstevel@tonic-gate 
5010Sstevel@tonic-gate extern address			end[];
5020Sstevel@tonic-gate 
5030Sstevel@tonic-gate #include	"ctype.h"
5040Sstevel@tonic-gate #include	<ctype.h>
5050Sstevel@tonic-gate #include	<locale.h>
5060Sstevel@tonic-gate 
5070Sstevel@tonic-gate extern int				eflag;
5080Sstevel@tonic-gate extern int				ucb_builtins;
5090Sstevel@tonic-gate 
5100Sstevel@tonic-gate /*
5110Sstevel@tonic-gate  * Find out if it is time to go away.
5120Sstevel@tonic-gate  * `trapnote' is set to SIGSET when fault is seen and
5130Sstevel@tonic-gate  * no trap has been set.
5140Sstevel@tonic-gate  */
5150Sstevel@tonic-gate 
5160Sstevel@tonic-gate #define		sigchk()	if (trapnote & SIGSET)	\
5170Sstevel@tonic-gate 					exitsh(exitval ? exitval : SIGFAIL)
5180Sstevel@tonic-gate 
5190Sstevel@tonic-gate #define		exitset()	retval = exitval
5200Sstevel@tonic-gate 
5210Sstevel@tonic-gate /* Multibyte characters */
5220Sstevel@tonic-gate unsigned char *readw();
5230Sstevel@tonic-gate #include <stdlib.h>
5240Sstevel@tonic-gate #include <limits.h>
5250Sstevel@tonic-gate #define	MULTI_BYTE_MAX MB_LEN_MAX
5260Sstevel@tonic-gate 
5270Sstevel@tonic-gate 
5280Sstevel@tonic-gate #ifdef	__cplusplus
5290Sstevel@tonic-gate }
5300Sstevel@tonic-gate #endif
5310Sstevel@tonic-gate 
5320Sstevel@tonic-gate #endif	/* _DEFS_H */
533