xref: /illumos-gate/usr/src/cmd/sh/defs.c (revision 069e6b7e31ba5dcbc5441b98af272714d9a5455c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 /*
31  *	UNIX shell
32  */
33 
34 #include 		<setjmp.h>
35 #include		"mode.h"
36 #include		"name.h"
37 #include		<sys/param.h>
38 #ifndef NOFILE
39 #define	NOFILE 20
40 #endif
41 /* temp files and io */
42 
43 int				output = 2;
44 int				ioset;
45 struct ionod	*iotemp;	/* files to be deleted sometime */
46 struct ionod	*fiotemp;	/* function files to be deleted sometime */
47 struct ionod	*iopend;	/* documents waiting to be read at NL */
48 struct fdsave	fdmap[NOFILE];
49 
50 /* substitution */
51 int				dolc;
52 unsigned char			**dolv;
53 struct dolnod	*argfor;
54 struct argnod	*gchain;
55 
56 
57 /* name tree and words */
58 int				wdval;
59 int				wdnum;
60 int				fndef;
61 int				nohash;
62 struct argnod	*wdarg;
63 int				wdset;
64 BOOL			reserv;
65 
66 /* special names */
67 unsigned char			*pcsadr;
68 unsigned char			*pidadr;
69 unsigned char			*cmdadr;
70 
71 /* transput */
72 int 			tmpout_offset;
73 unsigned int 		serial;
74 unsigned 		peekc;
75 unsigned		peekn;
76 unsigned char 			*comdiv;
77 long			flags;
78 int				rwait;	/* flags read waiting */
79 
80 /* error exits from various parts of shell */
81 jmp_buf			subshell;
82 jmp_buf			errshell;
83 
84 /* fault handling */
85 BOOL			trapnote;
86 
87 /* execflgs */
88 int				exitval;
89 int				retval;
90 BOOL			execbrk;
91 int				loopcnt;
92 int				breakcnt;
93 int 			funcnt;
94 int				eflag;
95 /*
96  * The following flag is set if you try to exit with stopped jobs.
97  * On the second try the exit will succeed.
98  */
99 int			tried_to_exit;
100 /*
101  * The following flag is set to true if /usr/ucb is found in the path
102  * before /usr/bin. This value is checked when executing the echo and test
103  * built-in commands. If true, the command behaves as in BSD systems.
104  */
105 int				ucb_builtins;
106 
107 /* The following stuff is from stak.h	*/
108 
109 unsigned char 			*stakbas;
110 unsigned char			*staktop;
111 unsigned char			*stakbot = 0;
112 struct blk			*stakbsy;
113 unsigned char 			*brkend;
114