xref: /titanic_52/usr/src/cmd/sh/defs.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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 (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 /*
32  *	UNIX shell
33  */
34 
35 #include 		<setjmp.h>
36 #include		"mode.h"
37 #include		"name.h"
38 #include		<sys/param.h>
39 #ifndef NOFILE
40 #define	NOFILE 20
41 #endif
42 /* temp files and io */
43 
44 int				output = 2;
45 int				ioset;
46 struct ionod	*iotemp;	/* files to be deleted sometime */
47 struct ionod	*fiotemp;	/* function files to be deleted sometime */
48 struct ionod	*iopend;	/* documents waiting to be read at NL */
49 struct fdsave	fdmap[NOFILE];
50 
51 /* substitution */
52 int				dolc;
53 unsigned char			**dolv;
54 struct dolnod	*argfor;
55 struct argnod	*gchain;
56 
57 
58 /* name tree and words */
59 int				wdval;
60 int				wdnum;
61 int				fndef;
62 int				nohash;
63 struct argnod	*wdarg;
64 int				wdset;
65 BOOL			reserv;
66 
67 /* special names */
68 unsigned char			*pcsadr;
69 unsigned char			*pidadr;
70 unsigned char			*cmdadr;
71 
72 /* transput */
73 unsigned char 			*tmpname;
74 int 			serial;
75 unsigned 		peekc;
76 unsigned		peekn;
77 unsigned char 			*comdiv;
78 long			flags;
79 int				rwait;	/* flags read waiting */
80 
81 /* error exits from various parts of shell */
82 jmp_buf			subshell;
83 jmp_buf			errshell;
84 
85 /* fault handling */
86 BOOL			trapnote;
87 
88 /* execflgs */
89 int				exitval;
90 int				retval;
91 BOOL			execbrk;
92 int				loopcnt;
93 int				breakcnt;
94 int 			funcnt;
95 int				eflag;
96 /*
97  * The following flag is set if you try to exit with stopped jobs.
98  * On the second try the exit will succeed.
99  */
100 int			tried_to_exit;
101 /*
102  * The following flag is set to true if /usr/ucb is found in the path
103  * before /usr/bin. This value is checked when executing the echo and test
104  * built-in commands. If true, the command behaves as in BSD systems.
105  */
106 int				ucb_builtins;
107 
108 /* The following stuff is from stak.h	*/
109 
110 unsigned char 			*stakbas;
111 unsigned char			*staktop;
112 unsigned char			*stakbot = 0;
113 struct blk			*stakbsy;
114 unsigned char 			*brkend;
115