#ifndef _h_sh
#define _h_sh
#include "config.h"
#include <stddef.h>
#ifdef HAVE_ICONV
# include <iconv.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && !defined(WINNT_NATIVE)
typedef unsigned long intptr_t;
#endif
#ifndef EXTERN
# define EXTERN extern
#else
# ifdef WINNT_NATIVE
# define IZERO = 0
# define IZERO_STRUCT = {0}
# endif
#endif
#ifndef IZERO
# define IZERO
#endif
#ifndef IZERO_STRUCT
# define IZERO_STRUCT
#endif
#ifndef WINNT_NATIVE
# define INIT_ZERO
# define INIT_ZERO_STRUCT
# define force_read read
#endif
#if defined(_POSIX_SOURCE) && !defined(POSIX)
# define POSIX
#endif
#if defined(POSIXJOBS) && !defined(BSDJOBS)
# define BSDJOBS
#endif
#if defined(POSIXSIGS) && !defined(BSDSIGS)
# define BSDSIGS
#endif
#ifdef SHORT_STRINGS
#include <wchar.h>
# ifdef WIDE_STRINGS
typedef wchar_t Char;
typedef unsigned long uChar;
typedef wint_t eChar;
#define CHAR_ERR WEOF
#define normal_mbtowc(PWC, S, N) rt_mbtowc(PWC, S, N)
#define reset_mbtowc() mbtowc(NULL, NULL, 0)
# else
typedef short Char;
typedef unsigned short uChar;
typedef int eChar;
#define CHAR_ERR (-1)
#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1)
#define reset_mbtowc() ((void)0)
# endif
# define SAVE(a) (Strsave(str2short(a)))
#else
typedef char Char;
typedef unsigned char uChar;
typedef int eChar;
#define CHAR_ERR (-1)
#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1)
#define reset_mbtowc() ((void)0)
# define SAVE(a) (strsave(a))
#endif
#if SIZEOF_WCHAR_T >= 4
typedef wchar_t NLSChar;
#else
typedef int NLSChar;
#endif
#define USE(a) (void) (a)
#if defined(WINNT_NATIVE)
# define ABSOLUTEP(p) ((p)[0] == '/' || \
(Isalpha((p)[0]) && (p)[1] == ':'))
#elif defined(__CYGWIN__)
# define ABSOLUTEP(p) ((p)[0] == '/' || \
(Isalpha((p)[0]) && (p)[1] == ':' && \
((p)[2] == '\0' || (p)[2] == '/')))
#else
# define ABSOLUTEP(p) (*(p) == '/')
#endif
#ifdef BUFSIZE
# if BUFSIZE < 4096
# undef BUFSIZE
# define BUFSIZE 4096
# endif
#else
# define BUFSIZE 4096
#endif
#define FORKSLEEP 10
#define MAILINTVL 600
#ifndef INBUFSIZE
# define INBUFSIZE 2*BUFSIZE
#endif
#define NONE_ECHO 0
#define BSD_ECHO 1
#define SYSV_ECHO 2
#define BOTH_ECHO (BSD_ECHO|SYSV_ECHO)
#ifndef ECHO_STYLE
# if SYSVREL > 0
# define ECHO_STYLE SYSV_ECHO
# else
# define ECHO_STYLE BSD_ECHO
# endif
#endif
#define FSAFE 5
#define FSHTTY 15
#define FSHIN 16
#define FSHOUT 17
#define FSHDIAG 18
#define FOLDSTD 19
#ifdef PROF
#define xexit(n) done(n)
#endif
#ifdef cray
# define word word_t
#endif
#include <sys/types.h>
#ifdef cray
# undef word
#endif
#ifndef PATHSEP
# if defined(__EMX__) || defined(WINNT_NATIVE)
# define PATHSEP ';'
# else
# define PATHSEP ':'
# endif
#endif
#if defined(__HP_CXD_SPP) && !defined(__hpux)
# include <sys/cnx_stat.h>
# define stat stat64
# define fstat fstat64
# define lstat lstat64
#endif
#ifndef DEV_DEV_COMPARE
# define DEV_DEV_COMPARE(x,y) ((x) == (y))
#endif
#ifdef _SEQUENT_
# include <sys/procstats.h>
#endif
#if (defined(POSIX) || SYSVREL > 0) && !defined(WINNT_NATIVE)
# include <sys/times.h>
#endif
#ifdef NLS
# include <locale.h>
#endif
#if !defined(_MINIX) && !defined(_VMS_POSIX) && !defined(WINNT_NATIVE) && !defined(__MVS__)
# include <sys/param.h>
#endif
#include <sys/stat.h>
#if defined(BSDTIMES) || defined(BSDLIMIT)
# include <sys/time.h>
# if SYSVREL>3 && !defined(SCO) && !defined(sgi) && !defined(SNI) && !defined(sun) && !(defined(__alpha) && defined(__osf__)) && !defined(_SX) && !defined(__MVS__)
# include "/usr/ucbinclude/sys/resource.h"
# else
# ifdef convex
# define sysrusage cvxrusage
# include <sys/sysinfo.h>
# else
# define sysrusage rusage
# include <sys/resource.h>
# endif
# endif
#endif
#ifndef WINNT_NATIVE
# ifndef POSIX
# ifdef TERMIO
# include <termio.h>
# else
# include <sgtty.h>
# endif
# else
# ifndef _UWIN
# include <termios.h>
# else
# include <termio.h>
# endif
# if SYSVREL > 3
# undef TIOCGLTC
# undef TIOCSLTC
# undef CSWTCH
# define CSWTCH _POSIX_VDISABLE
# endif
# endif
#endif
#ifdef sonyrisc
# include <sys/ttold.h>
#endif
#if defined(POSIX) && !defined(WINNT_NATIVE)
# include <unistd.h>
# if defined(SYSMALLOC) || defined(linux) || defined(__GNU__) || defined(__GLIBC__) || defined(sgi) || defined(_OSD_POSIX)
# define NO_FIX_MALLOC
# include <stdlib.h>
# else
# define _GNU_STDLIB_H
# define malloc __malloc
# define free __free
# define calloc __calloc
# define realloc __realloc
# include <stdlib.h>
# undef malloc
# undef free
# undef calloc
# undef realloc
# endif
# include <limits.h>
#endif
#if SYSVREL > 0 || defined(_IBMR2) || defined(_MINIX) || defined(linux) || defined(__GNU__) || defined(__GLIBC__)
# if !defined(pyr) && !defined(stellar)
# include <time.h>
# ifdef _MINIX
# define HZ CLOCKS_PER_SEC
# endif
# endif
#endif
#if !((defined(SUNOS4) || defined(_MINIX) ) && defined(TERMIO))
# if !defined(COHERENT) && !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
# include <sys/ioctl.h>
# endif
#endif
#if (defined(__DGUX__) && defined(POSIX)) || defined(DGUX)
#undef CSWTCH
#define CSWTCH _POSIX_VDISABLE
#endif
#if (!defined(FIOCLEX) && defined(SUNOS4)) || ((SYSVREL == 4) && !defined(_SEQUENT_) && !defined(SCO) && !defined(_SX)) && !defined(__MVS__)
# include <sys/filio.h>
#endif
#if !defined(_MINIX) && !defined(COHERENT) && !defined(supermax) && !defined(WINNT_NATIVE) && !defined(IRIS4D)
# include <sys/file.h>
#endif
#if !defined(O_RDONLY) || !defined(O_NDELAY)
# include <fcntl.h>
#endif
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#include <errno.h>
#include <setjmp.h>
#if defined(PROTOTYPES)
# include <stdarg.h>
#else
#ifdef _MINIX
# include "mi.varargs.h"
#else
# include <varargs.h>
#endif
#endif
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#else
# ifdef HAVE_NDIR_H
# include <ndir.h>
# else
# include <sys/dir.h>
# endif
# define dirent direct
#endif
#ifndef HAVE_STRUCT_DIRENT_D_INO
# define d_ino d_fileno
#endif
#if defined(hpux) || defined(sgi) || defined(OREO) || defined(COHERENT)
# include <stdio.h>
#endif
#ifndef WINNT_NATIVE
#include <pwd.h>
#include <grp.h>
#endif
#ifdef HAVE_SHADOW_H
# include <shadow.h>
#endif
#ifdef HAVE_AUTH_H
# include <auth.h>
#endif
#if defined(BSD) && !defined(POSIX)
# include <strings.h>
# define strchr(a, b) index(a, b)
# define strrchr(a, b) rindex(a, b)
#else
# include <string.h>
#endif
#if defined(sgi) && SYSVREL > 3
# include <sys/cdefs.h>
#endif
#ifdef REMOTEHOST
# ifdef ISC
# undef MAXHOSTNAMELEN
# endif
# include <netinet/in.h>
# include <arpa/inet.h>
# include <sys/socket.h>
# if (defined(_SS_SIZE) || defined(_SS_MAXSIZE)) && defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
# if !defined(__APPLE__)
# if !defined(sgi)
# define INET6
# endif
# endif
# endif
# include <sys/uio.h>
#endif
#undef __P
#ifndef __P
# if defined(PROTOTYPES)
# define __P(a) a
# else
# define __P(a) ()
# endif
#endif
#ifdef PURIFY
# define _exit exit
typedef int pret_t;
#else
# if (defined(vax) || defined(uts) || defined(MULTIFLOW) || defined(PCC)) && !defined(__GNUC__)
# define pret_t void
# else
typedef void pret_t;
# endif
#endif
#if 'Z' - 'A' == 25
# ifndef IS_ASCII
# define IS_ASCII
# endif
#endif
#include "sh.types.h"
#ifndef __NetBSD__
#ifndef WINNT_NATIVE
# ifndef GETPGRP_VOID
extern pid_t getpgrp __P((int));
# else
extern pid_t getpgrp __P((void));
# endif
#endif
#endif
typedef RETSIGTYPE (*signalfun_t) __P((int));
#ifndef lint
typedef ptr_t memalign_t;
#else
typedef union {
char am_char, *am_char_p;
short am_short, *am_short_p;
int am_int, *am_int_p;
long am_long, *am_long_p;
float am_float, *am_float_p;
double am_double, *am_double_p;
} *memalign_t;
# define malloc lint_malloc
# define free lint_free
# define realloc lint_realloc
# define calloc lint_calloc
#endif
#ifdef MDEBUG
extern memalign_t DebugMalloc __P((unsigned, char *, int));
extern memalign_t DebugRealloc __P((ptr_t, unsigned, char *, int));
extern memalign_t DebugCalloc __P((unsigned, unsigned, char *, int));
extern void DebugFree __P((ptr_t, char *, int));
# define xmalloc(i) DebugMalloc(i, __FILE__, __LINE__)
# define xrealloc(p, i)((p) ? DebugRealloc(p, i, __FILE__, __LINE__) : \
DebugMalloc(i, __FILE__, __LINE__))
# define xcalloc(n, s) DebugCalloc(n, s, __FILE__, __LINE__)
# define xfree(p) if (p) DebugFree(p, __FILE__, __LINE__)
#else
# ifdef SYSMALLOC
# define xmalloc(i) smalloc(i)
# define xrealloc(p, i) srealloc(p, i)
# define xcalloc(n, s) scalloc(n, s)
# define xfree(p) sfree(p)
# else
# define xmalloc(i) malloc(i)
# define xrealloc(p, i) realloc(p, i)
# define xcalloc(n, s) calloc(n, s)
# define xfree(p) free(p)
# endif
#endif
#include "sh.char.h"
#include "sh.err.h"
#include "sh.dir.h"
#include "sh.proc.h"
#include "pathnames.h"
#if !defined(MAXNAMLEN) && defined(_D_NAME_MAX)
# define MAXNAMLEN _D_NAME_MAX
#endif
#ifdef HESIOD
# include <hesiod.h>
#endif
#ifdef REMOTEHOST
# include <netdb.h>
#endif
#ifndef MAXHOSTNAMELEN
# if defined(SCO) && (SYSVREL > 3)
# include <sys/socket.h>
# else
# define MAXHOSTNAMELEN 256
# endif
#endif
#define eq(a, b) (Strcmp(a, b) == 0)
#define G_ERROR 0
#define G_IGNORE 1
#define G_APPEND 2
EXTERN int chkstop IZERO;
#if (defined(FIOCLEX) && defined(FIONCLEX)) || defined(F_SETFD)
# define CLOSE_ON_EXEC
#else
EXTERN int didcch IZERO;
#endif
EXTERN int didfds IZERO;
EXTERN int doneinp IZERO;
EXTERN int exiterr IZERO;
EXTERN int child IZERO;
EXTERN int haderr IZERO;
EXTERN int intty IZERO;
EXTERN int intact IZERO;
EXTERN int justpr IZERO;
EXTERN int loginsh IZERO;
EXTERN int neednote IZERO;
EXTERN int noexec IZERO;
EXTERN int pjobs IZERO;
EXTERN int setintr IZERO;
EXTERN int timflg IZERO;
EXTERN int havhash IZERO;
EXTERN int editing IZERO;
EXTERN int noediting IZERO;
EXTERN int bslash_quote IZERO;
EXTERN int isoutatty IZERO;
EXTERN int isdiagatty IZERO;
EXTERN int is1atty IZERO;
EXTERN int is2atty IZERO;
EXTERN int arun IZERO;
EXTERN int implicit_cd IZERO;
EXTERN int inheredoc IZERO;
EXTERN int windowchg IZERO;
#if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
EXTERN int dspmbyte_ls;
#endif
EXTERN Char *arginp IZERO;
EXTERN int onelflg IZERO;
extern Char *ffile;
extern int dolzero;
extern char *seterr;
#ifndef errno
extern int errno;
#endif
extern int exitset;
EXTERN Char *shtemp IZERO;
#ifdef BSDTIMES
EXTERN struct timeval time0;
EXTERN struct sysrusage ru0;
#else
# ifdef _SEQUENT_
EXTERN timeval_t time0;
EXTERN struct process_stats ru0;
# else
# ifndef POSIX
EXTERN time_t time0;
# else
EXTERN clock_t time0;
EXTERN clock_t clk_tck;
# endif
EXTERN struct tms shtimes;
# endif
EXTERN long seconds0;
#endif
#ifndef HZ
# define HZ 100
#endif
EXTERN Char *doldol;
EXTERN int backpid;
EXTERN uid_t uid, euid;
EXTERN gid_t gid, egid;
EXTERN pid_t opgrp,
shpgrp,
tpgrp;
EXTERN Char PromptBuf[INBUFSIZE*2];
EXTERN Char RPromptBuf[INBUFSIZE];
EXTERN int SHIN IZERO;
EXTERN int SHOUT IZERO;
EXTERN int SHDIAG IZERO;
EXTERN int OLDSTD IZERO;
#if SYSVREL == 4 && defined(_UTS)
# define SIGSETJMP
#endif
#ifdef NO_STRUCT_ASSIGNMENT
# ifdef SIGSETJMP
typedef sigjmp_buf jmp_buf_t;
# define setexit() sigsetjmp(reslab)
# define reset() siglongjmp(reslab, 1)
# else
typedef jmp_buf jmp_buf_t;
# define setexit() setjmp(reslab)
# define reset() longjmp(reslab, 1)
# endif
# define getexit(a) (void) memmove((ptr_t)&(a), (ptr_t)&reslab, sizeof(reslab))
# define resexit(a) (void) memmove((ptr_t)&reslab, (ptr_t)&(a), sizeof(reslab))
# define cpybin(a, b) (void) memmove((ptr_t)&(a), (ptr_t)&(b), sizeof(Bin))
#else
# ifdef SIGSETJMP
typedef struct { sigjmp_buf j; } jmp_buf_t;
# define setexit() sigsetjmp(reslab.j)
# define reset() siglongjmp(reslab.j, 1)
# else
typedef struct { jmp_buf j; } jmp_buf_t;
# define setexit() setjmp(reslab.j)
# define reset() longjmp(reslab.j, 1)
# endif
# define getexit(a) (void) ((a) = reslab)
# define resexit(a) (void) (reslab = (a))
# define cpybin(a, b) (void) ((a) = (b))
#endif
extern jmp_buf_t reslab;
EXTERN Char *gointr;
extern signalfun_t parintr;
extern signalfun_t parterm;
#define META 0200
#define ASCII 0177
#ifdef WIDE_STRINGS
# define QUOTE 0x40000000
# define TRIM 0x3FFFFFFF
# define UNDER 0x20000000
# define BOLD 0x10000000
# define STANDOUT 0x08000000
# define LITERAL 0x04000000
# define ATTRIBUTES 0x3C000000
# define INVALID_BYTE 0x00200000
# define CHAR 0x003FFFFF
#elif defined (SHORT_STRINGS)
# define QUOTE ((Char) 0100000)
# define TRIM 0073777
# define UNDER 0040000
# define BOLD 0020000
# define STANDOUT 0010000
# define LITERAL 0004000
# define ATTRIBUTES 0074000
# define INVALID_BYTE 0
# define CHAR 0000377
#else
# define QUOTE ((Char) 0200)
# define TRIM 0177
# define UNDER 0000000
# define BOLD 0000000
# define STANDOUT META
# define LITERAL 0000000
# define ATTRIBUTES 0200
# define INVALID_BYTE 0
# define CHAR 0000177
#endif
#define CHAR_DBWIDTH (LITERAL|(LITERAL-1))
EXTERN int AsciiOnly;
EXTERN struct Bin {
off_t Bfseekp;
off_t Bfbobp;
off_t Bfeobp;
int Bfblocks;
Char **Bfbuf;
#ifdef WIDE_STRINGS
unsigned char Bfclens[BUFSIZE + 1];
#endif
} B;
struct Ain {
int type;
#define TCSH_I_SEEK 0
#define TCSH_A_SEEK 1
#define TCSH_F_SEEK 2
#define TCSH_E_SEEK 3
union {
off_t _f_seek;
Char* _c_seek;
} fc;
#define f_seek fc._f_seek
#define c_seek fc._c_seek
Char **a_seek;
} ;
extern int aret;
#define SEEKEQ(a, b) ((a)->type == (b)->type && \
(a)->f_seek == (b)->f_seek && \
(a)->a_seek == (b)->a_seek)
#define fseekp B.Bfseekp
#define fbobp B.Bfbobp
#define feobp B.Bfeobp
#define fblocks B.Bfblocks
#define fbuf B.Bfbuf
#define fclens B.Bfclens
EXTERN struct Ain lineloc;
EXTERN int cantell;
struct wordent {
Char *word;
struct wordent *prev;
struct wordent *next;
};
#define DODOL 1
#define DOEXCL 2
#define DOALL DODOL|DOEXCL
EXTERN Char *lap;
struct command {
unsigned char t_dtyp;
#define NODE_COMMAND 1
#define NODE_PAREN 2
#define NODE_PIPE 3
#define NODE_LIST 4
#define NODE_OR 5
#define NODE_AND 6
unsigned char t_nice;
#ifdef apollo
unsigned char t_systype;
#endif
unsigned long t_dflg;
#ifndef apollo
#define F_SAVE (F_NICE|F_TIME|F_NOHUP|F_HUP)
#else
#define F_SAVE (F_NICE|F_TIME|F_NOHUP||F_HUP|F_VER)
#endif
#define F_AMPERSAND (1<<0)
#define F_APPEND (1<<1)
#define F_PIPEIN (1<<2)
#define F_PIPEOUT (1<<3)
#define F_NOFORK (1<<4)
#define F_NOINTERRUPT (1<<5)
#define F_STDERR (1<<7)
#define F_OVERWRITE (1<<8)
#define F_READ (1<<9)
#define F_REPEAT (1<<10)
#define F_NICE (1<<11)
#define F_NOHUP (1<<12)
#define F_TIME (1<<13)
#define F_BACKQ (1<<14)
#define F_HUP (1<<15)
#ifdef apollo
#define F_VER (1<<16)
#endif
union {
Char *T_dlef;
struct command *T_dcar;
} L;
union {
Char *T_drit;
struct command *T_dcdr;
} R;
#define t_dlef L.T_dlef
#define t_dcar L.T_dcar
#define t_drit R.T_drit
#define t_dcdr R.T_dcdr
Char **t_dcom;
struct command *t_dspr;
};
#define TC_BREAK 0
#define TC_BRKSW 1
#define TC_CASE 2
#define TC_DEFAULT 3
#define TC_ELSE 4
#define TC_END 5
#define TC_ENDIF 6
#define TC_ENDSW 7
#define TC_EXIT 8
#define TC_FOREACH 9
#define TC_GOTO 10
#define TC_IF 11
#define TC_LABEL 12
#define TC_LET 13
#define TC_SET 14
#define TC_SWITCH 15
#define TC_TEST 16
#define TC_THEN 17
#define TC_WHILE 18
#if defined(hpux) && defined(__STDC__) && !defined(__GNUC__)
typedef void (*bfunc_t) ();
#else
typedef void (*bfunc_t) __P((Char **, struct command *));
#endif
extern struct biltins {
const char *bname;
bfunc_t bfunct;
int minargs, maxargs;
} bfunc[];
extern int nbfunc;
#ifdef WINNT_NATIVE
extern struct biltins nt_bfunc[];
extern int nt_nbfunc;
#endif
extern int bequiet;
extern struct srch {
const char *s_name;
int s_value;
} srchn[];
extern int nsrchn;
EXTERN struct whyle {
struct Ain w_start;
struct Ain w_end;
Char **w_fe, **w_fe0;
Char *w_fename;
struct whyle *w_next;
} *whyles;
EXTERN struct varent {
Char **vec;
Char *v_name;
int v_flags;
#define VAR_ALL -1
#define VAR_READONLY 1
#define VAR_READWRITE 2
#define VAR_NOGLOB 4
#define VAR_FIRST 32
#define VAR_LAST 64
struct varent *v_link[3];
int v_bal;
} shvhed IZERO_STRUCT, aliases IZERO_STRUCT;
#define v_left v_link[0]
#define v_right v_link[1]
#define v_parent v_link[2]
#define adrof(v) adrof1(v, &shvhed)
#define varval(v) value1(v, &shvhed)
EXTERN struct wordent *alhistp IZERO_STRUCT;
EXTERN struct wordent *alhistt IZERO_STRUCT;
EXTERN Char **alvec IZERO_STRUCT,
*alvecp IZERO_STRUCT;
EXTERN int gflag;
#define MAXVARLEN 256
#ifdef __CYGWIN__
# undef MAXPATHLEN
#endif
#ifndef MAXPATHLEN
# define MAXPATHLEN 2048
#endif
#ifndef MAXNAMLEN
# define MAXNAMLEN 512
#endif
#ifndef HAVENOLIMIT
extern struct limits {
int limconst;
const char *limname;
int limdiv;
const char *limscale;
} limits[];
#endif
extern Char **gargv;
extern int gargc;
extern Char **pargv;
EXTERN Char *pargs;
EXTERN long pnleft;
EXTERN Char *pargcp;
EXTERN struct Hist {
struct wordent Hlex;
int Hnum;
int Href;
time_t Htime;
Char *histline;
struct Hist *Hnext;
} Histlist IZERO_STRUCT;
EXTERN struct wordent paraml;
EXTERN int eventno;
EXTERN int lastev;
EXTERN Char HIST;
EXTERN Char HISTSUB;
EXTERN Char PRCH;
EXTERN Char PRCHROOT;
#ifdef CASE_INSENSITIVE
# ifdef WIDE_STRINGS
# define samecase(x) (towlower(x))
# else
# define samecase(x) (isupper((unsigned char)(x)) ? \
tolower((unsigned char)(x)) : (x))
# endif
#else
# define samecase(x) (x)
#endif
#ifndef SHORT_STRINGS
#define Strchr(a, b) strchr(a, b)
#define Strrchr(a, b) strrchr(a, b)
#define Strcat(a, b) strcat(a, b)
#define Strncat(a, b, c) strncat(a, b, c)
#define Strcpy(a, b) strcpy(a, b)
#define Strncpy(a, b, c) strncpy(a, b, c)
#define Strlen(a) strlen(a)
#define Strcmp(a, b) strcmp(a, b)
#define Strncmp(a, b, c) strncmp(a, b, c)
#define Strcasecmp(a, b) strcasecmp(a, b)
#define Strspl(a, b) strspl(a, b)
#define Strsave(a) strsave(a)
#define Strend(a) strend(a)
#define Strstr(a, b) strstr(a, b)
#define str2short(a) (a)
#define blk2short(a) saveblk(a)
#define short2blk(a) saveblk(a)
#define short2str(a) strip(a)
#else
#ifdef WIDE_STRINGS
#define Strchr(a, b) wcschr(a, b)
#define Strrchr(a, b) wcsrchr(a, b)
#define Strcat(a, b) wcscat(a, b)
#define Strncat(a, b, c) wcsncat(a, b, c)
#define Strcpy(a, b) wcscpy(a, b)
#define Strncpy(a, b, c) wcsncpy(a, b, c)
#define Strlen(a) wcslen(a)
#define Strcmp(a, b) wcscmp(a, b)
#define Strncmp(a, b, c) wcsncmp(a, b, c)
#else
#define Strchr(a, b) s_strchr(a, b)
#define Strrchr(a, b) s_strrchr(a, b)
#define Strcat(a, b) s_strcat(a, b)
#define Strncat(a, b, c) s_strncat(a, b, c)
#define Strcpy(a, b) s_strcpy(a, b)
#define Strncpy(a, b, c) s_strncpy(a, b, c)
#define Strlen(a) s_strlen(a)
#define Strcmp(a, b) s_strcmp(a, b)
#define Strncmp(a, b, c) s_strncmp(a, b, c)
#endif
#define Strcasecmp(a, b) s_strcasecmp(a, b)
#define Strspl(a, b) s_strspl(a, b)
#define Strsave(a) s_strsave(a)
#define Strend(a) s_strend(a)
#define Strstr(a, b) s_strstr(a, b)
#endif
EXTERN const char *bname;
#define setname(a) (bname = (a))
#ifdef VFORK
EXTERN Char *Vsav;
EXTERN Char *Vdp;
EXTERN Char *Vexpath;
EXTERN char **Vt;
#endif
EXTERN Char **evalvec;
EXTERN Char *evalp;
extern struct mesg {
const char *iname;
const char *pname;
} mesg[];
EXTERN Char *word_chars;
#define WORD_CHARS "*?_-.[]~="
EXTERN Char *STR_SHELLPATH;
#ifdef _PATH_BSHELL
EXTERN Char *STR_BSHELL;
#endif
EXTERN Char *STR_WORD_CHARS;
EXTERN Char **STR_environ IZERO;
extern int dont_free;
extern Char *INVPTR;
extern Char **INVPPTR;
extern char *progname;
extern int tcsh;
extern int xlate_cr;
extern int output_raw;
extern int lbuffed;
extern time_t Htime;
extern int numeof;
extern int insource;
extern char linbuf[];
extern char *linp;
extern int nsig;
#ifdef VFORK
extern int use_fork;
#endif
extern int tellwhat;
extern int NoNLSRebind;
#include "tc.h"
#ifndef WINNT_NATIVE
# ifdef NLS_CATALOGS
# if defined(linux) || defined(__GNU__) || defined(__GLIBC__)
# include <locale.h>
# ifdef notdef
# include <localeinfo.h>
# endif
# include <features.h>
# endif
# ifdef SUNOS4
typedef void *nl_catd;
extern const char * catgets __P((nl_catd, int, int, const char *));
nl_catd catopen __P((const char *, int));
int catclose __P((nl_catd));
# else
# ifdef __uxps__
# define gettxt gettxt_ds
# endif
# include <nl_types.h>
# ifdef __uxps__
# undef gettxt
# endif
# endif
# ifndef MCLoadBySet
# define MCLoadBySet 0
# endif
EXTERN nl_catd catd;
# ifdef HAVE_ICONV
# define CGETS(b, c, d) iconv_catgets(catd, b, c, d)
# else
# define CGETS(b, c, d) catgets(catd, b, c, d)
# endif
# define CSAVS(b, c, d) strsave(CGETS(b, c, d))
# else
# define CGETS(b, c, d) d
# define CSAVS(b, c, d) d
# endif
#else
# define CGETS(b, c, d) nt_cgets( b, c, d)
# define CSAVS(b, c, d) strsave(CGETS(b, c, d))
#endif
#if defined(FILEC)
extern int filec;
#endif
#include "sh.decls.h"
#define SIGN_EXTEND_CHAR(a) (((a) & 0x80) ? ((a) | ~0x7f) : (a))
#define HELP_STRING "\
-b file batch mode, read and execute commands from `file' \n\
-c command run `command' from next argument \n\
-d load directory stack from `~/.cshdirs' \n\
-Dname[=value] define environment variable `name' to `value' (DomainOS only) \n\
-e exit on any error \n\
-f start faster by ignoring the start-up file \n\
-F use fork() instead of vfork() when spawning (ConvexOS only) \n\
-i interactive, even when input is not from a terminal \n\
-l act as a login shell, must be the only option specified \n\
-m load the start-up file, whether or not owned by effective user \n\
-n file no execute mode, just check syntax of the following `file' \n\
-q accept SIGQUIT for running under a debugger \n\
-s read commands from standard input \n\
-t read one line from standard input \n\
-v echo commands after history substitution \n\
-V like -v but including commands read from the start-up file \n\
-x echo commands immediately before execution \n\
-X like -x but including commands read from the start-up file \n\
--help print this message and exit \n\
--version print the version shell variable and exit \n\
\nSee the tcsh(1) manual page for detailed information.\n"
#include "tc.nls.h"
#endif