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