2 * Public Domain Bourne/Korn shell
5 /* $Id: sh.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $ */
7 #include "config.h" /* system and option configuration info */
10 # define ARGS(args) args /* prototype declaration */
12 # define ARGS(args) () /* K&R declaration */
16 /* Start of common headers */
19 #include <sys/types.h>
28 /* just a useful subset of what stdlib.h would have */
29 extern char * getenv ARGS((const char *));
30 extern void * malloc ARGS((size_t));
31 extern void * realloc ARGS((void *, size_t));
32 extern int free ARGS((void *));
33 extern int exit ARGS((int));
34 extern int rand ARGS((void));
35 extern void srand ARGS((unsigned int));
36 extern int atoi ARGS((const char *));
37 #endif /* HAVE_STDLIB_H */
42 /* just a useful subset of what unistd.h would have */
43 extern int access ARGS((const char *, int));
44 extern int open ARGS((const char *, int, ...));
45 extern int creat ARGS((const char *, mode_t));
46 extern int read ARGS((int, char *, unsigned));
47 extern int write ARGS((int, const char *, unsigned));
48 extern off_t lseek ARGS((int, off_t, int));
49 extern int close ARGS((int));
50 extern int pipe ARGS((int []));
51 extern int dup2 ARGS((int, int));
52 extern int unlink ARGS((const char *));
53 extern int fork ARGS((void));
54 extern int execve ARGS((const char *, char * const[], char * const[]));
55 extern int chdir ARGS((const char *));
56 extern int kill ARGS((pid_t, int));
57 extern char *getcwd(); /* no ARGS here - differs on different machines */
58 extern int geteuid ARGS((void));
59 extern int readlink ARGS((const char *, char *, int));
60 extern int getegid ARGS((void));
61 extern int getpid ARGS((void));
62 extern int getppid ARGS((void));
63 extern unsigned int sleep ARGS((unsigned int));
64 extern int isatty ARGS((int));
66 extern int getpgrp ARGS((void));
67 extern int setpgid ARGS((pid_t, pid_t));
68 # endif /* POSIX_PGRP */
70 extern int getpgrp ARGS((pid_t));
71 extern int setpgrp ARGS((pid_t, pid_t));
72 # endif /* BSD_PGRP */
74 extern int getpgrp ARGS((void));
75 extern int setpgrp ARGS((void));
76 # endif /* SYSV_PGRP */
77 #endif /* HAVE_UNISTD_H */
84 # define strrchr rindex
85 #endif /* HAVE_STRING_H */
87 char *strstr ARGS((const char *s, const char *p));
88 #endif /* HAVE_STRSTR */
89 #ifndef HAVE_STRCASECMP
90 int strcasecmp ARGS((const char *s1, const char *s2));
91 int strncasecmp ARGS((const char *s1, const char *s2, int n));
92 #endif /* HAVE_STRCASECMP */
98 # define memcpy(d, s, n) bcopy(s, d, n)
99 # define memcmp(s1, s2, n) bcmp(s1, s2, n)
100 void *memset ARGS((void *d, int c, size_t n));
101 #endif /* HAVE_MEMSET */
104 # define memmove(d, s, n) bcopy(s, d, n)
106 void *memmove ARGS((void *d, const void *s, size_t n));
108 #endif /* HAVE_MEMMOVE */
110 #ifdef HAVE_PROTOTYPES
112 # define SH_VA_START(va, argn) va_start(va, argn)
114 # include <varargs.h>
115 # define SH_VA_START(va, argn) va_start(va)
116 #endif /* HAVE_PROTOTYPES */
124 # include <sys/file.h>
125 #endif /* HAVE_FCNTL_H */
127 # define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
128 #endif /* !O_ACCMODE */
130 #ifndef F_OK /* access() arguments */
139 # define SEEK_SET L_SET
140 # define SEEK_CUR L_INCR
141 # define SEEK_END L_XTND
147 #endif /* !SEEK_SET */
149 /* Some machines (eg, FreeBSD 1.1.5) define CLK_TCK in limits.h
150 * (ksh_limval.h assumes limits has been included, if available)
154 #endif /* HAVE_LIMITS_H */
158 # define SIGNALS NSIG
161 # define SIGNALS (_NSIG+1) /* _NSIG is # of signals used, excluding 0. */
163 # ifdef _SIGMAX /* QNX */
164 # define SIGNALS _SIGMAX
167 # endif /* _SIGMAX */
171 # define SIGCHLD SIGCLD
173 /* struct sigaction.sa_flags is set to KSH_SA_FLAGS. Used to ensure
174 * system calls are interrupted
177 # define KSH_SA_FLAGS SA_INTERRUPT
178 #else /* SA_INTERRUPT */
179 # define KSH_SA_FLAGS 0
180 #endif /* SA_INTERRUPT */
182 typedef RETSIGTYPE (*handler_t) ARGS((int)); /* signal handler */
184 #ifdef USE_FAKE_SIGACT
185 # include "sigact.h" /* use sjg's fake sigaction() */
190 #endif /* HAVE_PATHS_H */
192 # define DEFAULT__PATH _PATH_DEFPATH
193 #else /* _PATH_DEFPATH */
194 # define DEFAULT__PATH DEFAULT_PATH
195 #endif /* _PATH_DEFPATH */
198 # define offsetof(type,id) ((size_t)&((type*)NULL)->id)
202 # define killpg(p, s) kill(-(p), (s))
203 #endif /* !HAVE_KILLPG */
205 /* Special cases for execve(2) */
207 extern int ksh_execve(char *cmd, char **args, char **env, int flags);
209 # if defined(OS_ISC) && defined(_POSIX_SOURCE)
210 /* Kludge for ISC 3.2 (and other versions?) so programs will run correctly. */
211 # define ksh_execve(p, av, ev, flags) \
217 # else /* OS_ISC && _POSIX */
218 # define ksh_execve(p, av, ev, flags) execve(p, av, ev)
219 # endif /* OS_ISC && _POSIX */
222 /* this is a hang-over from older versions of the os2 port */
223 #define ksh_dupbase(fd, base) fcntl(fd, F_DUPFD, base)
225 #ifdef HAVE_SIGSETJMP
226 # define ksh_sigsetjmp(env,sm) sigsetjmp((env), (sm))
227 # define ksh_siglongjmp(env,v) siglongjmp((env), (v))
228 # define ksh_jmp_buf sigjmp_buf
229 #else /* HAVE_SIGSETJMP */
231 # define ksh_sigsetjmp(env,sm) _setjmp(env)
232 # define ksh_siglongjmp(env,v) _longjmp((env), (v))
233 # else /* HAVE__SETJMP */
234 # define ksh_sigsetjmp(env,sm) setjmp(env)
235 # define ksh_siglongjmp(env,v) longjmp((env), (v))
236 # endif /* HAVE__SETJMP */
237 # define ksh_jmp_buf jmp_buf
238 #endif /* HAVE_SIGSETJMP */
241 extern int dup2 ARGS((int, int));
242 #endif /* !HAVE_DUP2 */
244 /* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
245 * by autoconf (assumes an 8 bit byte, but I'm not concerned).
246 * NOTE: INT32 may end up being more than 32 bits.
251 /* #else SIZEOF_INT */
252 # if SIZEOF_LONG >= 4
254 # else /* SIZEOF_LONG */
255 #error cannot find 32 bit type...
256 # endif /* SIZEOF_LONG */
257 #endif /* SIZEOF_INT */
262 /* end of common headers */
264 /* Stop gcc and lint from complaining about possibly uninitialized variables */
265 #if defined(__GNUC__) || defined(lint)
266 # define UNINITIALIZED(var) var = 0
268 # define UNINITIALIZED(var) var
269 #endif /* GNUC || lint */
271 /* some useful #defines */
276 # define EXTERN extern
277 # define EXTERN_DEFINED
281 # define inDOS() (!(_emx_env & 0x200))
285 /* shell to exec scripts (see also $SHELL initialization in main.c) */
287 # define EXECSHELL (inDOS() ? "c:\\command.com" : "c:\\os2\\cmd.exe")
288 # define EXECSHELL_STR (inDOS() ? "COMSPEC" : "OS2_SHELL")
290 # define EXECSHELL "/bin/sh"
291 # define EXECSHELL_STR "EXECSHELL"
295 /* ISABSPATH() means path is fully and completely specified,
296 * ISROOTEDPATH() means a .. as the first component is a no-op,
297 * ISRELPATH() means $PWD can be tacked on to get an absolute path.
299 * OS Path ISABSPATH ISROOTEDPATH ISRELPATH
300 * unix /foo yes yes no
302 * unix ../foo no no yes
303 * os2+cyg a:/foo yes yes no
304 * os2+cyg a:foo no no no
305 * os2+cyg /foo no yes no
306 * os2+cyg foo no no yes
307 * os2+cyg ../foo no no yes
308 * cyg //foo yes yes no
312 # define DIRSEP '/' /* even though \ is native */
313 # define DIRSEPSTR "\\"
314 # define ISDIRSEP(c) ((c) == '\\' || (c) == '/')
315 # define ISABSPATH(s) (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2])))
316 # define ISROOTEDPATH(s) (ISDIRSEP((s)[0]) || ISABSPATH(s))
317 # define ISRELPATH(s) (!(s)[0] || ((s)[1] != ':' && !ISDIRSEP((s)[0])))
318 # define FILECHCONV(c) (isascii(c) && isupper(c) ? tolower(c) : c)
319 # define FILECMP(s1, s2) stricmp(s1, s2)
320 # define FILENCMP(s1, s2, n) strnicmp(s1, s2, n)
321 extern char *ksh_strchr_dirsep(const char *path);
322 extern char *ksh_strrchr_dirsep(const char *path);
323 # define chdir _chdir2
324 # define getcwd _getcwd2
328 # define DIRSEPSTR "/"
329 # define ISDIRSEP(c) ((c) == '/')
331 # define ISABSPATH(s) \
332 (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2])) || ISDIRSEP((s)[0]))
333 # define ISRELPATH(s) (!(s)[0] || ((s)[1] != ':' && !ISDIRSEP((s)[0])))
334 #else /* __CYGWIN__ */
335 # define ISABSPATH(s) ISDIRSEP((s)[0])
336 # define ISRELPATH(s) (!ISABSPATH(s))
337 #endif /* __CYGWIN__ */
338 # define ISROOTEDPATH(s) ISABSPATH(s)
339 # define FILECHCONV(c) c
340 # define FILECMP(s1, s2) strcmp(s1, s2)
341 # define FILENCMP(s1, s2, n) strncmp(s1, s2, n)
342 # define ksh_strchr_dirsep(p) strchr(p, DIRSEP)
343 # define ksh_strrchr_dirsep(p) strrchr(p, DIRSEP)
350 #define NELEM(a) (sizeof(a) / sizeof((a)[0]))
351 #define sizeofN(type, n) (sizeof(type) * (n))
352 #define BIT(i) (1<<(i)) /* define bit in flag */
354 /* Table flag type - needs > 16 and < 32 bits */
357 #define NUFILE 10 /* Number of user-accessible files */
358 #define FDBASE 10 /* First file usable by Shell */
360 /* you're not going to run setuid shell scripts, are you? */
361 #define eaccess(path, mode) access(path, mode)
363 /* Make MAGIC a char that might be printed to make bugs more obvious, but
364 * not a char that is used often. Also, can't use the high bit as it causes
365 * portability problems (calling strchr(x, 0x80|'x') is error prone).
367 #define MAGIC (7)/* prefix for *?[!{,} during expand */
368 #define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
369 #define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */
371 #define LINE 1024 /* input line size */
372 #define PATH 1024 /* pathname size (todo: PATH_MAX/pathconf()) */
373 #define ARRAYMAX 1023 /* max array index */
375 EXTERN const char *kshname; /* $0 */
376 EXTERN pid_t kshpid; /* $$, shell pid */
377 EXTERN pid_t procpid; /* pid of executing process */
378 EXTERN int ksheuid; /* effective uid of shell */
379 EXTERN int exstat; /* exit status */
380 EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
381 EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
385 * Area-based allocation built on malloc/free
388 typedef struct Area {
389 struct Block *freelist; /* free list */
392 EXTERN Area aperm; /* permanent object space */
394 #define ATEMP &e->area
397 # include "chmem.h" /* a debugging front end for malloc et. al. */
398 #endif /* MEM_DEBUG */
401 # define kshdebug_init() kshdebug_init_()
402 # define kshdebug_printf(a) kshdebug_printf_ a
403 # define kshdebug_dump(a) kshdebug_dump_ a
404 #else /* KSH_DEBUG */
405 # define kshdebug_init()
406 # define kshdebug_printf(a)
407 # define kshdebug_dump(a)
408 #endif /* KSH_DEBUG */
412 * parsing & execution environment
415 short type; /* enviroment type - see below */
416 short flags; /* EF_* */
417 Area area; /* temporary allocation area */
418 struct block *loc; /* local variables and functions */
419 short *savefd; /* original redirected fd's */
420 struct env *oenv; /* link to previous enviroment */
421 ksh_jmp_buf jbuf; /* long jump back to env creator */
422 struct temp *temps; /* temp files */
425 /* struct env.type values */
426 #define E_NONE 0 /* dummy enviroment */
427 #define E_PARSE 1 /* parsing command # */
428 #define E_FUNC 2 /* executing function # */
429 #define E_INCL 3 /* including a file via . # */
430 #define E_EXEC 4 /* executing command tree */
431 #define E_LOOP 5 /* executing for/while # */
432 #define E_ERRH 6 /* general error handler # */
433 /* # indicates env has valid jbuf (see unwind()) */
435 /* struct env.flag values */
436 #define EF_FUNC_PARSE BIT(0) /* function being parsed */
437 #define EF_BRKCONT_PASS BIT(1) /* set if E_LOOP must pass break/continue on */
438 #define EF_FAKE_SIGDIE BIT(2) /* hack to get info from unwind to quitenv */
440 /* Do breaks/continues stop at env type e? */
441 #define STOP_BRKCONT(t) ((t) == E_NONE || (t) == E_PARSE \
442 || (t) == E_FUNC || (t) == E_INCL)
443 /* Do returns stop at env type e? */
444 #define STOP_RETURN(t) ((t) == E_FUNC || (t) == E_INCL)
446 /* values for ksh_siglongjmp(e->jbuf, 0) */
447 #define LRETURN 1 /* return statement */
448 #define LEXIT 2 /* exit statement */
449 #define LERROR 3 /* errorf() called */
450 #define LLEAVE 4 /* untrappable exit/error */
451 #define LINTR 5 /* ^C noticed */
452 #define LBREAK 6 /* break statement */
453 #define LCONTIN 7 /* continue statement */
454 #define LSHELL 8 /* return to interactive shell() */
455 #define LAEXPR 9 /* error in arithmetic expression */
458 /* option processing */
459 #define OF_CMDLINE 0x01 /* command line */
460 #define OF_SET 0x02 /* set builtin */
461 #define OF_SPECIAL 0x04 /* a special variable changing */
462 #define OF_INTERNAL 0x08 /* set internally by shell */
463 #define OF_ANY (OF_CMDLINE | OF_SET | OF_SPECIAL | OF_INTERNAL)
466 const char *name; /* long name of option */
467 char c; /* character flag (if any) */
468 short flags; /* OF_* */
470 extern const struct option options[];
473 * flags (the order of these enums MUST match the order in misc.c(options[]))
476 FEXPORT = 0, /* -a: export all */
478 FBRACEEXPAND, /* enable {} globbing */
480 FBGNICE, /* bgnice */
481 FCOMMAND, /* -c: (invocation) execute specified command */
483 FEMACS, /* emacs command editing */
485 FERREXIT, /* -e: quit on error */
487 FGMACS, /* gmacs command editing */
489 FIGNOREEOF, /* eof does not exit */
490 FTALKING, /* -i: interactive */
491 FKEYWORD, /* -k: name=value anywere */
492 FLOGIN, /* -l: a login shell */
493 FMARKDIRS, /* mark dirs with / in file name completion */
494 FMONITOR, /* -m: job control monitoring */
495 FNOCLOBBER, /* -C: don't overwrite existing files */
496 FNOEXEC, /* -n: don't execute any commands */
497 FNOGLOB, /* -f: don't do file globbing */
498 FNOHUP, /* -H: don't kill running jobs when login shell exits */
499 FNOTTALKING, /* -I: don't be interactive */
500 FNOLOG, /* don't save functions in history (ignored) */
502 FNOTIFY, /* -b: asynchronous job completion notification */
504 FNOUNSET, /* -u: using an unset var is an error */
505 FPHYSICAL, /* -o physical: don't do logical cd's/pwd's */
506 FPOSIX, /* -o posix: be posixly correct */
507 FPRIVILEGED, /* -p: use suid_profile */
508 FRESTRICTED, /* -r: restricted shell */
509 FSTDIN, /* -s: (invocation) parse stdin */
510 FTRACKALL, /* -h: create tracked aliases for all commands */
511 FVERBOSE, /* -v: echo input */
513 FVI, /* vi command editing */
514 FVIRAW, /* always read in raw mode (ignored) */
515 FVISHOW8, /* display chars with 8th bit set as is (versus M-) */
516 FVITABCOMPLETE, /* enable tab as file name completion char */
517 FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
519 FXTRACE, /* -x: execution trace */
520 FTALKING_I, /* (internal): initial shell was interactive */
521 FNFLAGS /* (place holder: how many flags are there) */
524 #define Flag(f) (shell_flags[(int) (f)])
526 EXTERN char shell_flags [FNFLAGS];
528 EXTERN char null [] I__(""); /* null value for variable */
529 EXTERN char space [] I__(" ");
530 EXTERN char newline [] I__("\n");
531 EXTERN char slash [] I__("/");
534 TT_HEREDOC_EXP, /* expanded heredoc */
535 TT_HIST_EDIT /* temp file used for history editing (fc -e) */
537 typedef enum temp_type Temp_type;
538 /* temp/heredoc files. The file is removed when the struct is freed. */
542 int pid; /* pid of process parsed here-doc */
548 * stdio and our IO routines
551 #define shl_spare (&shf_iob[0]) /* for c_read()/c_print() */
552 #define shl_stdout (&shf_iob[1])
553 #define shl_out (&shf_iob[2])
554 EXTERN int shl_stdout_ok;
559 typedef struct trap {
560 int signal; /* signal number */
561 const char *name; /* short name */
562 const char *mess; /* descriptive name */
563 char *trap; /* trap command */
564 int volatile set; /* trap pending */
565 int flags; /* TF_* */
566 handler_t cursig; /* current handler (valid if TF_ORIG_* set) */
567 handler_t shtrap; /* shell signal handler */
570 /* values for Trap.flags */
571 #define TF_SHELL_USES BIT(0) /* shell uses signal, user can't change */
572 #define TF_USER_SET BIT(1) /* user has (tried to) set trap */
573 #define TF_ORIG_IGN BIT(2) /* original action was SIG_IGN */
574 #define TF_ORIG_DFL BIT(3) /* original action was SIG_DFL */
575 #define TF_EXEC_IGN BIT(4) /* restore SIG_IGN just before exec */
576 #define TF_EXEC_DFL BIT(5) /* restore SIG_DFL just before exec */
577 #define TF_DFL_INTR BIT(6) /* when received, default action is LINTR */
578 #define TF_TTY_INTR BIT(7) /* tty generated signal (see j_waitj) */
579 #define TF_CHANGED BIT(8) /* used by runtrap() to detect trap changes */
580 #define TF_FATAL BIT(9) /* causes termination if not trapped */
582 /* values for setsig()/setexecsig() flags argument */
583 #define SS_RESTORE_MASK 0x3 /* how to restore a signal before an exec() */
584 #define SS_RESTORE_CURR 0 /* leave current handler in place */
585 #define SS_RESTORE_ORIG 1 /* restore original handler */
586 #define SS_RESTORE_DFL 2 /* restore to SIG_DFL */
587 #define SS_RESTORE_IGN 3 /* restore to SIG_IGN */
588 #define SS_FORCE BIT(3) /* set signal even if original signal ignored */
589 #define SS_USER BIT(4) /* user is doing the set (ie, trap command) */
590 #define SS_SHTRAP BIT(5) /* trap for internal use (CHLD,ALRM,WINCH) */
592 #define SIGEXIT_ 0 /* for trap EXIT */
593 #define SIGERR_ SIGNALS /* for trap ERR */
595 EXTERN int volatile trap; /* traps pending? */
596 EXTERN int volatile intrsig; /* pending trap interrupts executing command */
597 EXTERN int volatile fatal_trap;/* received a fatal signal */
599 /* Kludge to avoid bogus re-declaration of sigtraps[] error on AIX 3.2.5 */
600 extern Trap sigtraps[SIGNALS+1];
601 #endif /* !FROM_TRAP_C */
608 /* values for ksh_tmout_state */
610 TMOUT_EXECUTING = 0, /* executing commands */
611 TMOUT_READING, /* waiting for input */
612 TMOUT_LEAVING /* have timed out */
614 EXTERN unsigned int ksh_tmout;
615 EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
619 /* For "You have stopped jobs" message */
620 EXTERN int really_exit;
624 * fast character classes
626 #define C_ALPHA BIT(0) /* a-z_A-Z */
627 #define C_DIGIT BIT(1) /* 0-9 */
628 #define C_LEX1 BIT(2) /* \0 \t\n|&;<>() */
629 #define C_VAR1 BIT(3) /* *@#!$-? */
630 #define C_IFSWS BIT(4) /* \t \n (IFS white space) */
631 #define C_SUBOP1 BIT(5) /* "=-+?" */
632 #define C_SUBOP2 BIT(6) /* "#%" */
633 #define C_IFS BIT(7) /* $IFS */
634 #define C_QUOTE BIT(8) /* \n\t"#$&'()*;<>?[\`| (needing quoting) */
636 extern short ctypes [];
638 #define ctype(c, t) !!(ctypes[(unsigned char)(c)]&(t))
639 #define letter(c) ctype(c, C_ALPHA)
640 #define digit(c) ctype(c, C_DIGIT)
641 #define letnum(c) ctype(c, C_ALPHA|C_DIGIT)
643 EXTERN int ifs0 I__(' '); /* for "$*" */
646 /* Argument parsing for built-in commands and getopts command */
648 /* Values for Getopt.flags */
649 #define GF_ERROR BIT(0) /* call errorf() if there is an error */
650 #define GF_PLUSOPT BIT(1) /* allow +c as an option */
651 #define GF_NONAME BIT(2) /* don't print argv[0] in errors */
653 /* Values for Getopt.info */
654 #define GI_MINUS BIT(0) /* an option started with -... */
655 #define GI_PLUS BIT(1) /* an option started with +... */
656 #define GI_MINUSMINUS BIT(2) /* arguments were ended with -- */
660 int uoptind;/* what user sees in $OPTIND */
662 int flags; /* see GF_* */
663 int info; /* see GI_* */
664 unsigned int p; /* 0 or index into argv[optind - 1] */
665 char buf[2]; /* for bad option OPTARG value */
668 EXTERN Getopt builtin_opt; /* for shell builtin commands */
669 EXTERN Getopt user_opt; /* parsing state for getopts builtin command */
673 /* This for co-processes */
675 typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
677 int read; /* pipe from co-process's stdout */
678 int readw; /* other side of read (saved temporarily) */
679 int write; /* pipe to co-process's stdin */
680 Coproc_id id; /* id of current output pipe */
681 int njobs; /* number of live jobs using output pipe */
682 void *job; /* 0 or job of co-process using input pipe */
684 EXTERN struct coproc coproc;
687 /* Used in jobs.c and by coprocess stuff in exec.c */
689 EXTERN sigset_t sm_default, sm_sigchld;
690 #endif /* JOB_SIGS */
692 extern const char ksh_version[];
694 /* name of called builtin function (used by error functions) */
695 EXTERN char *builtin_argv0;
696 EXTERN Tflag builtin_flag; /* flags of called builtin (SPEC_BI, etc.) */
698 /* current working directory, and size of memory allocated for same */
699 EXTERN char *current_wd;
700 EXTERN int current_wd_size;
703 /* Minimium required space to work with on a line - if the prompt leaves less
704 * space than this on a line, the prompt is truncated.
706 # define MIN_EDIT_SPACE 7
707 /* Minimium allowed value for x_cols: 2 for prompt, 3 for " < " at end of line
709 # define MIN_COLS (2 + MIN_EDIT_SPACE + 3)
710 EXTERN int x_cols I__(80); /* tty columns */
712 # define x_cols 80 /* for pr_menu(exec.c) */
716 /* These to avoid bracket matching problems */
724 /* Determine the location of the system (common) profile */
725 #ifndef KSH_SYSTEM_PROFILE
727 # define KSH_SYSTEM_PROFILE "/etc/profile.std"
729 # define KSH_SYSTEM_PROFILE "/etc/profile"
731 #endif /* KSH_SYSTEM_PROFILE */
733 /* Used by v_evaluate() and setstr() to control action when error occurs */
734 #define KSH_UNWIND_ERROR 0 /* unwind the stack (longjmp) */
735 #define KSH_RETURN_ERROR 1 /* return 1/0 for success/failure */
744 /* be sure not to interfere with anyone else's idea about EXTERN */
745 #ifdef EXTERN_DEFINED
746 # undef EXTERN_DEFINED