/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ /* All Rights Reserved */ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ /* UNIX System Laboratories, Inc. */ /* The copyright notice above does not evidence any */ /* actual or intended publication of such source code. */ #ident "@(#)ksh:include/defs.h 1.2.4.1" /* * UNIX shell * S. R. Bourne * Rewritten by David Korn * */ #include "sh_config.h" #include #include #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 sysmsgnod /* readonly tables */ { char const *sysmsgid; #ifdef apollo /* pointers can not be in readonly sections */ const char sysnam[28]; #else const char *sysnam; #endif /* apollo */ unsigned sysval; }; struct sys2msgnod /* readonly tables */ { const char *sysmsgid; const char *sysnam; const char *sys2msgid; const char *sys2nam; unsigned sysval; }; /* typedefs used in the shell */ typedef const char MSG[]; typedef const struct sysnod SYSTAB[]; typedef const struct sysmsgnod SYSMSGTAB[]; typedef const struct sys2msgnod SYS2MSGTAB[]; #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 CMDBAD 124 /* For wordexp: command substitution not allowed */ #define CTXBAD 125 /* For wordexp: special chars in bad context */ #define EXEBAD 126 /* File found but not executable */ #define FNDBAD 127 /* File not found */ #define PIDBAD 127 /* Process id not found for b_wait() */ #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 Wordexp 12 #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 29 #define Nocmdst 30 #define FIXFLG (1<