date and time created 91/03/07 20:28:03 by bostic
[unix-history] / usr / src / bin / sh / options.h
CommitLineData
6aa8bb77
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * %sccs.include.redist.c%
9 *
10 * @(#)options.h 5.1 (Berkeley) %G%
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
23#define eflag optval[0]
24#define fflag optval[1]
25#define Iflag optval[2]
26#define iflag optval[3]
27#define jflag optval[4]
28#define nflag optval[5]
29#define sflag optval[6]
30#define xflag optval[7]
31#define zflag optval[8]
32#define vflag optval[9]
33
34#define NOPTS 10
35
36#ifdef DEFINE_OPTIONS
37const char optchar[NOPTS+1] = "efIijnsxzv"; /* shell flags */
38char optval[NOPTS+1]; /* values of option flags */
39#else
40extern const char optchar[NOPTS+1];
41extern char optval[NOPTS+1];
42#endif
43
44
45extern char *minusc; /* argument to -c option */
46extern char *arg0; /* $0 */
47extern struct shparam shellparam; /* $@ */
48extern char **argptr; /* argument list for builtin commands */
49extern char *optarg; /* set by nextopt */
50extern char *optptr; /* used by nextopt */
51
52
53#ifdef __STDC__
54void procargs(int, char **);
55void setparam(char **);
56void freeparam(struct shparam *);
57int nextopt(char *);
58#else
59void procargs();
60void setparam();
61void freeparam();
62int nextopt();
63#endif