sh.h revision 1.18 1 /* $NetBSD: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $ */
2
3 /*
4 * Public Domain Bourne/Korn shell
5 */
6
7 /* $Id: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $ */
8
9 #include "config.h" /* system and option configuration info */
10
11 #ifdef HAVE_PROTOTYPES
12 # define ARGS(args) args /* prototype declaration */
13 #else
14 # define ARGS(args) () /* K&R declaration */
15 #endif
16
17 /* Start of common headers */
18
19 #include <stdio.h>
20 #include <sys/types.h>
21 #include <setjmp.h>
22 #include <stddef.h>
23 #include <stdlib.h>
24 #include <unistd.h>
25 #include <string.h>
26
27 #ifdef HAVE_MEMORY_H
28 # include <memory.h>
29 #endif
30 #ifndef HAVE_MEMSET
31 # define memcpy(d, s, n) bcopy(s, d, n)
32 # define memcmp(s1, s2, n) bcmp(s1, s2, n)
33 void *memset ARGS((void *d, int c, size_t n));
34 #endif /* HAVE_MEMSET */
35 #ifndef HAVE_MEMMOVE
36 # ifdef HAVE_BCOPY
37 # define memmove(d, s, n) bcopy(s, d, n)
38 # else
39 void *memmove ARGS((void *d, const void *s, size_t n));
40 # endif
41 #endif /* HAVE_MEMMOVE */
42
43 #ifdef HAVE_PROTOTYPES
44 # include <stdarg.h>
45 # define SH_VA_START(va, argn) va_start(va, argn)
46 #else
47 # include <varargs.h>
48 # define SH_VA_START(va, argn) va_start(va)
49 #endif /* HAVE_PROTOTYPES */
50
51 #include <errno.h>
52
53 #ifdef HAVE_FCNTL_H
54 # include <fcntl.h>
55 #else
56 # include <sys/file.h>
57 #endif /* HAVE_FCNTL_H */
58 #ifndef O_ACCMODE
59 # define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
60 #endif /* !O_ACCMODE */
61
62 #ifndef F_OK /* access() arguments */
63 # define F_OK 0
64 # define X_OK 1
65 # define W_OK 2
66 # define R_OK 4
67 #endif /* !F_OK */
68
69 #ifndef SEEK_SET
70 # ifdef L_SET
71 # define SEEK_SET L_SET
72 # define SEEK_CUR L_INCR
73 # define SEEK_END L_XTND
74 # else /* L_SET */
75 # define SEEK_SET 0
76 # define SEEK_CUR 1
77 # define SEEK_END 2
78 # endif /* L_SET */
79 #endif /* !SEEK_SET */
80
81 /* Some machines (eg, FreeBSD 1.1.5) define CLK_TCK in limits.h
82 * (ksh_limval.h assumes limits has been included, if available)
83 */
84 #ifdef HAVE_LIMITS_H
85 # include <limits.h>
86 #endif /* HAVE_LIMITS_H */
87
88 #include <signal.h>
89 #ifdef NSIG
90 # define SIGNALS NSIG
91 #else
92 # ifdef _MINIX
93 # define SIGNALS (_NSIG+1) /* _NSIG is # of signals used, excluding 0. */
94 # else
95 # ifdef _SIGMAX /* QNX */
96 # define SIGNALS _SIGMAX
97 # else /* _SIGMAX */
98 # define SIGNALS 32
99 # endif /* _SIGMAX */
100 # endif /* _MINIX */
101 #endif /* NSIG */
102 #ifndef SIGCHLD
103 # define SIGCHLD SIGCLD
104 #endif
105 /* struct sigaction.sa_flags is set to KSH_SA_FLAGS. Used to ensure
106 * system calls are interrupted
107 */
108 #ifdef SA_INTERRUPT
109 # define KSH_SA_FLAGS SA_INTERRUPT
110 #else /* SA_INTERRUPT */
111 # define KSH_SA_FLAGS 0
112 #endif /* SA_INTERRUPT */
113
114 typedef RETSIGTYPE (*handler_t) ARGS((int)); /* signal handler */
115
116 #ifdef USE_FAKE_SIGACT
117 # include "sigact.h" /* use sjg's fake sigaction() */
118 #endif
119
120 #ifdef HAVE_PATHS_H
121 # include <paths.h>
122 #endif /* HAVE_PATHS_H */
123 #ifdef _PATH_DEFPATH
124 # define DEFAULT__PATH _PATH_DEFPATH
125 #else /* _PATH_DEFPATH */
126 # define DEFAULT__PATH DEFAULT_PATH
127 #endif /* _PATH_DEFPATH */
128
129 #ifndef offsetof
130 # define offsetof(type,id) ((size_t)&((type*)NULL)->id)
131 #endif
132
133 #ifndef HAVE_KILLPG
134 # define killpg(p, s) kill(-(p), (s))
135 #endif /* !HAVE_KILLPG */
136
137 /* Special cases for execve(2) */
138 # if defined(OS_ISC) && defined(_POSIX_SOURCE)
139 /* Kludge for ISC 3.2 (and other versions?) so programs will run correctly. */
140 # define ksh_execve(p, av, ev, flags) \
141 do { \
142 __setostype(0); \
143 execve(p, av, ev); \
144 __setostype(1); \
145 } while (0)
146 # else /* OS_ISC && _POSIX */
147 # define ksh_execve(p, av, ev, flags) execve(p, av, ev)
148 # endif /* OS_ISC && _POSIX */
149
150 /* this is a hang-over from older versions of the os2 port */
151 #define ksh_dupbase(fd, base) fcntl(fd, F_DUPFD, base)
152
153 #ifdef HAVE_SIGSETJMP
154 # define ksh_sigsetjmp(env,sm) sigsetjmp((env), (sm))
155 # define ksh_siglongjmp(env,v) siglongjmp((env), (v))
156 # define ksh_jmp_buf sigjmp_buf
157 #else /* HAVE_SIGSETJMP */
158 # ifdef HAVE__SETJMP
159 # define ksh_sigsetjmp(env,sm) _setjmp(env)
160 # define ksh_siglongjmp(env,v) _longjmp((env), (v))
161 # else /* HAVE__SETJMP */
162 # define ksh_sigsetjmp(env,sm) setjmp(env)
163 # define ksh_siglongjmp(env,v) longjmp((env), (v))
164 # endif /* HAVE__SETJMP */
165 # define ksh_jmp_buf jmp_buf
166 #endif /* HAVE_SIGSETJMP */
167
168 #ifndef HAVE_DUP2
169 extern int dup2 ARGS((int, int));
170 #endif /* !HAVE_DUP2 */
171
172 /* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
173 * by autoconf (assumes an 8 bit byte, but I'm not concerned).
174 * NOTE: INT32 may end up being more than 32 bits.
175 */
176 #if SIZEOF_INT >= 4
177 # define INT32 int
178 #else /* SIZEOF_INT */
179 # if SIZEOF_LONG >= 4
180 # define INT32 long
181 # else /* SIZEOF_LONG */
182 #error cannot find 32 bit type...
183 # endif /* SIZEOF_LONG */
184 #endif /* SIZEOF_INT */
185
186 /* end of common headers */
187
188 /* Stop gcc and lint from complaining about possibly uninitialized variables */
189 #if defined(__GNUC__) || defined(lint)
190 # define UNINITIALIZED(var) var = 0
191 #else
192 # define UNINITIALIZED(var) var
193 #endif /* GNUC || lint */
194
195 /* some useful #defines */
196 #ifdef EXTERN
197 # define I__(i) = i
198 #else
199 # define I__(i)
200 # define EXTERN extern
201 # define EXTERN_DEFINED
202 #endif
203
204 #ifndef EXECSHELL
205 /* shell to exec scripts (see also $SHELL initialization in main.c) */
206 # define EXECSHELL "/bin/sh"
207 # define EXECSHELL_STR "EXECSHELL"
208 #endif
209
210 /* ISABSPATH() means path is fully and completely specified,
211 * ISROOTEDPATH() means a .. as the first component is a no-op,
212 * ISRELPATH() means $PWD can be tacked on to get an absolute path.
213 *
214 * OS Path ISABSPATH ISROOTEDPATH ISRELPATH
215 * unix /foo yes yes no
216 * unix foo no no yes
217 * unix ../foo no no yes
218 */
219 # define PATHSEP ':'
220 # define DIRSEP '/'
221 # define DIRSEPSTR "/"
222 # define ISDIRSEP(c) ((c) == '/')
223 # define ISABSPATH(s) ISDIRSEP((s)[0])
224 # define ISRELPATH(s) (!ISABSPATH(s))
225 # define ISROOTEDPATH(s) ISABSPATH(s)
226 # define FILECHCONV(c) c
227 # define FILECMP(s1, s2) strcmp(s1, s2)
228 # define FILENCMP(s1, s2, n) strncmp(s1, s2, n)
229 # define ksh_strchr_dirsep(p) strchr(p, DIRSEP)
230 # define ksh_strrchr_dirsep(p) strrchr(p, DIRSEP)
231
232 typedef int bool_t;
233 #define FALSE 0
234 #define TRUE 1
235
236 #define NELEM(a) (sizeof(a) / sizeof((a)[0]))
237 #define sizeofN(type, n) (sizeof(type) * (n))
238 #define BIT(i) (1<<(i)) /* define bit in flag */
239
240 /* Table flag type - needs > 16 and < 32 bits */
241 typedef INT32 Tflag;
242
243 #define NUFILE 32 /* Number of user-accessible files */
244 #define FDBASE 10 /* First file usable by Shell */
245
246 /* you're not going to run setuid shell scripts, are you? */
247 #define eaccess(path, mode) access(path, mode)
248
249 /* Make MAGIC a char that might be printed to make bugs more obvious, but
250 * not a char that is used often. Also, can't use the high bit as it causes
251 * portability problems (calling strchr(x, 0x80|'x') is error prone).
252 */
253 #define MAGIC (7) /* prefix for *?[!{,} during expand */
254 #define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
255 #define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */
256
257 #define LINE 1024 /* input line size */
258 #define PATH 1024 /* pathname size (todo: PATH_MAX/pathconf()) */
259 #define ARRAYMAX 1023 /* max array index */
260
261 EXTERN const char *kshname; /* $0 */
262 EXTERN pid_t kshpid; /* $$, shell pid */
263 EXTERN pid_t procpid; /* pid of executing process */
264 EXTERN uid_t ksheuid; /* effective uid of shell */
265 EXTERN int exstat; /* exit status */
266 EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
267 EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
268
269 /*
270 * Area-based allocation built on malloc/free
271 */
272 typedef struct Area {
273 struct link *freelist; /* free list */
274 } Area;
275
276 EXTERN Area aperm; /* permanent object space */
277 #define APERM &aperm
278 #define ATEMP &e->area
279
280 #ifdef MEM_DEBUG
281 # include "chmem.h" /* a debugging front end for malloc et. al. */
282 #endif /* MEM_DEBUG */
283
284 #ifdef KSH_DEBUG
285 # define kshdebug_init() kshdebug_init_()
286 # define kshdebug_printf(a) kshdebug_printf_ a
287 # define kshdebug_dump(a) kshdebug_dump_ a
288 #else /* KSH_DEBUG */
289 # define kshdebug_init()
290 # define kshdebug_printf(a)
291 # define kshdebug_dump(a)
292 #endif /* KSH_DEBUG */
293
294 /*
295 * parsing & execution environment
296 */
297 EXTERN struct env {
298 short type; /* environment type - see below */
299 short flags; /* EF_* */
300 Area area; /* temporary allocation area */
301 struct block *loc; /* local variables and functions */
302 short *savefd; /* original redirected fd's */
303 struct env *oenv; /* link to previous environment */
304 ksh_jmp_buf jbuf; /* long jump back to env creator */
305 struct temp *temps; /* temp files */
306 } *e;
307
308 /* struct env.type values */
309 #define E_NONE 0 /* dummy environment */
310 #define E_PARSE 1 /* parsing command # */
311 #define E_FUNC 2 /* executing function # */
312 #define E_INCL 3 /* including a file via . # */
313 #define E_EXEC 4 /* executing command tree */
314 #define E_LOOP 5 /* executing for/while # */
315 #define E_ERRH 6 /* general error handler # */
316 /* # indicates env has valid jbuf (see unwind()) */
317
318 /* struct env.flag values */
319 #define EF_FUNC_PARSE BIT(0) /* function being parsed */
320 #define EF_BRKCONT_PASS BIT(1) /* set if E_LOOP must pass break/continue on */
321 #define EF_FAKE_SIGDIE BIT(2) /* hack to get info from unwind to quitenv */
322
323 /* Do breaks/continues stop at env type e? */
324 #define STOP_BRKCONT(t) ((t) == E_NONE || (t) == E_PARSE \
325 || (t) == E_FUNC || (t) == E_INCL)
326 /* Do returns stop at env type e? */
327 #define STOP_RETURN(t) ((t) == E_FUNC || (t) == E_INCL)
328
329 /* values for ksh_siglongjmp(e->jbuf, 0) */
330 #define LRETURN 1 /* return statement */
331 #define LEXIT 2 /* exit statement */
332 #define LERROR 3 /* errorf() called */
333 #define LLEAVE 4 /* untrappable exit/error */
334 #define LINTR 5 /* ^C noticed */
335 #define LBREAK 6 /* break statement */
336 #define LCONTIN 7 /* continue statement */
337 #define LSHELL 8 /* return to interactive shell() */
338 #define LAEXPR 9 /* error in arithmetic expression */
339
340 /* option processing */
341 #define OF_CMDLINE 0x01 /* command line */
342 #define OF_SET 0x02 /* set builtin */
343 #define OF_SPECIAL 0x04 /* a special variable changing */
344 #define OF_INTERNAL 0x08 /* set internally by shell */
345 #define OF_ANY (OF_CMDLINE | OF_SET | OF_SPECIAL | OF_INTERNAL)
346
347 struct option {
348 const char *name; /* long name of option */
349 char c; /* character flag (if any) */
350 short flags; /* OF_* */
351 };
352 extern const struct option goptions[];
353
354 /*
355 * flags (the order of these enums MUST match the order in misc.c(options[]))
356 */
357 enum sh_flag {
358 FEXPORT = 0, /* -a: export all */
359 #ifdef BRACE_EXPAND
360 FBRACEEXPAND, /* enable {} globbing */
361 #endif
362 FBGNICE, /* bgnice */
363 FCOMMAND, /* -c: (invocation) execute specified command */
364 #ifdef EMACS
365 FEMACS, /* emacs command editing */
366 FEMACSUSEMETA, /* use 8th bit as meta */
367 #endif
368 FERREXIT, /* -e: quit on error */
369 #ifdef EMACS
370 FGMACS, /* gmacs command editing */
371 #endif
372 FIGNOREEOF, /* eof does not exit */
373 FTALKING, /* -i: interactive */
374 FKEYWORD, /* -k: name=value anywhere */
375 FLOGIN, /* -l: a login shell */
376 FMARKDIRS, /* mark dirs with / in file name completion */
377 FMONITOR, /* -m: job control monitoring */
378 FNOCLOBBER, /* -C: don't overwrite existing files */
379 FNOEXEC, /* -n: don't execute any commands */
380 FNOGLOB, /* -f: don't do file globbing */
381 FNOHUP, /* -H: don't kill running jobs when login shell exits */
382 FNOLOG, /* don't save functions in history (ignored) */
383 #ifdef JOBS
384 FNOTIFY, /* -b: asynchronous job completion notification */
385 #endif
386 FNOUNSET, /* -u: using an unset var is an error */
387 FPHYSICAL, /* -o physical: don't do logical cd's/pwd's */
388 FPOSIX, /* -o posix: be posixly correct */
389 FPRIVILEGED, /* -p: use suid_profile */
390 FRESTRICTED, /* -r: restricted shell */
391 FSTDIN, /* -s: (invocation) parse stdin */
392 FTRACKALL, /* -h: create tracked aliases for all commands */
393 FVERBOSE, /* -v: echo input */
394 #ifdef VI
395 FVI, /* vi command editing */
396 FVIRAW, /* always read in raw mode (ignored) */
397 FVISHOW8, /* display chars with 8th bit set as is (versus M-) */
398 FVITABCOMPLETE, /* enable tab as file name completion char */
399 FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
400 #endif
401 FXTRACE, /* -x: execution trace */
402 FTALKING_I, /* (internal): initial shell was interactive */
403 FNFLAGS /* (place holder: how many flags are there) */
404 };
405
406 #define Flag(f) (shell_flags[(int) (f)])
407
408 EXTERN char shell_flags [FNFLAGS];
409
410 EXTERN char null [] I__(""); /* null value for variable */
411 EXTERN char space [] I__(" ");
412 EXTERN char newline [] I__("\n");
413 EXTERN char slash [] I__("/");
414
415 enum temp_type {
416 TT_HEREDOC_EXP, /* expanded heredoc */
417 TT_HIST_EDIT /* temp file used for history editing (fc -e) */
418 };
419 typedef enum temp_type Temp_type;
420 /* temp/heredoc files. The file is removed when the struct is freed. */
421 struct temp {
422 struct temp *next;
423 struct shf *shf;
424 int pid; /* pid of process parsed here-doc */
425 Temp_type type;
426 char *name;
427 };
428
429 /*
430 * stdio and our IO routines
431 */
432
433 #define shl_spare (&shf_iob[0]) /* for c_read()/c_print() */
434 #define shl_stdout (&shf_iob[1])
435 #define shl_out (&shf_iob[2])
436 EXTERN int shl_stdout_ok;
437
438 /*
439 * trap handlers
440 */
441 typedef struct trap {
442 int signal; /* signal number */
443 const char *name; /* short name */
444 const char *mess; /* descriptive name */
445 char *trap; /* trap command */
446 int volatile set; /* trap pending */
447 int flags; /* TF_* */
448 handler_t cursig; /* current handler (valid if TF_ORIG_* set) */
449 handler_t shtrap; /* shell signal handler */
450 } Trap;
451
452 /* values for Trap.flags */
453 #define TF_SHELL_USES BIT(0) /* shell uses signal, user can't change */
454 #define TF_USER_SET BIT(1) /* user has (tried to) set trap */
455 #define TF_ORIG_IGN BIT(2) /* original action was SIG_IGN */
456 #define TF_ORIG_DFL BIT(3) /* original action was SIG_DFL */
457 #define TF_EXEC_IGN BIT(4) /* restore SIG_IGN just before exec */
458 #define TF_EXEC_DFL BIT(5) /* restore SIG_DFL just before exec */
459 #define TF_DFL_INTR BIT(6) /* when received, default action is LINTR */
460 #define TF_TTY_INTR BIT(7) /* tty generated signal (see j_waitj) */
461 #define TF_CHANGED BIT(8) /* used by runtrap() to detect trap changes */
462 #define TF_FATAL BIT(9) /* causes termination if not trapped */
463
464 /* values for setsig()/setexecsig() flags argument */
465 #define SS_RESTORE_MASK 0x3 /* how to restore a signal before an exec() */
466 #define SS_RESTORE_CURR 0 /* leave current handler in place */
467 #define SS_RESTORE_ORIG 1 /* restore original handler */
468 #define SS_RESTORE_DFL 2 /* restore to SIG_DFL */
469 #define SS_RESTORE_IGN 3 /* restore to SIG_IGN */
470 #define SS_FORCE BIT(3) /* set signal even if original signal ignored */
471 #define SS_USER BIT(4) /* user is doing the set (ie, trap command) */
472 #define SS_SHTRAP BIT(5) /* trap for internal use (CHLD,ALRM,WINCH) */
473
474 #define SIGEXIT_ 0 /* for trap EXIT */
475 #define SIGERR_ SIGNALS /* for trap ERR */
476
477 EXTERN int volatile trap; /* traps pending? */
478 EXTERN int volatile intrsig; /* pending trap interrupts executing command */
479 EXTERN int volatile fatal_trap;/* received a fatal signal */
480 extern Trap sigtraps[SIGNALS+1];
481
482 #ifdef KSH
483 /*
484 * TMOUT support
485 */
486 /* values for ksh_tmout_state */
487 enum tmout_enum {
488 TMOUT_EXECUTING = 0, /* executing commands */
489 TMOUT_READING, /* waiting for input */
490 TMOUT_LEAVING /* have timed out */
491 };
492 EXTERN unsigned int ksh_tmout;
493 EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
494 #endif /* KSH */
495
496 /* For "You have stopped jobs" message */
497 EXTERN int really_exit;
498
499 /*
500 * fast character classes
501 */
502 #define C_ALPHA BIT(0) /* a-z_A-Z */
503 #define C_DIGIT BIT(1) /* 0-9 */
504 #define C_LEX1 BIT(2) /* \0 \t\n|&;<>() */
505 #define C_VAR1 BIT(3) /* *@#!$-? */
506 #define C_IFSWS BIT(4) /* \t \n (IFS white space) */
507 #define C_SUBOP1 BIT(5) /* "=-+?" */
508 #define C_SUBOP2 BIT(6) /* "#%" */
509 #define C_IFS BIT(7) /* $IFS */
510 #define C_QUOTE BIT(8) /* \n\t"#$&'()*;<>?[\`| (needing quoting) */
511
512 extern short ctypes [];
513
514 #define ctype(c, t) !!(ctypes[(unsigned char)(c)]&(t))
515 #define letter(c) ctype(c, C_ALPHA)
516 #define digit(c) ctype(c, C_DIGIT)
517 #define letnum(c) ctype(c, C_ALPHA|C_DIGIT)
518
519 EXTERN int ifs0 I__(' '); /* for "$*" */
520
521 /* Argument parsing for built-in commands and getopts command */
522
523 /* Values for Getopt.flags */
524 #define GF_ERROR BIT(0) /* call errorf() if there is an error */
525 #define GF_PLUSOPT BIT(1) /* allow +c as an option */
526 #define GF_NONAME BIT(2) /* don't print argv[0] in errors */
527
528 /* Values for Getopt.info */
529 #define GI_MINUS BIT(0) /* an option started with -... */
530 #define GI_PLUS BIT(1) /* an option started with +... */
531 #define GI_MINUSMINUS BIT(2) /* arguments were ended with -- */
532
533 typedef struct {
534 int optind;
535 int uoptind;/* what user sees in $OPTIND */
536 char *optarg;
537 int flags; /* see GF_* */
538 int info; /* see GI_* */
539 unsigned int p; /* 0 or index into argv[optind - 1] */
540 char buf[2]; /* for bad option OPTARG value */
541 } Getopt;
542
543 EXTERN Getopt builtin_opt; /* for shell builtin commands */
544 EXTERN Getopt user_opt; /* parsing state for getopts builtin command */
545
546 #ifdef KSH
547 /* This for co-processes */
548
549 typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
550 struct coproc {
551 int read; /* pipe from co-process's stdout */
552 int readw; /* other side of read (saved temporarily) */
553 int write; /* pipe to co-process's stdin */
554 Coproc_id id; /* id of current output pipe */
555 int njobs; /* number of live jobs using output pipe */
556 void *job; /* 0 or job of co-process using input pipe */
557 };
558 EXTERN struct coproc coproc;
559 #endif /* KSH */
560
561 /* Used in jobs.c and by coprocess stuff in exec.c */
562 #ifdef JOB_SIGS
563 EXTERN sigset_t sm_default, sm_sigchld;
564 #endif /* JOB_SIGS */
565
566 extern char ksh_version[];
567
568 /* name of called builtin function (used by error functions) */
569 EXTERN char *builtin_argv0;
570 EXTERN Tflag builtin_flag; /* flags of called builtin (SPEC_BI, etc.) */
571
572 /* current working directory, and size of memory allocated for same */
573 EXTERN char *current_wd;
574 EXTERN int current_wd_size;
575
576 #ifdef EDIT
577 /* Minimum required space to work with on a line - if the prompt leaves less
578 * space than this on a line, the prompt is truncated.
579 */
580 # define MIN_EDIT_SPACE 7
581 /* Minimum allowed value for x_cols: 2 for prompt, 3 for " < " at end of line
582 */
583 # define MIN_COLS (2 + MIN_EDIT_SPACE + 3)
584 EXTERN int x_cols I__(80); /* tty columns */
585 #else
586 # define x_cols 80 /* for pr_menu(exec.c) */
587 #endif
588
589 /* These to avoid bracket matching problems */
590 #define OPAREN '('
591 #define CPAREN ')'
592 #define OBRACK '['
593 #define CBRACK ']'
594 #define OBRACE '{'
595 #define CBRACE '}'
596
597 /* Determine the location of the system (common) profile */
598 #ifndef KSH_SYSTEM_PROFILE
599 # ifdef __NeXT
600 # define KSH_SYSTEM_PROFILE "/etc/profile.std"
601 # else /* __NeXT */
602 # define KSH_SYSTEM_PROFILE "/etc/profile"
603 # endif /* __NeXT */
604 #endif /* KSH_SYSTEM_PROFILE */
605
606 /* Used by v_evaluate() and setstr() to control action when error occurs */
607 #define KSH_UNWIND_ERROR 0 /* unwind the stack (longjmp) */
608 #define KSH_RETURN_ERROR 1 /* return 1/0 for success/failure */
609
610 #include "shf.h"
611 #include "table.h"
612 #include "tree.h"
613 #include "expand.h"
614 #include "lex.h"
615 #include "proto.h"
616
617 /* be sure not to interfere with anyone else's idea about EXTERN */
618 #ifdef EXTERN_DEFINED
619 # undef EXTERN_DEFINED
620 # undef EXTERN
621 #endif
622 #undef I__
623