#ident "@(#)defs.h 1.12 95/04/10 SMI" /* From AT&T Toolchest */ /* * UNIX shell * S. R. Bourne * Rewritten by David Korn * */ #include "sh_config.h" #include #include #ifndef NSIG # define NSIG 32 #endif /* NSIG */ #ifdef _unistd_h # include #endif /* _unistd_h */ #ifdef _sys_times_ # include #else struct tms { time_t tms_utime; time_t tms_stime; time_t tms_cutime; time_t tms_cstime; }; #endif /* _sys_times */ struct sysnod /* readonly tables */ { #ifdef apollo /* pointers can not be in readonly sections */ const char sysnam[28]; #else const char *sysnam; #endif /* apollo */ unsigned sysval; }; /* typedefs used in the shell */ typedef const char MSG[]; typedef const struct sysnod SYSTAB[]; #include "name.h" #include "shnodes.h" #include "stak.h" #include "shtype.h" /* error exits from various parts of shell */ #define ERROR 1 #define SYNBAD 2 #define ENOTFOUND 127 /* XPG4 */ #define ECANTEXEC 126 /* XPG4 */ #define ETEST 2 /* XPG4: test(1) error */ #ifdef WEXP #define WEXP_BADCHAR 3 /* XPG4: WRDE_BADCHAR error */ #define WEXP_CMDSUB 4 /* XPG4: WRDE_CMDSUB error */ #define WEXP_BADVAL 5 /* XPG4: WRDE_BADVAL error */ #define WEXP_SYNTAX 6 /* XPG4: WRDE_SYNTAX error */ extern MSG e_wrde_badchar; extern MSG e_wrde_cmdsub; extern MSG e_wrde_badval; #endif #define BYTESPERWORD ((unsigned)sizeof(char *)) #define NIL ((char*)0) #define ENDARGS NIL /* arg list terminator */ #ifndef NULL # define NULL 0 #endif #define NULLSTR ((char*)e_nullstr) #define OPATH 2 /* path offset for path_join */ /* leaves room for _= */ #define round(a,b) ((sizeof(char*)==sizeof(int))?\ (((int)(((a)+b)-1))&~((b)-1)):\ (((long)(((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() (sh.savexit=sh.exitval) /* flags */ typedef long optflag; #ifdef INT16 # ifndef pdp11 # define _OPTIM_ 1 # endif /* pdp11 */ #endif /* INT16 */ #ifdef _OPTIM_ # define _HIGH_ 1 # define _LOW_ 1-_HIGH_ # define is_option(x) ((x)&0xffffL?\ st.flags.i[_LOW_]&(unsigned int)(x):\ st.flags.i[_HIGH_]&(unsigned int)((x)>>16)) # define on_option(x) ((x)&0xffffL?\ (st.flags.i[_LOW_] |= (unsigned int)(x)):\ (st.flags.i[_HIGH_] |= (unsigned int)((x)>>16))) # define off_option(x) ((x)&0xffffL?\ (st.flags.i[_LOW_] &= ~(unsigned int)(x)):\ (st.flags.i[_HIGH_] &= ~(unsigned int)((x)>>16))) #else # define is_option(x) (st.flags.l & (x)) # define on_option(x) (st.flags.l |= (x)) # define off_option(x) (st.flags.l &= ~(x)) #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 Noclob 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 #ifdef apollo # define Aphysical 27 #endif /* apollo */ #define Nolog 28 #define Cflag 12 /* XPG4 */ #ifdef WEXP /* XPG4: Word Expansion Library Support */ #define Wexp_e 29 #define Wexp_n 30 #endif /* WEXP */ #define FIXFLG (1<