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