1*7c478bd9Sstevel@tonic-gate %{ 2*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 3*7c478bd9Sstevel@tonic-gate %} 4*7c478bd9Sstevel@tonic-gate %{ 5*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 6*7c478bd9Sstevel@tonic-gate %} 7*7c478bd9Sstevel@tonic-gate 8*7c478bd9Sstevel@tonic-gate %{ 9*7c478bd9Sstevel@tonic-gate /* */ 10*7c478bd9Sstevel@tonic-gate %} 11*7c478bd9Sstevel@tonic-gate 12*7c478bd9Sstevel@tonic-gate %{ 13*7c478bd9Sstevel@tonic-gate /* 14*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 15*7c478bd9Sstevel@tonic-gate * 16*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 17*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 18*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 19*7c478bd9Sstevel@tonic-gate * with the License. 20*7c478bd9Sstevel@tonic-gate * 21*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 22*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 23*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 24*7c478bd9Sstevel@tonic-gate * and limitations under the License. 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 27*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 28*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 29*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 30*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 31*7c478bd9Sstevel@tonic-gate * 32*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 33*7c478bd9Sstevel@tonic-gate */ 34*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1996, 2001 by Sun Microsystems, Inc. */ 35*7c478bd9Sstevel@tonic-gate /* All rights reserved. */ 36*7c478bd9Sstevel@tonic-gate %} 37*7c478bd9Sstevel@tonic-gate %{ 38*7c478bd9Sstevel@tonic-gate /* */ 39*7c478bd9Sstevel@tonic-gate %} 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate %{ 42*7c478bd9Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.9 */ 43*7c478bd9Sstevel@tonic-gate %} 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate %Start A str sc reg comment 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate %{ 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 50*7c478bd9Sstevel@tonic-gate #include "awk.h" 51*7c478bd9Sstevel@tonic-gate #include "y.tab.h" 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate #undef input /* defeat lex */ 54*7c478bd9Sstevel@tonic-gate #undef unput 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate extern YYSTYPE yylval; 57*7c478bd9Sstevel@tonic-gate extern int infunc; 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate off_t lineno = 1; 60*7c478bd9Sstevel@tonic-gate int bracecnt = 0; 61*7c478bd9Sstevel@tonic-gate int brackcnt = 0; 62*7c478bd9Sstevel@tonic-gate int parencnt = 0; 63*7c478bd9Sstevel@tonic-gate #define DEBUG 64*7c478bd9Sstevel@tonic-gate #ifdef DEBUG 65*7c478bd9Sstevel@tonic-gate # define RET(x) {if(dbg)printf("lex %s [%s]\n", tokname(x), yytext); return(x); } 66*7c478bd9Sstevel@tonic-gate #else 67*7c478bd9Sstevel@tonic-gate # define RET(x) return(x) 68*7c478bd9Sstevel@tonic-gate #endif 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate #define CADD cbuf[clen++] = yytext[0]; \ 71*7c478bd9Sstevel@tonic-gate if (clen >= RECSIZE-1) { \ 72*7c478bd9Sstevel@tonic-gate ERROR "string/reg expr %.10s... too long", cbuf SYNTAX; \ 73*7c478bd9Sstevel@tonic-gate BEGIN A; \ 74*7c478bd9Sstevel@tonic-gate } 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate uchar cbuf[RECSIZE]; 77*7c478bd9Sstevel@tonic-gate uchar *s; 78*7c478bd9Sstevel@tonic-gate int clen, cflag; 79*7c478bd9Sstevel@tonic-gate %} 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate A [a-zA-Z_] 82*7c478bd9Sstevel@tonic-gate B [a-zA-Z0-9_] 83*7c478bd9Sstevel@tonic-gate D [0-9] 84*7c478bd9Sstevel@tonic-gate O [0-7] 85*7c478bd9Sstevel@tonic-gate H [0-9a-fA-F] 86*7c478bd9Sstevel@tonic-gate WS [ \t] 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate %% 89*7c478bd9Sstevel@tonic-gate switch (yybgin-yysvec-1) { /* witchcraft */ 90*7c478bd9Sstevel@tonic-gate case 0: 91*7c478bd9Sstevel@tonic-gate BEGIN A; 92*7c478bd9Sstevel@tonic-gate break; 93*7c478bd9Sstevel@tonic-gate case sc: 94*7c478bd9Sstevel@tonic-gate BEGIN A; 95*7c478bd9Sstevel@tonic-gate RET('}'); 96*7c478bd9Sstevel@tonic-gate } 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate <A>\n { lineno++; RET(NL); } 99*7c478bd9Sstevel@tonic-gate <A>#.* { ; } /* strip comments */ 100*7c478bd9Sstevel@tonic-gate <A>{WS}+ { ; } 101*7c478bd9Sstevel@tonic-gate <A>; { RET(';'); } 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate <A>"\\"\n { lineno++; } 104*7c478bd9Sstevel@tonic-gate <A>BEGIN { RET(XBEGIN); } 105*7c478bd9Sstevel@tonic-gate <A>END { RET(XEND); } 106*7c478bd9Sstevel@tonic-gate <A>func(tion)? { if (infunc) ERROR "illegal nested function" SYNTAX; RET(FUNC); } 107*7c478bd9Sstevel@tonic-gate <A>return { if (!infunc) ERROR "return not in function" SYNTAX; RET(RETURN); } 108*7c478bd9Sstevel@tonic-gate <A>"&&" { RET(AND); } 109*7c478bd9Sstevel@tonic-gate <A>"||" { RET(BOR); } 110*7c478bd9Sstevel@tonic-gate <A>"!" { RET(NOT); } 111*7c478bd9Sstevel@tonic-gate <A>"!=" { yylval.i = NE; RET(NE); } 112*7c478bd9Sstevel@tonic-gate <A>"~" { yylval.i = MATCH; RET(MATCHOP); } 113*7c478bd9Sstevel@tonic-gate <A>"!~" { yylval.i = NOTMATCH; RET(MATCHOP); } 114*7c478bd9Sstevel@tonic-gate <A>"<" { yylval.i = LT; RET(LT); } 115*7c478bd9Sstevel@tonic-gate <A>"<=" { yylval.i = LE; RET(LE); } 116*7c478bd9Sstevel@tonic-gate <A>"==" { yylval.i = EQ; RET(EQ); } 117*7c478bd9Sstevel@tonic-gate <A>">=" { yylval.i = GE; RET(GE); } 118*7c478bd9Sstevel@tonic-gate <A>">" { yylval.i = GT; RET(GT); } 119*7c478bd9Sstevel@tonic-gate <A>">>" { yylval.i = APPEND; RET(APPEND); } 120*7c478bd9Sstevel@tonic-gate <A>"++" { yylval.i = INCR; RET(INCR); } 121*7c478bd9Sstevel@tonic-gate <A>"--" { yylval.i = DECR; RET(DECR); } 122*7c478bd9Sstevel@tonic-gate <A>"+=" { yylval.i = ADDEQ; RET(ASGNOP); } 123*7c478bd9Sstevel@tonic-gate <A>"-=" { yylval.i = SUBEQ; RET(ASGNOP); } 124*7c478bd9Sstevel@tonic-gate <A>"*=" { yylval.i = MULTEQ; RET(ASGNOP); } 125*7c478bd9Sstevel@tonic-gate <A>"/=" { yylval.i = DIVEQ; RET(ASGNOP); } 126*7c478bd9Sstevel@tonic-gate <A>"%=" { yylval.i = MODEQ; RET(ASGNOP); } 127*7c478bd9Sstevel@tonic-gate <A>"^=" { yylval.i = POWEQ; RET(ASGNOP); } 128*7c478bd9Sstevel@tonic-gate <A>"**=" { yylval.i = POWEQ; RET(ASGNOP); } 129*7c478bd9Sstevel@tonic-gate <A>"=" { yylval.i = ASSIGN; RET(ASGNOP); } 130*7c478bd9Sstevel@tonic-gate <A>"**" { RET(POWER); } 131*7c478bd9Sstevel@tonic-gate <A>"^" { RET(POWER); } 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate <A>"$"{D}+ { yylval.cp = fieldadr(atoi(yytext+1)); RET(FIELD); } 134*7c478bd9Sstevel@tonic-gate <A>"$NF" { unputstr("(NF)"); return(INDIRECT); } 135*7c478bd9Sstevel@tonic-gate <A>"$"{A}{B}* { int c, n; 136*7c478bd9Sstevel@tonic-gate c = input(); unput(c); 137*7c478bd9Sstevel@tonic-gate if (c == '(' || c == '[' || infunc && (n=isarg(yytext+1)) >= 0) { 138*7c478bd9Sstevel@tonic-gate unputstr(yytext+1); 139*7c478bd9Sstevel@tonic-gate return(INDIRECT); 140*7c478bd9Sstevel@tonic-gate } else { 141*7c478bd9Sstevel@tonic-gate yylval.cp = setsymtab(yytext+1,"",0.0,STR|NUM,symtab); 142*7c478bd9Sstevel@tonic-gate RET(IVAR); 143*7c478bd9Sstevel@tonic-gate } 144*7c478bd9Sstevel@tonic-gate } 145*7c478bd9Sstevel@tonic-gate <A>"$" { RET(INDIRECT); } 146*7c478bd9Sstevel@tonic-gate <A>NF { yylval.cp = setsymtab(yytext, "", 0.0, NUM, symtab); RET(VARNF); } 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate <A>({D}+("."?){D}*|"."{D}+)((e|E)("+"|-)?{D}+)? { 149*7c478bd9Sstevel@tonic-gate yylval.cp = setsymtab(yytext, tostring(yytext), atof(yytext), CON|NUM, symtab); 150*7c478bd9Sstevel@tonic-gate RET(NUMBER); } 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate <A>while { RET(WHILE); } 153*7c478bd9Sstevel@tonic-gate <A>for { RET(FOR); } 154*7c478bd9Sstevel@tonic-gate <A>do { RET(DO); } 155*7c478bd9Sstevel@tonic-gate <A>if { RET(IF); } 156*7c478bd9Sstevel@tonic-gate <A>else { RET(ELSE); } 157*7c478bd9Sstevel@tonic-gate <A>next { RET(NEXT); } 158*7c478bd9Sstevel@tonic-gate <A>exit { RET(EXIT); } 159*7c478bd9Sstevel@tonic-gate <A>break { RET(BREAK); } 160*7c478bd9Sstevel@tonic-gate <A>continue { RET(CONTINUE); } 161*7c478bd9Sstevel@tonic-gate <A>print { yylval.i = PRINT; RET(PRINT); } 162*7c478bd9Sstevel@tonic-gate <A>printf { yylval.i = PRINTF; RET(PRINTF); } 163*7c478bd9Sstevel@tonic-gate <A>sprintf { yylval.i = SPRINTF; RET(SPRINTF); } 164*7c478bd9Sstevel@tonic-gate <A>split { yylval.i = SPLIT; RET(SPLIT); } 165*7c478bd9Sstevel@tonic-gate <A>substr { RET(SUBSTR); } 166*7c478bd9Sstevel@tonic-gate <A>sub { yylval.i = SUB; RET(SUB); } 167*7c478bd9Sstevel@tonic-gate <A>gsub { yylval.i = GSUB; RET(GSUB); } 168*7c478bd9Sstevel@tonic-gate <A>index { RET(INDEX); } 169*7c478bd9Sstevel@tonic-gate <A>match { RET(MATCHFCN); } 170*7c478bd9Sstevel@tonic-gate <A>in { RET(IN); } 171*7c478bd9Sstevel@tonic-gate <A>getline { RET(GETLINE); } 172*7c478bd9Sstevel@tonic-gate <A>close { RET(CLOSE); } 173*7c478bd9Sstevel@tonic-gate <A>delete { RET(DELETE); } 174*7c478bd9Sstevel@tonic-gate <A>length { yylval.i = FLENGTH; RET(BLTIN); } 175*7c478bd9Sstevel@tonic-gate <A>log { yylval.i = FLOG; RET(BLTIN); } 176*7c478bd9Sstevel@tonic-gate <A>int { yylval.i = FINT; RET(BLTIN); } 177*7c478bd9Sstevel@tonic-gate <A>exp { yylval.i = FEXP; RET(BLTIN); } 178*7c478bd9Sstevel@tonic-gate <A>sqrt { yylval.i = FSQRT; RET(BLTIN); } 179*7c478bd9Sstevel@tonic-gate <A>sin { yylval.i = FSIN; RET(BLTIN); } 180*7c478bd9Sstevel@tonic-gate <A>cos { yylval.i = FCOS; RET(BLTIN); } 181*7c478bd9Sstevel@tonic-gate <A>atan2 { yylval.i = FATAN; RET(BLTIN); } 182*7c478bd9Sstevel@tonic-gate <A>system { yylval.i = FSYSTEM; RET(BLTIN); } 183*7c478bd9Sstevel@tonic-gate <A>rand { yylval.i = FRAND; RET(BLTIN); } 184*7c478bd9Sstevel@tonic-gate <A>srand { yylval.i = FSRAND; RET(BLTIN); } 185*7c478bd9Sstevel@tonic-gate <A>toupper { yylval.i = FTOUPPER; RET(BLTIN); } 186*7c478bd9Sstevel@tonic-gate <A>tolower { yylval.i = FTOLOWER; RET(BLTIN); } 187*7c478bd9Sstevel@tonic-gate 188*7c478bd9Sstevel@tonic-gate <A>{A}{B}* { int n, c; 189*7c478bd9Sstevel@tonic-gate c = input(); unput(c); /* look for '(' */ 190*7c478bd9Sstevel@tonic-gate if (c != '(' && infunc && (n=isarg(yytext)) >= 0) { 191*7c478bd9Sstevel@tonic-gate yylval.i = n; 192*7c478bd9Sstevel@tonic-gate RET(ARG); 193*7c478bd9Sstevel@tonic-gate } else { 194*7c478bd9Sstevel@tonic-gate yylval.cp = setsymtab(yytext,"",0.0,STR|NUM,symtab); 195*7c478bd9Sstevel@tonic-gate if (c == '(') { 196*7c478bd9Sstevel@tonic-gate RET(CALL); 197*7c478bd9Sstevel@tonic-gate } else { 198*7c478bd9Sstevel@tonic-gate RET(VAR); 199*7c478bd9Sstevel@tonic-gate } 200*7c478bd9Sstevel@tonic-gate } 201*7c478bd9Sstevel@tonic-gate } 202*7c478bd9Sstevel@tonic-gate <A>\" { BEGIN str; clen = 0; } 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate <A>"}" { if (--bracecnt < 0) ERROR "extra }" SYNTAX; BEGIN sc; RET(';'); } 205*7c478bd9Sstevel@tonic-gate <A>"]" { if (--brackcnt < 0) ERROR "extra ]" SYNTAX; RET(']'); } 206*7c478bd9Sstevel@tonic-gate <A>")" { if (--parencnt < 0) ERROR "extra )" SYNTAX; RET(')'); } 207*7c478bd9Sstevel@tonic-gate 208*7c478bd9Sstevel@tonic-gate <A>. { if (yytext[0] == '{') bracecnt++; 209*7c478bd9Sstevel@tonic-gate else if (yytext[0] == '[') brackcnt++; 210*7c478bd9Sstevel@tonic-gate else if (yytext[0] == '(') parencnt++; 211*7c478bd9Sstevel@tonic-gate RET(yylval.i = yytext[0]); /* everything else */ } 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate <reg>\\. { cbuf[clen++] = '\\'; cbuf[clen++] = yytext[1]; } 214*7c478bd9Sstevel@tonic-gate <reg>\n { ERROR "newline in regular expression %.10s...", cbuf SYNTAX; lineno++; BEGIN A; } 215*7c478bd9Sstevel@tonic-gate <reg>"/" { BEGIN A; 216*7c478bd9Sstevel@tonic-gate cbuf[clen] = 0; 217*7c478bd9Sstevel@tonic-gate yylval.s = tostring(cbuf); 218*7c478bd9Sstevel@tonic-gate unput('/'); 219*7c478bd9Sstevel@tonic-gate RET(REGEXPR); } 220*7c478bd9Sstevel@tonic-gate <reg>. { CADD; } 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate <str>\" { BEGIN A; 223*7c478bd9Sstevel@tonic-gate cbuf[clen] = 0; s = tostring(cbuf); 224*7c478bd9Sstevel@tonic-gate cbuf[clen] = ' '; cbuf[++clen] = 0; 225*7c478bd9Sstevel@tonic-gate yylval.cp = setsymtab(cbuf, s, 0.0, CON|STR, symtab); 226*7c478bd9Sstevel@tonic-gate RET(STRING); } 227*7c478bd9Sstevel@tonic-gate <str>\n { ERROR "newline in string %.10s...", cbuf SYNTAX; lineno++; BEGIN A; } 228*7c478bd9Sstevel@tonic-gate <str>"\\\"" { cbuf[clen++] = '"'; } 229*7c478bd9Sstevel@tonic-gate <str>"\\"n { cbuf[clen++] = '\n'; } 230*7c478bd9Sstevel@tonic-gate <str>"\\"t { cbuf[clen++] = '\t'; } 231*7c478bd9Sstevel@tonic-gate <str>"\\"f { cbuf[clen++] = '\f'; } 232*7c478bd9Sstevel@tonic-gate <str>"\\"r { cbuf[clen++] = '\r'; } 233*7c478bd9Sstevel@tonic-gate <str>"\\"b { cbuf[clen++] = '\b'; } 234*7c478bd9Sstevel@tonic-gate <str>"\\"v { cbuf[clen++] = '\v'; } /* these ANSIisms may not be known by */ 235*7c478bd9Sstevel@tonic-gate <str>"\\"a { cbuf[clen++] = '\007'; } /* your compiler. hence 007 for bell */ 236*7c478bd9Sstevel@tonic-gate <str>"\\\\" { cbuf[clen++] = '\\'; } 237*7c478bd9Sstevel@tonic-gate <str>"\\"({O}{O}{O}|{O}{O}|{O}) { int n; 238*7c478bd9Sstevel@tonic-gate sscanf(yytext+1, "%o", &n); cbuf[clen++] = n; } 239*7c478bd9Sstevel@tonic-gate <str>"\\"x({H}+) { int n; /* ANSI permits any number! */ 240*7c478bd9Sstevel@tonic-gate sscanf(yytext+2, "%x", &n); cbuf[clen++] = n; } 241*7c478bd9Sstevel@tonic-gate <str>"\\". { cbuf[clen++] = yytext[1]; } 242*7c478bd9Sstevel@tonic-gate <str>. { CADD; } 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate %% 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate startreg() 247*7c478bd9Sstevel@tonic-gate { 248*7c478bd9Sstevel@tonic-gate BEGIN reg; 249*7c478bd9Sstevel@tonic-gate clen = 0; 250*7c478bd9Sstevel@tonic-gate } 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate /* input() and unput() are transcriptions of the standard lex 253*7c478bd9Sstevel@tonic-gate macros for input and output with additions for error message 254*7c478bd9Sstevel@tonic-gate printing. God help us all if someone changes how lex works. 255*7c478bd9Sstevel@tonic-gate */ 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate uchar ebuf[300]; 258*7c478bd9Sstevel@tonic-gate uchar *ep = ebuf; 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate input() 261*7c478bd9Sstevel@tonic-gate { 262*7c478bd9Sstevel@tonic-gate register int c; 263*7c478bd9Sstevel@tonic-gate extern uchar *lexprog; 264*7c478bd9Sstevel@tonic-gate 265*7c478bd9Sstevel@tonic-gate if (yysptr > yysbuf) 266*7c478bd9Sstevel@tonic-gate c = U(*--yysptr); 267*7c478bd9Sstevel@tonic-gate else if (lexprog != NULL) /* awk '...' */ 268*7c478bd9Sstevel@tonic-gate c = *lexprog++; 269*7c478bd9Sstevel@tonic-gate else /* awk -f ... */ 270*7c478bd9Sstevel@tonic-gate c = pgetc(); 271*7c478bd9Sstevel@tonic-gate if (c == '\n') 272*7c478bd9Sstevel@tonic-gate yylineno++; 273*7c478bd9Sstevel@tonic-gate else if (c == EOF) 274*7c478bd9Sstevel@tonic-gate c = 0; 275*7c478bd9Sstevel@tonic-gate if (ep >= ebuf + sizeof ebuf) 276*7c478bd9Sstevel@tonic-gate ep = ebuf; 277*7c478bd9Sstevel@tonic-gate return *ep++ = c; 278*7c478bd9Sstevel@tonic-gate } 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate unput(c) 281*7c478bd9Sstevel@tonic-gate { 282*7c478bd9Sstevel@tonic-gate yytchar = c; 283*7c478bd9Sstevel@tonic-gate if (yytchar == '\n') 284*7c478bd9Sstevel@tonic-gate yylineno--; 285*7c478bd9Sstevel@tonic-gate *yysptr++ = yytchar; 286*7c478bd9Sstevel@tonic-gate if (--ep < ebuf) 287*7c478bd9Sstevel@tonic-gate ep = ebuf + sizeof(ebuf) - 1; 288*7c478bd9Sstevel@tonic-gate } 289*7c478bd9Sstevel@tonic-gate 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate unputstr(s) 292*7c478bd9Sstevel@tonic-gate char *s; 293*7c478bd9Sstevel@tonic-gate { 294*7c478bd9Sstevel@tonic-gate int i; 295*7c478bd9Sstevel@tonic-gate 296*7c478bd9Sstevel@tonic-gate for (i = strlen(s)-1; i >= 0; i--) 297*7c478bd9Sstevel@tonic-gate unput(s[i]); 298*7c478bd9Sstevel@tonic-gate } 299