xref: /onnv-gate/usr/src/cmd/sh/func.c (revision 0)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*0Sstevel@tonic-gate 
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate  * Copyright (c) 1996, by Sun Microsystems, Inc.
28*0Sstevel@tonic-gate  * All rights reserved.
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.4.1.3	*/
32*0Sstevel@tonic-gate /*
33*0Sstevel@tonic-gate  * UNIX shell
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include	"defs.h"
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate freefunc(n)
39*0Sstevel@tonic-gate 	struct namnod 	*n;
40*0Sstevel@tonic-gate {
41*0Sstevel@tonic-gate 	freetree((struct trenod *)(n->namenv));
42*0Sstevel@tonic-gate }
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate freetree(t)
46*0Sstevel@tonic-gate 	register struct trenod *t;
47*0Sstevel@tonic-gate {
48*0Sstevel@tonic-gate 	if (t)
49*0Sstevel@tonic-gate 	{
50*0Sstevel@tonic-gate 		register int type;
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate 		if (t->tretyp & CNTMSK)
53*0Sstevel@tonic-gate 		{
54*0Sstevel@tonic-gate 			t->tretyp--;
55*0Sstevel@tonic-gate 			return;
56*0Sstevel@tonic-gate 		}
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate 		type = t->tretyp & COMMSK;
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate 		switch (type)
61*0Sstevel@tonic-gate 		{
62*0Sstevel@tonic-gate 			case TFND:
63*0Sstevel@tonic-gate 				free(fndptr(t)->fndnam);
64*0Sstevel@tonic-gate 				freetree(fndptr(t)->fndval);
65*0Sstevel@tonic-gate 				break;
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate 			case TCOM:
68*0Sstevel@tonic-gate 				freeio(comptr(t)->comio);
69*0Sstevel@tonic-gate 				free_arg(comptr(t)->comarg);
70*0Sstevel@tonic-gate 				free_arg(comptr(t)->comset);
71*0Sstevel@tonic-gate 				break;
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate 			case TFORK:
74*0Sstevel@tonic-gate 				freeio(forkptr(t)->forkio);
75*0Sstevel@tonic-gate 				freetree(forkptr(t)->forktre);
76*0Sstevel@tonic-gate 				break;
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate 			case TPAR:
79*0Sstevel@tonic-gate 				freetree(parptr(t)->partre);
80*0Sstevel@tonic-gate 				break;
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate 			case TFIL:
83*0Sstevel@tonic-gate 			case TLST:
84*0Sstevel@tonic-gate 			case TAND:
85*0Sstevel@tonic-gate 			case TORF:
86*0Sstevel@tonic-gate 				freetree(lstptr(t)->lstlef);
87*0Sstevel@tonic-gate 				freetree(lstptr(t)->lstrit);
88*0Sstevel@tonic-gate 				break;
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate 			case TFOR:
91*0Sstevel@tonic-gate 			{
92*0Sstevel@tonic-gate 				struct fornod *f = (struct fornod *)t;
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate 				free(f->fornam);
95*0Sstevel@tonic-gate 				freetree(f->fortre);
96*0Sstevel@tonic-gate 				if (f->forlst)
97*0Sstevel@tonic-gate 				{
98*0Sstevel@tonic-gate 					freeio(f->forlst->comio);
99*0Sstevel@tonic-gate 					free_arg(f->forlst->comarg);
100*0Sstevel@tonic-gate 					free_arg(f->forlst->comset);
101*0Sstevel@tonic-gate 					free(f->forlst);
102*0Sstevel@tonic-gate 				}
103*0Sstevel@tonic-gate 			}
104*0Sstevel@tonic-gate 			break;
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate 			case TWH:
107*0Sstevel@tonic-gate 			case TUN:
108*0Sstevel@tonic-gate 				freetree(whptr(t)->whtre);
109*0Sstevel@tonic-gate 				freetree(whptr(t)->dotre);
110*0Sstevel@tonic-gate 				break;
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate 			case TIF:
113*0Sstevel@tonic-gate 				freetree(ifptr(t)->iftre);
114*0Sstevel@tonic-gate 				freetree(ifptr(t)->thtre);
115*0Sstevel@tonic-gate 				freetree(ifptr(t)->eltre);
116*0Sstevel@tonic-gate 				break;
117*0Sstevel@tonic-gate 
118*0Sstevel@tonic-gate 			case TSW:
119*0Sstevel@tonic-gate 				free(swptr(t)->swarg);
120*0Sstevel@tonic-gate 				freereg(swptr(t)->swlst);
121*0Sstevel@tonic-gate 				break;
122*0Sstevel@tonic-gate 		}
123*0Sstevel@tonic-gate 		free(t);
124*0Sstevel@tonic-gate 	}
125*0Sstevel@tonic-gate }
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate free_arg(argp)
128*0Sstevel@tonic-gate 	register struct argnod 	*argp;
129*0Sstevel@tonic-gate {
130*0Sstevel@tonic-gate 	register struct argnod 	*sav;
131*0Sstevel@tonic-gate 
132*0Sstevel@tonic-gate 	while (argp)
133*0Sstevel@tonic-gate 	{
134*0Sstevel@tonic-gate 		sav = argp->argnxt;
135*0Sstevel@tonic-gate 		free(argp);
136*0Sstevel@tonic-gate 		argp = sav;
137*0Sstevel@tonic-gate 	}
138*0Sstevel@tonic-gate }
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate freeio(iop)
142*0Sstevel@tonic-gate 	register struct ionod *iop;
143*0Sstevel@tonic-gate {
144*0Sstevel@tonic-gate 	register struct ionod *sav;
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate 	while (iop)
147*0Sstevel@tonic-gate 	{
148*0Sstevel@tonic-gate 		if (iop->iofile & IODOC)
149*0Sstevel@tonic-gate 		{
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate #ifdef DEBUG
152*0Sstevel@tonic-gate 			prs("unlinking ");
153*0Sstevel@tonic-gate 			prs(iop->ioname);
154*0Sstevel@tonic-gate 			newline();
155*0Sstevel@tonic-gate #endif
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate 			unlink(iop->ioname);
158*0Sstevel@tonic-gate 
159*0Sstevel@tonic-gate 			if (fiotemp == iop)
160*0Sstevel@tonic-gate 				fiotemp = iop->iolst;
161*0Sstevel@tonic-gate 			else
162*0Sstevel@tonic-gate 			{
163*0Sstevel@tonic-gate 				struct ionod *fiop = fiotemp;
164*0Sstevel@tonic-gate 
165*0Sstevel@tonic-gate 				while (fiop->iolst != iop)
166*0Sstevel@tonic-gate 					fiop = fiop->iolst;
167*0Sstevel@tonic-gate 
168*0Sstevel@tonic-gate 				fiop->iolst = iop->iolst;
169*0Sstevel@tonic-gate 			}
170*0Sstevel@tonic-gate 		}
171*0Sstevel@tonic-gate 		free(iop->ioname);
172*0Sstevel@tonic-gate 		free(iop->iolink);
173*0Sstevel@tonic-gate 		sav = iop->ionxt;
174*0Sstevel@tonic-gate 		free(iop);
175*0Sstevel@tonic-gate 		iop = sav;
176*0Sstevel@tonic-gate 	}
177*0Sstevel@tonic-gate }
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate freereg(regp)
181*0Sstevel@tonic-gate 	register struct regnod 	*regp;
182*0Sstevel@tonic-gate {
183*0Sstevel@tonic-gate 	register struct regnod 	*sav;
184*0Sstevel@tonic-gate 
185*0Sstevel@tonic-gate 	while (regp)
186*0Sstevel@tonic-gate 	{
187*0Sstevel@tonic-gate 		free_arg(regp->regptr);
188*0Sstevel@tonic-gate 		freetree(regp->regcom);
189*0Sstevel@tonic-gate 		sav = regp->regnxt;
190*0Sstevel@tonic-gate 		free(regp);
191*0Sstevel@tonic-gate 		regp = sav;
192*0Sstevel@tonic-gate 	}
193*0Sstevel@tonic-gate }
194*0Sstevel@tonic-gate 
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate static nonl = 0;
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate prbgnlst()
199*0Sstevel@tonic-gate {
200*0Sstevel@tonic-gate 	if (nonl)
201*0Sstevel@tonic-gate 		prc_buff(SPACE);
202*0Sstevel@tonic-gate 	else
203*0Sstevel@tonic-gate 		prc_buff(NL);
204*0Sstevel@tonic-gate }
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate prendlst()
207*0Sstevel@tonic-gate {
208*0Sstevel@tonic-gate 	if (nonl) {
209*0Sstevel@tonic-gate 		prc_buff(';');
210*0Sstevel@tonic-gate 		prc_buff(SPACE);
211*0Sstevel@tonic-gate 	}
212*0Sstevel@tonic-gate 	else
213*0Sstevel@tonic-gate 		prc_buff(NL);
214*0Sstevel@tonic-gate }
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate prcmd(t)
217*0Sstevel@tonic-gate {
218*0Sstevel@tonic-gate 	nonl++;
219*0Sstevel@tonic-gate 	prf(t);
220*0Sstevel@tonic-gate 	nonl = 0;
221*0Sstevel@tonic-gate }
222*0Sstevel@tonic-gate 
223*0Sstevel@tonic-gate prf(t)
224*0Sstevel@tonic-gate 	register struct trenod	*t;
225*0Sstevel@tonic-gate {
226*0Sstevel@tonic-gate 	sigchk();
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate 	if (t)
229*0Sstevel@tonic-gate 	{
230*0Sstevel@tonic-gate 		register int	type;
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate 		type = t->tretyp & COMMSK;
233*0Sstevel@tonic-gate 
234*0Sstevel@tonic-gate 		switch(type)
235*0Sstevel@tonic-gate 		{
236*0Sstevel@tonic-gate 			case TFND:
237*0Sstevel@tonic-gate 			{
238*0Sstevel@tonic-gate 				register struct fndnod *f = (struct fndnod *)t;
239*0Sstevel@tonic-gate 
240*0Sstevel@tonic-gate 				prs_buff(f->fndnam);
241*0Sstevel@tonic-gate 				prs_buff("(){");
242*0Sstevel@tonic-gate 				prbgnlst();
243*0Sstevel@tonic-gate 				prf(f->fndval);
244*0Sstevel@tonic-gate 				prbgnlst();
245*0Sstevel@tonic-gate 				prs_buff("}");
246*0Sstevel@tonic-gate 				break;
247*0Sstevel@tonic-gate 			}
248*0Sstevel@tonic-gate 
249*0Sstevel@tonic-gate 			case TCOM:
250*0Sstevel@tonic-gate 				if (comptr(t)->comset) {
251*0Sstevel@tonic-gate 					prarg(comptr(t)->comset);
252*0Sstevel@tonic-gate 					prc_buff(SPACE);
253*0Sstevel@tonic-gate 				}
254*0Sstevel@tonic-gate 				prarg(comptr(t)->comarg);
255*0Sstevel@tonic-gate 				prio(comptr(t)->comio);
256*0Sstevel@tonic-gate 				break;
257*0Sstevel@tonic-gate 
258*0Sstevel@tonic-gate 			case TFORK:
259*0Sstevel@tonic-gate 				prf(forkptr(t)->forktre);
260*0Sstevel@tonic-gate 				prio(forkptr(t)->forkio);
261*0Sstevel@tonic-gate 				if (forkptr(t)->forktyp & FAMP)
262*0Sstevel@tonic-gate 					prs_buff(" &");
263*0Sstevel@tonic-gate 				break;
264*0Sstevel@tonic-gate 
265*0Sstevel@tonic-gate 			case TPAR:
266*0Sstevel@tonic-gate 				prs_buff("(");
267*0Sstevel@tonic-gate 				prf(parptr(t)->partre);
268*0Sstevel@tonic-gate 				prs_buff(")");
269*0Sstevel@tonic-gate 				break;
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate 			case TFIL:
272*0Sstevel@tonic-gate 				prf(lstptr(t)->lstlef);
273*0Sstevel@tonic-gate 				prs_buff(" | ");
274*0Sstevel@tonic-gate 				prf(lstptr(t)->lstrit);
275*0Sstevel@tonic-gate 				break;
276*0Sstevel@tonic-gate 
277*0Sstevel@tonic-gate 			case TLST:
278*0Sstevel@tonic-gate 				prf(lstptr(t)->lstlef);
279*0Sstevel@tonic-gate 				prendlst();
280*0Sstevel@tonic-gate 				prf(lstptr(t)->lstrit);
281*0Sstevel@tonic-gate 				break;
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate 			case TAND:
284*0Sstevel@tonic-gate 				prf(lstptr(t)->lstlef);
285*0Sstevel@tonic-gate 				prs_buff(" && ");
286*0Sstevel@tonic-gate 				prf(lstptr(t)->lstrit);
287*0Sstevel@tonic-gate 				break;
288*0Sstevel@tonic-gate 
289*0Sstevel@tonic-gate 			case TORF:
290*0Sstevel@tonic-gate 				prf(lstptr(t)->lstlef);
291*0Sstevel@tonic-gate 				prs_buff(" || ");
292*0Sstevel@tonic-gate 				prf(lstptr(t)->lstrit);
293*0Sstevel@tonic-gate 				break;
294*0Sstevel@tonic-gate 
295*0Sstevel@tonic-gate 			case TFOR:
296*0Sstevel@tonic-gate 				{
297*0Sstevel@tonic-gate 					register struct argnod	*arg;
298*0Sstevel@tonic-gate 					register struct fornod 	*f = (struct fornod *)t;
299*0Sstevel@tonic-gate 
300*0Sstevel@tonic-gate 					prs_buff("for ");
301*0Sstevel@tonic-gate 					prs_buff(f->fornam);
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate 					if (f->forlst)
304*0Sstevel@tonic-gate 					{
305*0Sstevel@tonic-gate 						arg = f->forlst->comarg;
306*0Sstevel@tonic-gate 						prs_buff(" in");
307*0Sstevel@tonic-gate 
308*0Sstevel@tonic-gate 						while(arg != ENDARGS)
309*0Sstevel@tonic-gate 						{
310*0Sstevel@tonic-gate 							prc_buff(SPACE);
311*0Sstevel@tonic-gate 							prs_buff(arg->argval);
312*0Sstevel@tonic-gate 							arg = arg->argnxt;
313*0Sstevel@tonic-gate 						}
314*0Sstevel@tonic-gate 					}
315*0Sstevel@tonic-gate 
316*0Sstevel@tonic-gate 					prendlst();
317*0Sstevel@tonic-gate 					prs_buff("do");
318*0Sstevel@tonic-gate 					prbgnlst();
319*0Sstevel@tonic-gate 					prf(f->fortre);
320*0Sstevel@tonic-gate 					prendlst();
321*0Sstevel@tonic-gate 					prs_buff("done");
322*0Sstevel@tonic-gate 				}
323*0Sstevel@tonic-gate 				break;
324*0Sstevel@tonic-gate 
325*0Sstevel@tonic-gate 			case TWH:
326*0Sstevel@tonic-gate 			case TUN:
327*0Sstevel@tonic-gate 				if (type == TWH)
328*0Sstevel@tonic-gate 					prs_buff("while ");
329*0Sstevel@tonic-gate 				else
330*0Sstevel@tonic-gate 					prs_buff("until ");
331*0Sstevel@tonic-gate 				prf(whptr(t)->whtre);
332*0Sstevel@tonic-gate 				prendlst();
333*0Sstevel@tonic-gate 				prs_buff("do");
334*0Sstevel@tonic-gate 				prbgnlst();
335*0Sstevel@tonic-gate 				prf(whptr(t)->dotre);
336*0Sstevel@tonic-gate 				prendlst();
337*0Sstevel@tonic-gate 				prs_buff("done");
338*0Sstevel@tonic-gate 				break;
339*0Sstevel@tonic-gate 
340*0Sstevel@tonic-gate 			case TIF:
341*0Sstevel@tonic-gate 			{
342*0Sstevel@tonic-gate 				struct ifnod *f = (struct ifnod *)t;
343*0Sstevel@tonic-gate 
344*0Sstevel@tonic-gate 				prs_buff("if ");
345*0Sstevel@tonic-gate 				prf(f->iftre);
346*0Sstevel@tonic-gate 				prendlst();
347*0Sstevel@tonic-gate 				prs_buff("then");
348*0Sstevel@tonic-gate 				prendlst();
349*0Sstevel@tonic-gate 				prf(f->thtre);
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate 				if (f->eltre)
352*0Sstevel@tonic-gate 				{
353*0Sstevel@tonic-gate 					prendlst();
354*0Sstevel@tonic-gate 					prs_buff("else");
355*0Sstevel@tonic-gate 					prendlst();
356*0Sstevel@tonic-gate 					prf(f->eltre);
357*0Sstevel@tonic-gate 				}
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate 				prendlst();
360*0Sstevel@tonic-gate 				prs_buff("fi");
361*0Sstevel@tonic-gate 				break;
362*0Sstevel@tonic-gate 			}
363*0Sstevel@tonic-gate 
364*0Sstevel@tonic-gate 			case TSW:
365*0Sstevel@tonic-gate 				{
366*0Sstevel@tonic-gate 					register struct regnod 	*swl;
367*0Sstevel@tonic-gate 
368*0Sstevel@tonic-gate 					prs_buff("case ");
369*0Sstevel@tonic-gate 					prs_buff(swptr(t)->swarg);
370*0Sstevel@tonic-gate 
371*0Sstevel@tonic-gate 					swl = swptr(t)->swlst;
372*0Sstevel@tonic-gate 					while(swl)
373*0Sstevel@tonic-gate 					{
374*0Sstevel@tonic-gate 						struct argnod	*arg = swl->regptr;
375*0Sstevel@tonic-gate 
376*0Sstevel@tonic-gate 						if (arg)
377*0Sstevel@tonic-gate 						{
378*0Sstevel@tonic-gate 							prs_buff(arg->argval);
379*0Sstevel@tonic-gate 							arg = arg->argnxt;
380*0Sstevel@tonic-gate 						}
381*0Sstevel@tonic-gate 
382*0Sstevel@tonic-gate 						while(arg)
383*0Sstevel@tonic-gate 						{
384*0Sstevel@tonic-gate 							prs_buff(" | ");
385*0Sstevel@tonic-gate 							prs_buff(arg->argval);
386*0Sstevel@tonic-gate 							arg = arg->argnxt;
387*0Sstevel@tonic-gate 						}
388*0Sstevel@tonic-gate 
389*0Sstevel@tonic-gate 						prs_buff(")");
390*0Sstevel@tonic-gate 						prf(swl->regcom);
391*0Sstevel@tonic-gate 						prs_buff(";;");
392*0Sstevel@tonic-gate 						swl = swl->regnxt;
393*0Sstevel@tonic-gate 					}
394*0Sstevel@tonic-gate 				}
395*0Sstevel@tonic-gate 				break;
396*0Sstevel@tonic-gate 			}
397*0Sstevel@tonic-gate 		}
398*0Sstevel@tonic-gate 
399*0Sstevel@tonic-gate 	sigchk();
400*0Sstevel@tonic-gate }
401*0Sstevel@tonic-gate 
402*0Sstevel@tonic-gate prarg(argp)
403*0Sstevel@tonic-gate 	register struct argnod	*argp;
404*0Sstevel@tonic-gate {
405*0Sstevel@tonic-gate 	while (argp)
406*0Sstevel@tonic-gate 	{
407*0Sstevel@tonic-gate 		prs_buff(argp->argval);
408*0Sstevel@tonic-gate 		argp=argp->argnxt;
409*0Sstevel@tonic-gate 		if (argp)
410*0Sstevel@tonic-gate 			prc_buff(SPACE);
411*0Sstevel@tonic-gate 	}
412*0Sstevel@tonic-gate }
413*0Sstevel@tonic-gate 
414*0Sstevel@tonic-gate 
415*0Sstevel@tonic-gate prio(iop)
416*0Sstevel@tonic-gate 	register struct ionod	*iop;
417*0Sstevel@tonic-gate {
418*0Sstevel@tonic-gate 	register int	iof;
419*0Sstevel@tonic-gate 	register unsigned char	*ion;
420*0Sstevel@tonic-gate 
421*0Sstevel@tonic-gate 	while (iop)
422*0Sstevel@tonic-gate 	{
423*0Sstevel@tonic-gate 		iof = iop->iofile;
424*0Sstevel@tonic-gate 		ion = (unsigned char *) iop->ioname;
425*0Sstevel@tonic-gate 
426*0Sstevel@tonic-gate 		if (*ion)
427*0Sstevel@tonic-gate 		{
428*0Sstevel@tonic-gate 			prc_buff(SPACE);
429*0Sstevel@tonic-gate 
430*0Sstevel@tonic-gate 			prn_buff(iof & IOUFD);
431*0Sstevel@tonic-gate 
432*0Sstevel@tonic-gate 			if (iof & IODOC)
433*0Sstevel@tonic-gate 				prs_buff("<<");
434*0Sstevel@tonic-gate 			else if (iof & IOMOV)
435*0Sstevel@tonic-gate 			{
436*0Sstevel@tonic-gate 				if (iof & IOPUT)
437*0Sstevel@tonic-gate 					prs_buff(">&");
438*0Sstevel@tonic-gate 				else
439*0Sstevel@tonic-gate 					prs_buff("<&");
440*0Sstevel@tonic-gate 
441*0Sstevel@tonic-gate 			}
442*0Sstevel@tonic-gate 			else if ((iof & IOPUT) == 0)
443*0Sstevel@tonic-gate 				prc_buff('<');
444*0Sstevel@tonic-gate 			else if (iof & IOAPP)
445*0Sstevel@tonic-gate 				prs_buff(">>");
446*0Sstevel@tonic-gate 			else
447*0Sstevel@tonic-gate 				prc_buff('>');
448*0Sstevel@tonic-gate 
449*0Sstevel@tonic-gate 			prs_buff(ion);
450*0Sstevel@tonic-gate 		}
451*0Sstevel@tonic-gate 		iop = iop->ionxt;
452*0Sstevel@tonic-gate 	}
453*0Sstevel@tonic-gate }
454