4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
36 static void free_arg(struct argnod
*);
37 static void freeio(struct ionod
*);
38 static void freereg(struct regnod
*);
39 static void prarg(struct argnod
*argp
);
40 static void prio(struct ionod
*iop
);
43 freefunc(struct namnod
*n
)
45 freetree((struct trenod
*)(n
->namenv
));
49 freetree(struct trenod
*t
)
55 type
= t
->tretyp
& COMMSK
;
60 struct fndnod
*f
= fndptr(t
);
72 freeio(comptr(t
)->comio
);
73 free_arg(comptr(t
)->comarg
);
74 free_arg(comptr(t
)->comset
);
78 freeio(forkptr(t
)->forkio
);
79 freetree(forkptr(t
)->forktre
);
83 freetree(parptr(t
)->partre
);
90 freetree(lstptr(t
)->lstlef
);
91 freetree(lstptr(t
)->lstrit
);
96 struct fornod
*f
= (struct fornod
*)t
;
102 freeio(f
->forlst
->comio
);
103 free_arg(f
->forlst
->comarg
);
104 free_arg(f
->forlst
->comset
);
112 freetree(whptr(t
)->whtre
);
113 freetree(whptr(t
)->dotre
);
117 freetree(ifptr(t
)->iftre
);
118 freetree(ifptr(t
)->thtre
);
119 freetree(ifptr(t
)->eltre
);
123 free(swptr(t
)->swarg
);
124 freereg(swptr(t
)->swlst
);
132 free_arg(struct argnod
*argp
)
145 freeio(struct ionod
*iop
)
151 if (iop
->iofile
& IODOC
)
163 fiotemp
= iop
->iolst
;
166 struct ionod
*fiop
= fiotemp
;
168 while (fiop
->iolst
!= iop
)
171 fiop
->iolst
= iop
->iolst
;
183 freereg(struct regnod
*regp
)
189 free_arg(regp
->regptr
);
190 freetree(regp
->regcom
);
221 prcmd(struct trenod
*t
)
229 prf(struct trenod
*t
)
237 type
= t
->tretyp
& COMMSK
;
243 struct fndnod
*f
= (struct fndnod
*)t
;
255 if (comptr(t
)->comset
) {
256 prarg(comptr(t
)->comset
);
259 prarg(comptr(t
)->comarg
);
260 prio(comptr(t
)->comio
);
264 prf(forkptr(t
)->forktre
);
265 prio(forkptr(t
)->forkio
);
266 if (forkptr(t
)->forktyp
& FAMP
)
272 prf(parptr(t
)->partre
);
277 prf(lstptr(t
)->lstlef
);
279 prf(lstptr(t
)->lstrit
);
283 prf(lstptr(t
)->lstlef
);
285 prf(lstptr(t
)->lstrit
);
289 prf(lstptr(t
)->lstlef
);
291 prf(lstptr(t
)->lstrit
);
295 prf(lstptr(t
)->lstlef
);
297 prf(lstptr(t
)->lstrit
);
303 struct fornod
*f
= (struct fornod
*)t
;
310 arg
= f
->forlst
->comarg
;
313 while(arg
!= ENDARGS
)
316 prs_buff(arg
->argval
);
336 prf(whptr(t
)->whtre
);
340 prf(whptr(t
)->dotre
);
347 struct ifnod
*f
= (struct ifnod
*)t
;
374 prs_buff(swptr(t
)->swarg
);
376 swl
= swptr(t
)->swlst
;
379 struct argnod
*arg
= swl
->regptr
;
383 prs_buff(arg
->argval
);
390 prs_buff(arg
->argval
);
408 prarg(struct argnod
*argp
)
412 prs_buff(argp
->argval
);
420 prio(struct ionod
*iop
)
428 ion
= (unsigned char *) iop
->ioname
;
434 prn_buff(iof
& IOUFD
);
438 else if (iof
& IOMOV
)
446 else if ((iof
& IOPUT
) == 0)
448 else if (iof
& IOAPP
)