2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: argnod.h /main/3 1995/11/01 16:38:43 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
29 * AT&T BELL LABORATORIES *
30 * AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
31 * ACCORDANCE WITH APPLICABLE AGREEMENTS *
33 * Copyright (c) 1995 AT&T Corp. *
34 * Unpublished & Not for Publication *
35 * All Rights Reserved *
37 * The copyright notice above does not evidence any *
38 * actual or intended publication of such source code *
40 * This software was created by the *
41 * Advanced Software Technology Department *
42 * AT&T Bell Laboratories *
44 * For further information contact *
45 * {research,attmail}!dgk *
47 ***************************************************************/
49 /* : : generated by proto : : */
52 #if !defined(__PROTO__)
53 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
54 #if defined(__cplusplus)
55 #define __MANGLE__ "C"
60 #define __PROTO__(x) x
62 #define __PARAM__(n,o) n
63 #if !defined(__STDC__) && !defined(__cplusplus)
64 #if !defined(c_plusplus)
75 #define __PROTO__(x) ()
76 #define __OTORP__(x) x
77 #define __PARAM__(n,o) o
85 #if defined(__cplusplus) || defined(c_plusplus)
86 #define __VARARG__ ...
90 #if defined(__STDARG__)
91 #define __VA_START__(p,a) va_start(p,a)
93 #define __VA_START__(p,a) va_start(p)
98 * struct to hold a word argument
99 * Written by David Korn
120 struct argnod *comarg;
121 struct argnod *comset;
127 #define COMMSK ((1<<COMBITS)-1)
128 #define COMSCAN (01<<COMBITS)
130 struct slnod /* struct for link list of stacks */
132 struct slnod *slnext;
133 struct slnod *slchild;
138 * This struct is use to hold $* lists and arrays
143 short dolrefcnt; /* reference count */
144 short dolmax; /* size of dolval array */
145 short dolnum; /* number of elements */
146 short dolbot; /* current first element */
147 struct dolnod *dolnxt; /* used when list are chained */
148 char *dolval[1]; /* array of value pointers */
152 * This struct is used to hold word arguments of variable size during
153 * parsing and during expansion. The flags indicate what processing
154 * is required on the argument.
169 unsigned char argflag;
175 /* The following should evaluate to the offset of argval in argnod */
176 extern __MANGLE__ int errno; /* could be any l-value */
177 #define ARGVAL ((unsigned)(((struct argnod*)(&errno))->argval-(char*)(&errno)))
178 #define sh_argstr(ap) ((ap)->argflag&ARG_RAW?sh_fmtq((ap)->argval):(ap)->argval)
183 #endif /* SHOPT_VPIX */
186 /* legal argument flags */
187 #define ARG_RAW 0x1 /* string needs no processing */
188 #define ARG_MAKE 0x2 /* bit set during argument expansion */
189 #define ARG_MAC 0x4 /* string needs macro expansion */
190 #define ARG_EXP 0x8 /* string needs file expansion */
191 #define ARG_ASSIGN 0x10 /* argument is an assignment */
192 #define ARG_QUOTED 0x20 /* word contained quote characters */
193 #define ARG_MESSAGE 0x40 /* contains international string */
194 #define ARG_APPEND 0x80 /* for += assignment */
196 extern __MANGLE__ char **sh_argbuild __PROTO__((int*,const struct comnod*));
197 extern __MANGLE__ struct dolnod *sh_argcreate __PROTO__((char*[]));
198 extern __MANGLE__ char *sh_argdolminus __PROTO__((void));
199 extern __MANGLE__ struct dolnod *sh_argfree __PROTO__((struct dolnod*,int));
200 extern __MANGLE__ struct dolnod *sh_argnew __PROTO__((char*[],struct dolnod**));
201 extern __MANGLE__ int sh_argopts __PROTO__((int,char*[]));
202 extern __MANGLE__ void sh_argreset __PROTO__((struct dolnod*,struct dolnod*));
203 extern __MANGLE__ void sh_argset __PROTO__((char*[]));
204 extern __MANGLE__ struct dolnod *sh_arguse __PROTO__((void));
206 extern __MANGLE__ const char e_heading[];
207 extern __MANGLE__ const char e_off[];
208 extern __MANGLE__ const char e_on[];
209 extern __MANGLE__ const char e_sptbnl[];
210 extern __MANGLE__ const char e_subst[];
211 extern __MANGLE__ const char e_option[];
212 extern __MANGLE__ const char e_argexp[];
213 extern __MANGLE__ const char e_exec[];
214 extern __MANGLE__ const char e_devfdNN[];