/* * Copyright (c) 1984, 1985, 1986 AT&T * All Rights Reserved * THIS IS UNPUBLISHED PROPRIETARY SOURCE * CODE OF AT&T. * The copyright notice above does not * evidence any actual or intended * publication of such source code. */ /* @(#)defs.h 1.1 */ /* * UNIX shell * S. R. Bourne * Rewritten by David Korn * */ #include #include #include #define const /* error exits from various parts of shell */ #define ERROR 1 #define SYNBAD 2 #define BYTESPERWORD (sizeof(char *)) #define ENDARGS 0 /* arg list terminator */ #define NIL ((char*)0) #ifndef NULL #define NULL 0 #endif /* typedefs used in the shell */ typedef char BOOL; typedef char *ADDRESS; typedef char MSG[]; typedef char *STKPTR; typedef struct stat STATBUF; /* defined in /usr/include/sys/stat.h */ typedef struct blk *BLKPTR; typedef struct fileblk FILEBLK; typedef struct fileblk *SHFILE; typedef struct trenod *TREPTR; typedef struct forknod *FORKPTR; typedef struct comnod *COMPTR; typedef struct swnod *SWPTR; typedef struct regnod *REGPTR; typedef struct parnod *PARPTR; typedef struct ifnod *IFPTR; typedef struct whnod *WHPTR; typedef struct fornod *FORPTR; typedef struct lstnod *LSTPTR; typedef struct chnnod *CHNPTR; typedef struct dolnod *DOLPTR; typedef struct ionod *IOPTR; typedef struct Namnod NAMNOD; typedef struct Namnod *NAMPTR; typedef struct sysnod *SYSPTR; typedef struct procnod *PROCPTR; #define Rcheat(a) ((unsigned)(a)) #define blank() putc(SP,output) #define newline() putc(NL,output) #define round(a,b) (((int)((ADR(a)+b)-1))&~((b)-1)) #define eq(a,b) (strcmp(a,b)==0) #define max(a,b) ((a)>(b)?(a):(b)) #define assert(x) ; #define exitset() (savexit=exitval) #define error(s) failed(s,NIL) #define BLK(x) ((BLKPTR)(x)) #define BYT(x) ((BYTPTR)(x)) #define STK(x) ((STKPTR)(x)) #define ADR(x) ((char*)(x)) #ifdef BSD #define strchr index #define strrchr rindex #endif /* BSD */ #ifdef VENIX #define strchr index #define strrchr rindex #endif /* VENIX */ /* flags */ typedef long optflag; #ifdef INT16 # ifndef pdp11 # define _OPTIM_ 1 # endif /* pdp11 */ #endif /* INT16 */ #ifdef _OPTIM_ #define _HIGH_ 1 #define _LOW_ _HIGH_-1 #define is_option(flag) ((flag)&0xffffL?\ st.Flags.i[_LOW_]&(unsigned int)(flag):\ st.Flags.i[_HIGH_]&(unsigned int)((flag)>>16)) #define on_option(flag) ((flag)&0xffffL?\ (st.Flags.i[_LOW_] |= (unsigned int)(flag)):\ (st.Flags.i[_HIGH_] |= (unsigned int)((flag)>>16))) #define off_option(flag) ((flag)&0xffffL?\ (st.Flags.i[_LOW_] &= ~(unsigned int)(flag)):\ (st.Flags.i[_HIGH_] &= ~(unsigned int)((flag)>>16))) #else #define is_option(flag) (st.Flags.l & (flag)) #define on_option(flag) (st.Flags.l |= (flag)) #define off_option(flag) (st.Flags.l &= ~(flag)) #endif /* _OPTIM_ */ #define Fixflg 1 #define Errflg 2 #define Readpr 3 #define Monitor 4 #define Intflg 5 #define Rshflg 6 #define Execpr 7 #define Keyflg 8 #define Noset 9 #define Noglob 10 #define Allexp 11 #define Noeof 13 #define Nomatch 14 #define Markdir 15 #define Bgnice 16 #define Editvi 17 #define Viraw 18 #define Oneflg 19 #define Hashall 20 #define Stdflg 21 #define Noexec 22 #define Notify 23 #define Gmacs 24 #define Emacs 25 #define Privmod 26 #define Inproc 27 #define FIXFLG (1<