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) 03/07/91 11 */ 12 13 struct 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 37 const char optchar[NOPTS+1] = "efIijnsxzv"; /* shell flags */ 38 char optval[NOPTS+1]; /* values of option flags */ 39 #else 40 extern const char optchar[NOPTS+1]; 41 extern char optval[NOPTS+1]; 42 #endif 43 44 45 extern char *minusc; /* argument to -c option */ 46 extern char *arg0; /* $0 */ 47 extern struct shparam shellparam; /* $@ */ 48 extern char **argptr; /* argument list for builtin commands */ 49 extern char *optarg; /* set by nextopt */ 50 extern char *optptr; /* used by nextopt */ 51 52 53 #ifdef __STDC__ 54 void procargs(int, char **); 55 void setparam(char **); 56 void freeparam(struct shparam *); 57 int nextopt(char *); 58 #else 59 void procargs(); 60 void setparam(); 61 void freeparam(); 62 int nextopt(); 63 #endif 64