1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*0Sstevel@tonic-gate /* All Rights Reserved */ 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate /* 27*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 28*0Sstevel@tonic-gate * Use is subject to license terms. 29*0Sstevel@tonic-gate */ 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifndef _DEFS_H 33*0Sstevel@tonic-gate #define _DEFS_H 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef __cplusplus 38*0Sstevel@tonic-gate extern "C" { 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate /* 42*0Sstevel@tonic-gate * UNIX shell 43*0Sstevel@tonic-gate */ 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate /* execute flags */ 46*0Sstevel@tonic-gate #define XEC_EXECED 01 47*0Sstevel@tonic-gate #define XEC_LINKED 02 48*0Sstevel@tonic-gate #define XEC_NOSTOP 04 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate /* endjobs flags */ 51*0Sstevel@tonic-gate #define JOB_STOPPED 01 52*0Sstevel@tonic-gate #define JOB_RUNNING 02 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate /* error exits from various parts of shell */ 55*0Sstevel@tonic-gate #define ERROR 1 56*0Sstevel@tonic-gate #define SYNBAD 2 57*0Sstevel@tonic-gate #define SIGFAIL 2000 58*0Sstevel@tonic-gate #define SIGFLG 0200 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* command tree */ 61*0Sstevel@tonic-gate #define FPIN 0x0100 62*0Sstevel@tonic-gate #define FPOU 0x0200 63*0Sstevel@tonic-gate #define FAMP 0x0400 64*0Sstevel@tonic-gate #define COMMSK 0x00F0 65*0Sstevel@tonic-gate #define CNTMSK 0x000F 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate #define TCOM 0x0000 68*0Sstevel@tonic-gate #define TPAR 0x0010 69*0Sstevel@tonic-gate #define TFIL 0x0020 70*0Sstevel@tonic-gate #define TLST 0x0030 71*0Sstevel@tonic-gate #define TIF 0x0040 72*0Sstevel@tonic-gate #define TWH 0x0050 73*0Sstevel@tonic-gate #define TUN 0x0060 74*0Sstevel@tonic-gate #define TSW 0x0070 75*0Sstevel@tonic-gate #define TAND 0x0080 76*0Sstevel@tonic-gate #define TORF 0x0090 77*0Sstevel@tonic-gate #define TFORK 0x00A0 78*0Sstevel@tonic-gate #define TFOR 0x00B0 79*0Sstevel@tonic-gate #define TFND 0x00C0 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate /* execute table */ 82*0Sstevel@tonic-gate #define SYSSET 1 83*0Sstevel@tonic-gate #define SYSCD 2 84*0Sstevel@tonic-gate #define SYSEXEC 3 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate #ifdef RES /* include login code */ 87*0Sstevel@tonic-gate #define SYSLOGIN 4 88*0Sstevel@tonic-gate #else 89*0Sstevel@tonic-gate #define SYSNEWGRP 4 90*0Sstevel@tonic-gate #endif 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define SYSTRAP 5 93*0Sstevel@tonic-gate #define SYSEXIT 6 94*0Sstevel@tonic-gate #define SYSSHFT 7 95*0Sstevel@tonic-gate #define SYSWAIT 8 96*0Sstevel@tonic-gate #define SYSCONT 9 97*0Sstevel@tonic-gate #define SYSBREAK 10 98*0Sstevel@tonic-gate #define SYSEVAL 11 99*0Sstevel@tonic-gate #define SYSDOT 12 100*0Sstevel@tonic-gate #define SYSRDONLY 13 101*0Sstevel@tonic-gate #define SYSTIMES 14 102*0Sstevel@tonic-gate #define SYSXPORT 15 103*0Sstevel@tonic-gate #define SYSNULL 16 104*0Sstevel@tonic-gate #define SYSREAD 17 105*0Sstevel@tonic-gate #define SYSTST 18 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate #ifndef RES /* exclude umask code */ 108*0Sstevel@tonic-gate #define SYSUMASK 20 109*0Sstevel@tonic-gate #define SYSULIMIT 21 110*0Sstevel@tonic-gate #endif 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #define SYSECHO 22 113*0Sstevel@tonic-gate #define SYSHASH 23 114*0Sstevel@tonic-gate #define SYSPWD 24 115*0Sstevel@tonic-gate #define SYSRETURN 25 116*0Sstevel@tonic-gate #define SYSUNS 26 117*0Sstevel@tonic-gate #define SYSMEM 27 118*0Sstevel@tonic-gate #define SYSTYPE 28 119*0Sstevel@tonic-gate #define SYSGETOPT 29 120*0Sstevel@tonic-gate #define SYSJOBS 30 121*0Sstevel@tonic-gate #define SYSFGBG 31 122*0Sstevel@tonic-gate #define SYSKILL 32 123*0Sstevel@tonic-gate #define SYSSUSP 33 124*0Sstevel@tonic-gate #define SYSSTOP 34 125*0Sstevel@tonic-gate 126*0Sstevel@tonic-gate /* used for input and output of shell */ 127*0Sstevel@tonic-gate #define INIO 19 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate /* io nodes */ 130*0Sstevel@tonic-gate #define USERIO 10 131*0Sstevel@tonic-gate #define IOUFD 15 132*0Sstevel@tonic-gate #define IODOC 16 133*0Sstevel@tonic-gate #define IOPUT 32 134*0Sstevel@tonic-gate #define IOAPP 64 135*0Sstevel@tonic-gate #define IOMOV 128 136*0Sstevel@tonic-gate #define IORDW 256 137*0Sstevel@tonic-gate #define IOSTRIP 512 138*0Sstevel@tonic-gate #define INPIPE 0 139*0Sstevel@tonic-gate #define OTPIPE 1 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate /* arg list terminator */ 142*0Sstevel@tonic-gate #define ENDARGS 0 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate #include <unistd.h> 145*0Sstevel@tonic-gate #include "mac.h" 146*0Sstevel@tonic-gate #include "mode.h" 147*0Sstevel@tonic-gate #include "name.h" 148*0Sstevel@tonic-gate #include <signal.h> 149*0Sstevel@tonic-gate #include <sys/types.h> 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate /* id's */ 152*0Sstevel@tonic-gate extern pid_t mypid; 153*0Sstevel@tonic-gate extern pid_t mypgid; 154*0Sstevel@tonic-gate extern pid_t mysid; 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate /* getopt */ 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate extern int optind; 159*0Sstevel@tonic-gate extern int opterr; 160*0Sstevel@tonic-gate extern int _sp; 161*0Sstevel@tonic-gate extern char *optarg; 162*0Sstevel@tonic-gate 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate /* use sh-private versions of memory allocation routines */ 165*0Sstevel@tonic-gate 166*0Sstevel@tonic-gate #define alloc malloc 167*0Sstevel@tonic-gate 168*0Sstevel@tonic-gate /* result type declarations */ 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate extern int handle(); 171*0Sstevel@tonic-gate extern void chktrap(); 172*0Sstevel@tonic-gate extern void done(); 173*0Sstevel@tonic-gate extern void sh_free(); 174*0Sstevel@tonic-gate extern unsigned char *make(); 175*0Sstevel@tonic-gate extern unsigned char *movstr(); 176*0Sstevel@tonic-gate extern unsigned char *movstrn(); 177*0Sstevel@tonic-gate extern unsigned char *cwdget(); 178*0Sstevel@tonic-gate extern struct trenod *cmd(); 179*0Sstevel@tonic-gate extern struct trenod *makefork(); 180*0Sstevel@tonic-gate extern struct namnod *lookup(); 181*0Sstevel@tonic-gate extern struct namnod *findnam(); 182*0Sstevel@tonic-gate extern struct dolnod *useargs(); 183*0Sstevel@tonic-gate extern float expr(); 184*0Sstevel@tonic-gate extern unsigned char *catpath(); 185*0Sstevel@tonic-gate extern unsigned char *getpath(); 186*0Sstevel@tonic-gate extern unsigned char *nextpath(); 187*0Sstevel@tonic-gate extern unsigned char **scan(); 188*0Sstevel@tonic-gate extern unsigned char *mactrim(); 189*0Sstevel@tonic-gate extern unsigned char *macro(); 190*0Sstevel@tonic-gate extern int exname(); 191*0Sstevel@tonic-gate extern int printnam(); 192*0Sstevel@tonic-gate extern int printro(); 193*0Sstevel@tonic-gate extern int printexp(); 194*0Sstevel@tonic-gate extern unsigned int readwc(); 195*0Sstevel@tonic-gate extern unsigned int nextwc(); 196*0Sstevel@tonic-gate extern unsigned char skipc(); 197*0Sstevel@tonic-gate extern unsigned char **local_setenv(); 198*0Sstevel@tonic-gate extern time_t time(); 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate #define attrib(n, f) (n->namflg |= f) 201*0Sstevel@tonic-gate #define round(a, b) (((int)(((char *)(a)+b)-1))&~((b)-1)) 202*0Sstevel@tonic-gate #define closepipe(x) (close(x[INPIPE]), close(x[OTPIPE])) 203*0Sstevel@tonic-gate #define eq(a, b) (cf(a, b) == 0) 204*0Sstevel@tonic-gate #define max(a, b) ((a) > (b)?(a):(b)) 205*0Sstevel@tonic-gate #define assert(x) 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate /* temp files and io */ 208*0Sstevel@tonic-gate extern int output; 209*0Sstevel@tonic-gate extern int ioset; 210*0Sstevel@tonic-gate extern struct ionod *iotemp; /* files to be deleted sometime */ 211*0Sstevel@tonic-gate extern struct ionod *fiotemp; /* function files to be deleted sometime */ 212*0Sstevel@tonic-gate extern struct ionod *iopend; /* documents waiting to be read at NL */ 213*0Sstevel@tonic-gate extern struct fdsave fdmap[]; 214*0Sstevel@tonic-gate extern int savpipe; 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate /* substitution */ 217*0Sstevel@tonic-gate extern int dolc; 218*0Sstevel@tonic-gate extern unsigned char **dolv; 219*0Sstevel@tonic-gate extern struct dolnod *argfor; 220*0Sstevel@tonic-gate extern struct argnod *gchain; 221*0Sstevel@tonic-gate 222*0Sstevel@tonic-gate /* stak stuff */ 223*0Sstevel@tonic-gate #include "stak.h" 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate /* 226*0Sstevel@tonic-gate * If non-ANSI C, make const go away. We bring it back 227*0Sstevel@tonic-gate * at the end of the file to avoid side-effects. 228*0Sstevel@tonic-gate */ 229*0Sstevel@tonic-gate #ifndef __STDC__ 230*0Sstevel@tonic-gate #define const 231*0Sstevel@tonic-gate #endif 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate /* string constants */ 234*0Sstevel@tonic-gate extern const char atline[]; 235*0Sstevel@tonic-gate extern const char readmsg[]; 236*0Sstevel@tonic-gate extern const char colon[]; 237*0Sstevel@tonic-gate extern const char minus[]; 238*0Sstevel@tonic-gate extern const char nullstr[]; 239*0Sstevel@tonic-gate extern const char sptbnl[]; 240*0Sstevel@tonic-gate extern const char unexpected[]; 241*0Sstevel@tonic-gate extern const char endoffile[]; 242*0Sstevel@tonic-gate extern const char synmsg[]; 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gate /* name tree and words */ 245*0Sstevel@tonic-gate extern const struct sysnod reserved[]; 246*0Sstevel@tonic-gate extern const int no_reserved; 247*0Sstevel@tonic-gate extern const struct sysnod commands[]; 248*0Sstevel@tonic-gate extern const int no_commands; 249*0Sstevel@tonic-gate 250*0Sstevel@tonic-gate extern int wdval; 251*0Sstevel@tonic-gate extern int wdnum; 252*0Sstevel@tonic-gate extern int fndef; 253*0Sstevel@tonic-gate extern int nohash; 254*0Sstevel@tonic-gate extern struct argnod *wdarg; 255*0Sstevel@tonic-gate extern int wdset; 256*0Sstevel@tonic-gate extern BOOL reserv; 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate /* prompting */ 259*0Sstevel@tonic-gate extern const char stdprompt[]; 260*0Sstevel@tonic-gate extern const char supprompt[]; 261*0Sstevel@tonic-gate extern const char profile[]; 262*0Sstevel@tonic-gate extern const char sysprofile[]; 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate /* locale testing */ 265*0Sstevel@tonic-gate extern const char localedir[]; 266*0Sstevel@tonic-gate extern int localedir_exists; 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate /* built in names */ 269*0Sstevel@tonic-gate extern struct namnod fngnod; 270*0Sstevel@tonic-gate extern struct namnod cdpnod; 271*0Sstevel@tonic-gate extern struct namnod ifsnod; 272*0Sstevel@tonic-gate extern struct namnod homenod; 273*0Sstevel@tonic-gate extern struct namnod mailnod; 274*0Sstevel@tonic-gate extern struct namnod pathnod; 275*0Sstevel@tonic-gate extern struct namnod ps1nod; 276*0Sstevel@tonic-gate extern struct namnod ps2nod; 277*0Sstevel@tonic-gate extern struct namnod mchknod; 278*0Sstevel@tonic-gate extern struct namnod acctnod; 279*0Sstevel@tonic-gate extern struct namnod mailpnod; 280*0Sstevel@tonic-gate 281*0Sstevel@tonic-gate /* special names */ 282*0Sstevel@tonic-gate extern unsigned char flagadr[]; 283*0Sstevel@tonic-gate extern unsigned char *pcsadr; 284*0Sstevel@tonic-gate extern unsigned char *pidadr; 285*0Sstevel@tonic-gate extern unsigned char *cmdadr; 286*0Sstevel@tonic-gate 287*0Sstevel@tonic-gate /* names always present */ 288*0Sstevel@tonic-gate extern const char defpath[]; 289*0Sstevel@tonic-gate extern const char mailname[]; 290*0Sstevel@tonic-gate extern const char homename[]; 291*0Sstevel@tonic-gate extern const char pathname[]; 292*0Sstevel@tonic-gate extern const char cdpname[]; 293*0Sstevel@tonic-gate extern const char ifsname[]; 294*0Sstevel@tonic-gate extern const char ps1name[]; 295*0Sstevel@tonic-gate extern const char ps2name[]; 296*0Sstevel@tonic-gate extern const char mchkname[]; 297*0Sstevel@tonic-gate extern const char acctname[]; 298*0Sstevel@tonic-gate extern const char mailpname[]; 299*0Sstevel@tonic-gate 300*0Sstevel@tonic-gate /* transput */ 301*0Sstevel@tonic-gate extern unsigned char tmpout[]; 302*0Sstevel@tonic-gate extern unsigned char *tmpname; 303*0Sstevel@tonic-gate extern int serial; 304*0Sstevel@tonic-gate 305*0Sstevel@tonic-gate #define TMPNAM 7 306*0Sstevel@tonic-gate 307*0Sstevel@tonic-gate extern struct fileblk *standin; 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate #define input (standin->fdes) 310*0Sstevel@tonic-gate #define eof (standin->feof) 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate extern int peekc; 313*0Sstevel@tonic-gate extern int peekn; 314*0Sstevel@tonic-gate extern unsigned char *comdiv; 315*0Sstevel@tonic-gate extern 316*0Sstevel@tonic-gate #ifdef __STDC__ 317*0Sstevel@tonic-gate const 318*0Sstevel@tonic-gate #endif 319*0Sstevel@tonic-gate char devnull[]; 320*0Sstevel@tonic-gate 321*0Sstevel@tonic-gate /* flags */ 322*0Sstevel@tonic-gate #define noexec 01 323*0Sstevel@tonic-gate #define sysflg 01 324*0Sstevel@tonic-gate #define intflg 02 325*0Sstevel@tonic-gate #define prompt 04 326*0Sstevel@tonic-gate #define setflg 010 327*0Sstevel@tonic-gate #define errflg 020 328*0Sstevel@tonic-gate #define ttyflg 040 329*0Sstevel@tonic-gate #define forked 0100 330*0Sstevel@tonic-gate #define oneflg 0200 331*0Sstevel@tonic-gate #define rshflg 0400 332*0Sstevel@tonic-gate #define subsh 01000 333*0Sstevel@tonic-gate #define stdflg 02000 334*0Sstevel@tonic-gate #define STDFLG 's' 335*0Sstevel@tonic-gate #define execpr 04000 336*0Sstevel@tonic-gate #define readpr 010000 337*0Sstevel@tonic-gate #define keyflg 020000 338*0Sstevel@tonic-gate #define hashflg 040000 339*0Sstevel@tonic-gate #define nofngflg 0200000 340*0Sstevel@tonic-gate #define exportflg 0400000 341*0Sstevel@tonic-gate #define monitorflg 01000000 342*0Sstevel@tonic-gate #define jcflg 02000000 343*0Sstevel@tonic-gate #define privflg 04000000 344*0Sstevel@tonic-gate #define forcexit 010000000 345*0Sstevel@tonic-gate #define jcoff 020000000 346*0Sstevel@tonic-gate #define pfshflg 040000000 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate extern long flags; 349*0Sstevel@tonic-gate extern int rwait; /* flags read waiting */ 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate /* error exits from various parts of shell */ 352*0Sstevel@tonic-gate #include <setjmp.h> 353*0Sstevel@tonic-gate extern jmp_buf subshell; 354*0Sstevel@tonic-gate extern jmp_buf errshell; 355*0Sstevel@tonic-gate 356*0Sstevel@tonic-gate /* fault handling */ 357*0Sstevel@tonic-gate #include "brkincr.h" 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate extern unsigned brkincr; 360*0Sstevel@tonic-gate #define MINTRAP 0 361*0Sstevel@tonic-gate #define MAXTRAP NSIG 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate #define TRAPSET 2 364*0Sstevel@tonic-gate #define SIGSET 4 365*0Sstevel@tonic-gate #define SIGMOD 8 366*0Sstevel@tonic-gate #define SIGIGN 16 367*0Sstevel@tonic-gate 368*0Sstevel@tonic-gate extern BOOL trapnote; 369*0Sstevel@tonic-gate 370*0Sstevel@tonic-gate /* name tree and words */ 371*0Sstevel@tonic-gate extern unsigned char **environ; 372*0Sstevel@tonic-gate extern unsigned char numbuf[]; 373*0Sstevel@tonic-gate extern const char export[]; 374*0Sstevel@tonic-gate extern const char duperr[]; 375*0Sstevel@tonic-gate extern const char readonly[]; 376*0Sstevel@tonic-gate 377*0Sstevel@tonic-gate /* execflgs */ 378*0Sstevel@tonic-gate extern int exitval; 379*0Sstevel@tonic-gate extern int retval; 380*0Sstevel@tonic-gate extern BOOL execbrk; 381*0Sstevel@tonic-gate extern int loopcnt; 382*0Sstevel@tonic-gate extern int breakcnt; 383*0Sstevel@tonic-gate extern int funcnt; 384*0Sstevel@tonic-gate extern int tried_to_exit; 385*0Sstevel@tonic-gate 386*0Sstevel@tonic-gate /* messages */ 387*0Sstevel@tonic-gate extern const char mailmsg[]; 388*0Sstevel@tonic-gate extern const char coredump[]; 389*0Sstevel@tonic-gate extern const char badopt[]; 390*0Sstevel@tonic-gate extern const char badparam[]; 391*0Sstevel@tonic-gate extern const char unset[]; 392*0Sstevel@tonic-gate extern const char badsub[]; 393*0Sstevel@tonic-gate extern const char nospace[]; 394*0Sstevel@tonic-gate extern const char nostack[]; 395*0Sstevel@tonic-gate extern const char notfound[]; 396*0Sstevel@tonic-gate extern const char badtrap[]; 397*0Sstevel@tonic-gate extern const char baddir[]; 398*0Sstevel@tonic-gate extern const char badshift[]; 399*0Sstevel@tonic-gate extern const char restricted[]; 400*0Sstevel@tonic-gate extern const char execpmsg[]; 401*0Sstevel@tonic-gate extern const char notid[]; 402*0Sstevel@tonic-gate extern const char badulimit[]; 403*0Sstevel@tonic-gate extern const char badresource[]; 404*0Sstevel@tonic-gate extern const char badscale[]; 405*0Sstevel@tonic-gate extern const char ulimit[]; 406*0Sstevel@tonic-gate extern const char wtfailed[]; 407*0Sstevel@tonic-gate extern const char badcreate[]; 408*0Sstevel@tonic-gate extern const char nofork[]; 409*0Sstevel@tonic-gate extern const char noswap[]; 410*0Sstevel@tonic-gate extern const char piperr[]; 411*0Sstevel@tonic-gate extern const char badopen[]; 412*0Sstevel@tonic-gate extern const char badnum[]; 413*0Sstevel@tonic-gate extern const char badsig[]; 414*0Sstevel@tonic-gate extern const char badid[]; 415*0Sstevel@tonic-gate extern const char arglist[]; 416*0Sstevel@tonic-gate extern const char txtbsy[]; 417*0Sstevel@tonic-gate extern const char toobig[]; 418*0Sstevel@tonic-gate extern const char badexec[]; 419*0Sstevel@tonic-gate extern const char badfile[]; 420*0Sstevel@tonic-gate extern const char badreturn[]; 421*0Sstevel@tonic-gate extern const char badexport[]; 422*0Sstevel@tonic-gate extern const char badunset[]; 423*0Sstevel@tonic-gate extern const char nohome[]; 424*0Sstevel@tonic-gate extern const char badperm[]; 425*0Sstevel@tonic-gate extern const char mssgargn[]; 426*0Sstevel@tonic-gate extern const char libacc[]; 427*0Sstevel@tonic-gate extern const char libbad[]; 428*0Sstevel@tonic-gate extern const char libscn[]; 429*0Sstevel@tonic-gate extern const char libmax[]; 430*0Sstevel@tonic-gate extern const char emultihop[]; 431*0Sstevel@tonic-gate extern const char nulldir[]; 432*0Sstevel@tonic-gate extern const char enotdir[]; 433*0Sstevel@tonic-gate extern const char enoent[]; 434*0Sstevel@tonic-gate extern const char eacces[]; 435*0Sstevel@tonic-gate extern const char enolink[]; 436*0Sstevel@tonic-gate extern const char exited[]; 437*0Sstevel@tonic-gate extern const char running[]; 438*0Sstevel@tonic-gate extern const char ambiguous[]; 439*0Sstevel@tonic-gate extern const char nosuchjob[]; 440*0Sstevel@tonic-gate extern const char nosuchpid[]; 441*0Sstevel@tonic-gate extern const char nosuchpgid[]; 442*0Sstevel@tonic-gate extern const char usage[]; 443*0Sstevel@tonic-gate extern const char nojc[]; 444*0Sstevel@tonic-gate extern const char killuse[]; 445*0Sstevel@tonic-gate extern const char jobsuse[]; 446*0Sstevel@tonic-gate extern const char stopuse[]; 447*0Sstevel@tonic-gate extern const char ulimuse[]; 448*0Sstevel@tonic-gate extern const char nocurjob[]; 449*0Sstevel@tonic-gate extern const char loginsh[]; 450*0Sstevel@tonic-gate extern const char jobsstopped[]; 451*0Sstevel@tonic-gate extern const char jobsrunning[]; 452*0Sstevel@tonic-gate 453*0Sstevel@tonic-gate /* 'builtin' error messages */ 454*0Sstevel@tonic-gate 455*0Sstevel@tonic-gate extern const char btest[]; 456*0Sstevel@tonic-gate extern const char badop[]; 457*0Sstevel@tonic-gate 458*0Sstevel@tonic-gate #ifndef __STDC__ 459*0Sstevel@tonic-gate #undef const /* bring back const */ 460*0Sstevel@tonic-gate #endif 461*0Sstevel@tonic-gate 462*0Sstevel@tonic-gate /* fork constant */ 463*0Sstevel@tonic-gate 464*0Sstevel@tonic-gate #define FORKLIM 32 465*0Sstevel@tonic-gate 466*0Sstevel@tonic-gate extern address end[]; 467*0Sstevel@tonic-gate 468*0Sstevel@tonic-gate #include "ctype.h" 469*0Sstevel@tonic-gate #include <ctype.h> 470*0Sstevel@tonic-gate #include <locale.h> 471*0Sstevel@tonic-gate 472*0Sstevel@tonic-gate extern int eflag; 473*0Sstevel@tonic-gate extern int ucb_builtins; 474*0Sstevel@tonic-gate 475*0Sstevel@tonic-gate /* 476*0Sstevel@tonic-gate * Find out if it is time to go away. 477*0Sstevel@tonic-gate * `trapnote' is set to SIGSET when fault is seen and 478*0Sstevel@tonic-gate * no trap has been set. 479*0Sstevel@tonic-gate */ 480*0Sstevel@tonic-gate 481*0Sstevel@tonic-gate #define sigchk() if (trapnote & SIGSET) \ 482*0Sstevel@tonic-gate exitsh(exitval ? exitval : SIGFAIL) 483*0Sstevel@tonic-gate 484*0Sstevel@tonic-gate #define exitset() retval = exitval 485*0Sstevel@tonic-gate 486*0Sstevel@tonic-gate /* Multibyte characters */ 487*0Sstevel@tonic-gate void setwidth(); 488*0Sstevel@tonic-gate unsigned char *readw(); 489*0Sstevel@tonic-gate #include <stdlib.h> 490*0Sstevel@tonic-gate #include <limits.h> 491*0Sstevel@tonic-gate #define MULTI_BYTE_MAX MB_LEN_MAX 492*0Sstevel@tonic-gate 493*0Sstevel@tonic-gate 494*0Sstevel@tonic-gate #ifdef __cplusplus 495*0Sstevel@tonic-gate } 496*0Sstevel@tonic-gate #endif 497*0Sstevel@tonic-gate 498*0Sstevel@tonic-gate #endif /* _DEFS_H */ 499