fix bug that can cause recursive .forward files to fail
[unix-history] / usr / src / bin / sh / options.h
CommitLineData
6aa8bb77 1/*-
d1b73048
KB
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
6aa8bb77
KB
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * %sccs.include.redist.c%
9 *
d1b73048 10 * @(#)options.h 8.1 (Berkeley) %G%
6aa8bb77
KB
11 */
12
13struct shparam {
14 int nparam; /* number of positional parameters (without $0) */
15 char malloc; /* true if parameter list dynamicly allocated */
16 char **p; /* parameter list */
17 char **optnext; /* next parameter to be processed by getopts */
18 char *optptr; /* used by getopts */
19};
20
21
22
838b4aae
MT
23#define eflag optlist[0].val
24#define fflag optlist[1].val
25#define Iflag optlist[2].val
26#define iflag optlist[3].val
27#define mflag optlist[4].val
28#define nflag optlist[5].val
29#define sflag optlist[6].val
30#define xflag optlist[7].val
31#define vflag optlist[8].val
32#define Vflag optlist[9].val
33#define Eflag optlist[10].val
34#define Cflag optlist[11].val
35#define aflag optlist[12].val
36#define bflag optlist[13].val
37#define uflag optlist[14].val
6aa8bb77 38
838b4aae
MT
39#define NOPTS 15
40
41struct optent {
42 const char *name;
43 const char letter;
44 char val;
45};
6aa8bb77
KB
46
47#ifdef DEFINE_OPTIONS
838b4aae
MT
48struct optent optlist[NOPTS] = {
49 "errexit", 'e', 0,
50 "noglob", 'f', 0,
51 "ignoreeof", 'I', 0,
52 "interactive", 'i', 0,
53 "monitor", 'm', 0,
54 "noexec", 'n', 0,
55 "stdin", 's', 0,
56 "xtrace", 'x', 0,
57 "verbose", 'v', 0,
58 "vi", 'V', 0,
59 "emacs", 'E', 0,
60 "noclobber", 'C', 0,
61 "allexport", 'a', 0,
62 "notify", 'b', 0,
63 "nounset", 'u', 0,
64};
6aa8bb77 65#else
838b4aae 66extern struct optent optlist[NOPTS];
6aa8bb77
KB
67#endif
68
69
70extern char *minusc; /* argument to -c option */
71extern char *arg0; /* $0 */
72extern struct shparam shellparam; /* $@ */
73extern char **argptr; /* argument list for builtin commands */
74extern char *optarg; /* set by nextopt */
75extern char *optptr; /* used by nextopt */
76
77
78#ifdef __STDC__
79void procargs(int, char **);
80void setparam(char **);
81void freeparam(struct shparam *);
82int nextopt(char *);
83#else
84void procargs();
85void setparam();
86void freeparam();
87int nextopt();
88#endif