/*ident "@(#)Path:ksh/defs.h 3.1" */ /* * UNIX shell * S. R. Bourne * Rewritten by David Korn * */ #include "../section3.h" #include "sh_config.h" #include #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; }; struct blk /* heap storage */ { struct blk *word; /* data */ }; /* typedefs used in the shell */ typedef const char MSG[]; typedef const struct sysnod SYSTAB[]; #include "io.h" #if 0 #include "name.h" #include "shnodes.h" #include "stak.h" #include "shtype.h" #endif /* 0 */ /* error exits from various parts of shell */ #define ERROR 1 #define SYNBAD 2 #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 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) #define ADR(x) ((char*)(x)) /* 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 #define Inproc 27 #define Nolog 28 #define FIXFLG (1<