17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 22*965005c8Schin 23*965005c8Schin /* 24*965005c8Schin * Copyright 1996 Sun Microsystems, Inc. All rights reserved. 25*965005c8Schin * Use is subject to license terms. 26*965005c8Schin */ 27*965005c8Schin 287c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 297c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 307c478bd9Sstevel@tonic-gate 31*965005c8Schin #pragma ident "%Z%%M% %I% %E% SMI" 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * UNIX shell 347c478bd9Sstevel@tonic-gate */ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include "defs.h" 377c478bd9Sstevel@tonic-gate 38*965005c8Schin static void freetree(struct trenod *); 39*965005c8Schin static void free_arg(struct argnod *); 40*965005c8Schin static void freeio(struct ionod *); 41*965005c8Schin static void freereg(struct regnod *); 42*965005c8Schin static void prarg(struct argnod *argp); 43*965005c8Schin static void prio(struct ionod *iop); 44*965005c8Schin 45*965005c8Schin void 46*965005c8Schin freefunc(struct namnod *n) 477c478bd9Sstevel@tonic-gate { 487c478bd9Sstevel@tonic-gate freetree((struct trenod *)(n->namenv)); 497c478bd9Sstevel@tonic-gate } 507c478bd9Sstevel@tonic-gate 51*965005c8Schin static void 52*965005c8Schin freetree(struct trenod *t) 537c478bd9Sstevel@tonic-gate { 547c478bd9Sstevel@tonic-gate if (t) 557c478bd9Sstevel@tonic-gate { 56*965005c8Schin int type; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate if (t->tretyp & CNTMSK) 597c478bd9Sstevel@tonic-gate { 607c478bd9Sstevel@tonic-gate t->tretyp--; 617c478bd9Sstevel@tonic-gate return; 627c478bd9Sstevel@tonic-gate } 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate type = t->tretyp & COMMSK; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate switch (type) 677c478bd9Sstevel@tonic-gate { 687c478bd9Sstevel@tonic-gate case TFND: 697c478bd9Sstevel@tonic-gate free(fndptr(t)->fndnam); 707c478bd9Sstevel@tonic-gate freetree(fndptr(t)->fndval); 717c478bd9Sstevel@tonic-gate break; 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate case TCOM: 747c478bd9Sstevel@tonic-gate freeio(comptr(t)->comio); 757c478bd9Sstevel@tonic-gate free_arg(comptr(t)->comarg); 767c478bd9Sstevel@tonic-gate free_arg(comptr(t)->comset); 777c478bd9Sstevel@tonic-gate break; 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate case TFORK: 807c478bd9Sstevel@tonic-gate freeio(forkptr(t)->forkio); 817c478bd9Sstevel@tonic-gate freetree(forkptr(t)->forktre); 827c478bd9Sstevel@tonic-gate break; 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate case TPAR: 857c478bd9Sstevel@tonic-gate freetree(parptr(t)->partre); 867c478bd9Sstevel@tonic-gate break; 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate case TFIL: 897c478bd9Sstevel@tonic-gate case TLST: 907c478bd9Sstevel@tonic-gate case TAND: 917c478bd9Sstevel@tonic-gate case TORF: 927c478bd9Sstevel@tonic-gate freetree(lstptr(t)->lstlef); 937c478bd9Sstevel@tonic-gate freetree(lstptr(t)->lstrit); 947c478bd9Sstevel@tonic-gate break; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate case TFOR: 977c478bd9Sstevel@tonic-gate { 987c478bd9Sstevel@tonic-gate struct fornod *f = (struct fornod *)t; 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate free(f->fornam); 1017c478bd9Sstevel@tonic-gate freetree(f->fortre); 1027c478bd9Sstevel@tonic-gate if (f->forlst) 1037c478bd9Sstevel@tonic-gate { 1047c478bd9Sstevel@tonic-gate freeio(f->forlst->comio); 1057c478bd9Sstevel@tonic-gate free_arg(f->forlst->comarg); 1067c478bd9Sstevel@tonic-gate free_arg(f->forlst->comset); 1077c478bd9Sstevel@tonic-gate free(f->forlst); 1087c478bd9Sstevel@tonic-gate } 1097c478bd9Sstevel@tonic-gate } 1107c478bd9Sstevel@tonic-gate break; 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate case TWH: 1137c478bd9Sstevel@tonic-gate case TUN: 1147c478bd9Sstevel@tonic-gate freetree(whptr(t)->whtre); 1157c478bd9Sstevel@tonic-gate freetree(whptr(t)->dotre); 1167c478bd9Sstevel@tonic-gate break; 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate case TIF: 1197c478bd9Sstevel@tonic-gate freetree(ifptr(t)->iftre); 1207c478bd9Sstevel@tonic-gate freetree(ifptr(t)->thtre); 1217c478bd9Sstevel@tonic-gate freetree(ifptr(t)->eltre); 1227c478bd9Sstevel@tonic-gate break; 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate case TSW: 1257c478bd9Sstevel@tonic-gate free(swptr(t)->swarg); 1267c478bd9Sstevel@tonic-gate freereg(swptr(t)->swlst); 1277c478bd9Sstevel@tonic-gate break; 1287c478bd9Sstevel@tonic-gate } 1297c478bd9Sstevel@tonic-gate free(t); 1307c478bd9Sstevel@tonic-gate } 1317c478bd9Sstevel@tonic-gate } 1327c478bd9Sstevel@tonic-gate 133*965005c8Schin static void 134*965005c8Schin free_arg(struct argnod *argp) 1357c478bd9Sstevel@tonic-gate { 136*965005c8Schin struct argnod *sav; 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate while (argp) 1397c478bd9Sstevel@tonic-gate { 1407c478bd9Sstevel@tonic-gate sav = argp->argnxt; 1417c478bd9Sstevel@tonic-gate free(argp); 1427c478bd9Sstevel@tonic-gate argp = sav; 1437c478bd9Sstevel@tonic-gate } 1447c478bd9Sstevel@tonic-gate } 1457c478bd9Sstevel@tonic-gate 146*965005c8Schin void 147*965005c8Schin freeio(struct ionod *iop) 1487c478bd9Sstevel@tonic-gate { 149*965005c8Schin struct ionod *sav; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate while (iop) 1527c478bd9Sstevel@tonic-gate { 1537c478bd9Sstevel@tonic-gate if (iop->iofile & IODOC) 1547c478bd9Sstevel@tonic-gate { 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate #ifdef DEBUG 1577c478bd9Sstevel@tonic-gate prs("unlinking "); 1587c478bd9Sstevel@tonic-gate prs(iop->ioname); 1597c478bd9Sstevel@tonic-gate newline(); 1607c478bd9Sstevel@tonic-gate #endif 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate unlink(iop->ioname); 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate if (fiotemp == iop) 1657c478bd9Sstevel@tonic-gate fiotemp = iop->iolst; 1667c478bd9Sstevel@tonic-gate else 1677c478bd9Sstevel@tonic-gate { 1687c478bd9Sstevel@tonic-gate struct ionod *fiop = fiotemp; 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate while (fiop->iolst != iop) 1717c478bd9Sstevel@tonic-gate fiop = fiop->iolst; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate fiop->iolst = iop->iolst; 1747c478bd9Sstevel@tonic-gate } 1757c478bd9Sstevel@tonic-gate } 1767c478bd9Sstevel@tonic-gate free(iop->ioname); 1777c478bd9Sstevel@tonic-gate free(iop->iolink); 1787c478bd9Sstevel@tonic-gate sav = iop->ionxt; 1797c478bd9Sstevel@tonic-gate free(iop); 1807c478bd9Sstevel@tonic-gate iop = sav; 1817c478bd9Sstevel@tonic-gate } 1827c478bd9Sstevel@tonic-gate } 1837c478bd9Sstevel@tonic-gate 184*965005c8Schin static void 185*965005c8Schin freereg(struct regnod *regp) 1867c478bd9Sstevel@tonic-gate { 187*965005c8Schin struct regnod *sav; 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate while (regp) 1907c478bd9Sstevel@tonic-gate { 1917c478bd9Sstevel@tonic-gate free_arg(regp->regptr); 1927c478bd9Sstevel@tonic-gate freetree(regp->regcom); 1937c478bd9Sstevel@tonic-gate sav = regp->regnxt; 1947c478bd9Sstevel@tonic-gate free(regp); 1957c478bd9Sstevel@tonic-gate regp = sav; 1967c478bd9Sstevel@tonic-gate } 1977c478bd9Sstevel@tonic-gate } 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate 200*965005c8Schin static int nonl = 0; 2017c478bd9Sstevel@tonic-gate 202*965005c8Schin void 203*965005c8Schin prbgnlst(void) 2047c478bd9Sstevel@tonic-gate { 2057c478bd9Sstevel@tonic-gate if (nonl) 2067c478bd9Sstevel@tonic-gate prc_buff(SPACE); 2077c478bd9Sstevel@tonic-gate else 2087c478bd9Sstevel@tonic-gate prc_buff(NL); 2097c478bd9Sstevel@tonic-gate } 2107c478bd9Sstevel@tonic-gate 211*965005c8Schin void 212*965005c8Schin prendlst(void) 2137c478bd9Sstevel@tonic-gate { 2147c478bd9Sstevel@tonic-gate if (nonl) { 2157c478bd9Sstevel@tonic-gate prc_buff(';'); 2167c478bd9Sstevel@tonic-gate prc_buff(SPACE); 2177c478bd9Sstevel@tonic-gate } 2187c478bd9Sstevel@tonic-gate else 2197c478bd9Sstevel@tonic-gate prc_buff(NL); 2207c478bd9Sstevel@tonic-gate } 2217c478bd9Sstevel@tonic-gate 222*965005c8Schin void 223*965005c8Schin prcmd(struct trenod *t) 2247c478bd9Sstevel@tonic-gate { 2257c478bd9Sstevel@tonic-gate nonl++; 2267c478bd9Sstevel@tonic-gate prf(t); 2277c478bd9Sstevel@tonic-gate nonl = 0; 2287c478bd9Sstevel@tonic-gate } 2297c478bd9Sstevel@tonic-gate 230*965005c8Schin void 231*965005c8Schin prf(struct trenod *t) 2327c478bd9Sstevel@tonic-gate { 2337c478bd9Sstevel@tonic-gate sigchk(); 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate if (t) 2367c478bd9Sstevel@tonic-gate { 237*965005c8Schin int type; 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate type = t->tretyp & COMMSK; 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate switch(type) 2427c478bd9Sstevel@tonic-gate { 2437c478bd9Sstevel@tonic-gate case TFND: 2447c478bd9Sstevel@tonic-gate { 245*965005c8Schin struct fndnod *f = (struct fndnod *)t; 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate prs_buff(f->fndnam); 2487c478bd9Sstevel@tonic-gate prs_buff("(){"); 2497c478bd9Sstevel@tonic-gate prbgnlst(); 2507c478bd9Sstevel@tonic-gate prf(f->fndval); 2517c478bd9Sstevel@tonic-gate prbgnlst(); 2527c478bd9Sstevel@tonic-gate prs_buff("}"); 2537c478bd9Sstevel@tonic-gate break; 2547c478bd9Sstevel@tonic-gate } 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate case TCOM: 2577c478bd9Sstevel@tonic-gate if (comptr(t)->comset) { 2587c478bd9Sstevel@tonic-gate prarg(comptr(t)->comset); 2597c478bd9Sstevel@tonic-gate prc_buff(SPACE); 2607c478bd9Sstevel@tonic-gate } 2617c478bd9Sstevel@tonic-gate prarg(comptr(t)->comarg); 2627c478bd9Sstevel@tonic-gate prio(comptr(t)->comio); 2637c478bd9Sstevel@tonic-gate break; 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate case TFORK: 2667c478bd9Sstevel@tonic-gate prf(forkptr(t)->forktre); 2677c478bd9Sstevel@tonic-gate prio(forkptr(t)->forkio); 2687c478bd9Sstevel@tonic-gate if (forkptr(t)->forktyp & FAMP) 2697c478bd9Sstevel@tonic-gate prs_buff(" &"); 2707c478bd9Sstevel@tonic-gate break; 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate case TPAR: 2737c478bd9Sstevel@tonic-gate prs_buff("("); 2747c478bd9Sstevel@tonic-gate prf(parptr(t)->partre); 2757c478bd9Sstevel@tonic-gate prs_buff(")"); 2767c478bd9Sstevel@tonic-gate break; 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate case TFIL: 2797c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstlef); 2807c478bd9Sstevel@tonic-gate prs_buff(" | "); 2817c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstrit); 2827c478bd9Sstevel@tonic-gate break; 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate case TLST: 2857c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstlef); 2867c478bd9Sstevel@tonic-gate prendlst(); 2877c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstrit); 2887c478bd9Sstevel@tonic-gate break; 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate case TAND: 2917c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstlef); 2927c478bd9Sstevel@tonic-gate prs_buff(" && "); 2937c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstrit); 2947c478bd9Sstevel@tonic-gate break; 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate case TORF: 2977c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstlef); 2987c478bd9Sstevel@tonic-gate prs_buff(" || "); 2997c478bd9Sstevel@tonic-gate prf(lstptr(t)->lstrit); 3007c478bd9Sstevel@tonic-gate break; 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate case TFOR: 3037c478bd9Sstevel@tonic-gate { 304*965005c8Schin struct argnod *arg; 305*965005c8Schin struct fornod *f = (struct fornod *)t; 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate prs_buff("for "); 3087c478bd9Sstevel@tonic-gate prs_buff(f->fornam); 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate if (f->forlst) 3117c478bd9Sstevel@tonic-gate { 3127c478bd9Sstevel@tonic-gate arg = f->forlst->comarg; 3137c478bd9Sstevel@tonic-gate prs_buff(" in"); 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate while(arg != ENDARGS) 3167c478bd9Sstevel@tonic-gate { 3177c478bd9Sstevel@tonic-gate prc_buff(SPACE); 3187c478bd9Sstevel@tonic-gate prs_buff(arg->argval); 3197c478bd9Sstevel@tonic-gate arg = arg->argnxt; 3207c478bd9Sstevel@tonic-gate } 3217c478bd9Sstevel@tonic-gate } 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate prendlst(); 3247c478bd9Sstevel@tonic-gate prs_buff("do"); 3257c478bd9Sstevel@tonic-gate prbgnlst(); 3267c478bd9Sstevel@tonic-gate prf(f->fortre); 3277c478bd9Sstevel@tonic-gate prendlst(); 3287c478bd9Sstevel@tonic-gate prs_buff("done"); 3297c478bd9Sstevel@tonic-gate } 3307c478bd9Sstevel@tonic-gate break; 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate case TWH: 3337c478bd9Sstevel@tonic-gate case TUN: 3347c478bd9Sstevel@tonic-gate if (type == TWH) 3357c478bd9Sstevel@tonic-gate prs_buff("while "); 3367c478bd9Sstevel@tonic-gate else 3377c478bd9Sstevel@tonic-gate prs_buff("until "); 3387c478bd9Sstevel@tonic-gate prf(whptr(t)->whtre); 3397c478bd9Sstevel@tonic-gate prendlst(); 3407c478bd9Sstevel@tonic-gate prs_buff("do"); 3417c478bd9Sstevel@tonic-gate prbgnlst(); 3427c478bd9Sstevel@tonic-gate prf(whptr(t)->dotre); 3437c478bd9Sstevel@tonic-gate prendlst(); 3447c478bd9Sstevel@tonic-gate prs_buff("done"); 3457c478bd9Sstevel@tonic-gate break; 3467c478bd9Sstevel@tonic-gate 3477c478bd9Sstevel@tonic-gate case TIF: 3487c478bd9Sstevel@tonic-gate { 3497c478bd9Sstevel@tonic-gate struct ifnod *f = (struct ifnod *)t; 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate prs_buff("if "); 3527c478bd9Sstevel@tonic-gate prf(f->iftre); 3537c478bd9Sstevel@tonic-gate prendlst(); 3547c478bd9Sstevel@tonic-gate prs_buff("then"); 3557c478bd9Sstevel@tonic-gate prendlst(); 3567c478bd9Sstevel@tonic-gate prf(f->thtre); 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate if (f->eltre) 3597c478bd9Sstevel@tonic-gate { 3607c478bd9Sstevel@tonic-gate prendlst(); 3617c478bd9Sstevel@tonic-gate prs_buff("else"); 3627c478bd9Sstevel@tonic-gate prendlst(); 3637c478bd9Sstevel@tonic-gate prf(f->eltre); 3647c478bd9Sstevel@tonic-gate } 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gate prendlst(); 3677c478bd9Sstevel@tonic-gate prs_buff("fi"); 3687c478bd9Sstevel@tonic-gate break; 3697c478bd9Sstevel@tonic-gate } 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate case TSW: 3727c478bd9Sstevel@tonic-gate { 373*965005c8Schin struct regnod *swl; 3747c478bd9Sstevel@tonic-gate 3757c478bd9Sstevel@tonic-gate prs_buff("case "); 3767c478bd9Sstevel@tonic-gate prs_buff(swptr(t)->swarg); 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate swl = swptr(t)->swlst; 3797c478bd9Sstevel@tonic-gate while(swl) 3807c478bd9Sstevel@tonic-gate { 3817c478bd9Sstevel@tonic-gate struct argnod *arg = swl->regptr; 3827c478bd9Sstevel@tonic-gate 3837c478bd9Sstevel@tonic-gate if (arg) 3847c478bd9Sstevel@tonic-gate { 3857c478bd9Sstevel@tonic-gate prs_buff(arg->argval); 3867c478bd9Sstevel@tonic-gate arg = arg->argnxt; 3877c478bd9Sstevel@tonic-gate } 3887c478bd9Sstevel@tonic-gate 3897c478bd9Sstevel@tonic-gate while(arg) 3907c478bd9Sstevel@tonic-gate { 3917c478bd9Sstevel@tonic-gate prs_buff(" | "); 3927c478bd9Sstevel@tonic-gate prs_buff(arg->argval); 3937c478bd9Sstevel@tonic-gate arg = arg->argnxt; 3947c478bd9Sstevel@tonic-gate } 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate prs_buff(")"); 3977c478bd9Sstevel@tonic-gate prf(swl->regcom); 3987c478bd9Sstevel@tonic-gate prs_buff(";;"); 3997c478bd9Sstevel@tonic-gate swl = swl->regnxt; 4007c478bd9Sstevel@tonic-gate } 4017c478bd9Sstevel@tonic-gate } 4027c478bd9Sstevel@tonic-gate break; 4037c478bd9Sstevel@tonic-gate } 4047c478bd9Sstevel@tonic-gate } 4057c478bd9Sstevel@tonic-gate 4067c478bd9Sstevel@tonic-gate sigchk(); 4077c478bd9Sstevel@tonic-gate } 4087c478bd9Sstevel@tonic-gate 409*965005c8Schin static void 410*965005c8Schin prarg(struct argnod *argp) 4117c478bd9Sstevel@tonic-gate { 4127c478bd9Sstevel@tonic-gate while (argp) 4137c478bd9Sstevel@tonic-gate { 4147c478bd9Sstevel@tonic-gate prs_buff(argp->argval); 4157c478bd9Sstevel@tonic-gate argp=argp->argnxt; 4167c478bd9Sstevel@tonic-gate if (argp) 4177c478bd9Sstevel@tonic-gate prc_buff(SPACE); 4187c478bd9Sstevel@tonic-gate } 4197c478bd9Sstevel@tonic-gate } 4207c478bd9Sstevel@tonic-gate 421*965005c8Schin static void 422*965005c8Schin prio(struct ionod *iop) 4237c478bd9Sstevel@tonic-gate { 424*965005c8Schin int iof; 425*965005c8Schin unsigned char *ion; 4267c478bd9Sstevel@tonic-gate 4277c478bd9Sstevel@tonic-gate while (iop) 4287c478bd9Sstevel@tonic-gate { 4297c478bd9Sstevel@tonic-gate iof = iop->iofile; 4307c478bd9Sstevel@tonic-gate ion = (unsigned char *) iop->ioname; 4317c478bd9Sstevel@tonic-gate 4327c478bd9Sstevel@tonic-gate if (*ion) 4337c478bd9Sstevel@tonic-gate { 4347c478bd9Sstevel@tonic-gate prc_buff(SPACE); 4357c478bd9Sstevel@tonic-gate 4367c478bd9Sstevel@tonic-gate prn_buff(iof & IOUFD); 4377c478bd9Sstevel@tonic-gate 4387c478bd9Sstevel@tonic-gate if (iof & IODOC) 4397c478bd9Sstevel@tonic-gate prs_buff("<<"); 4407c478bd9Sstevel@tonic-gate else if (iof & IOMOV) 4417c478bd9Sstevel@tonic-gate { 4427c478bd9Sstevel@tonic-gate if (iof & IOPUT) 4437c478bd9Sstevel@tonic-gate prs_buff(">&"); 4447c478bd9Sstevel@tonic-gate else 4457c478bd9Sstevel@tonic-gate prs_buff("<&"); 4467c478bd9Sstevel@tonic-gate 4477c478bd9Sstevel@tonic-gate } 4487c478bd9Sstevel@tonic-gate else if ((iof & IOPUT) == 0) 4497c478bd9Sstevel@tonic-gate prc_buff('<'); 4507c478bd9Sstevel@tonic-gate else if (iof & IOAPP) 4517c478bd9Sstevel@tonic-gate prs_buff(">>"); 4527c478bd9Sstevel@tonic-gate else 4537c478bd9Sstevel@tonic-gate prc_buff('>'); 4547c478bd9Sstevel@tonic-gate 4557c478bd9Sstevel@tonic-gate prs_buff(ion); 4567c478bd9Sstevel@tonic-gate } 4577c478bd9Sstevel@tonic-gate iop = iop->ionxt; 4587c478bd9Sstevel@tonic-gate } 4597c478bd9Sstevel@tonic-gate } 460