reject.c (3360B)
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 /* Copyright (c) 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 26 /* from OpenSolaris "reject.c 6.10 05/06/08 SMI" */ 27 28 /* 29 * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany 30 * 31 * Sccsid @(#)reject.c 1.4 (gritter) 11/27/05 32 */ 33 34 #include <stdio.h> 35 36 #ifdef EUC 37 #ifdef __sun 38 #include <euc.h> 39 #include <widec.h> 40 #else /* !sun */ 41 #include <wchar.h> 42 #endif /* !sun */ 43 #include <limits.h> 44 #endif 45 46 47 #ifndef JLSLEX 48 49 #define CHR char 50 #define YYTEXT yytext 51 #define YYLENG yyleng 52 #define YYINPUT yyinput 53 #define YYUNPUT yyunput 54 #define YYOUTPUT yyoutput 55 #define YYREJECT yyreject 56 #endif 57 58 #ifdef WOPTION 59 60 #define CHR wchar_t 61 #define YYTEXT yytext 62 #define YYLENG yyleng 63 #define YYINPUT yyinput 64 #define YYUNPUT yyunput 65 #define YYOUTPUT yyoutput 66 #define YYREJECT yyreject_w 67 #endif 68 69 #ifdef EOPTION 70 71 #define CHR wchar_t 72 #define YYTEXT yywtext 73 #define YYLENG yywleng 74 #define YYINPUT yywinput 75 #define YYUNPUT yywunput 76 #define YYOUTPUT yywoutput 77 #define YYREJECT yyreject_e 78 extern unsigned char yytext[]; 79 extern int yyleng; 80 #endif 81 82 #if defined(__cplusplus) || defined(__STDC__) 83 extern int yyback(int *, int); 84 extern int YYINPUT(void); 85 extern void YYUNPUT(int); 86 #ifdef EUC 87 static int yyracc(int); 88 #else 89 extern int yyracc(int); 90 #endif 91 #ifdef EOPTION 92 extern size_t wcstombs(char *, const wchar_t *, size_t); 93 #endif 94 #endif 95 96 extern FILE *yyout, *yyin; 97 98 extern int yyprevious, *yyfnd; 99 100 extern char yyextra[]; 101 102 extern int YYLENG; 103 extern CHR YYTEXT[]; 104 105 extern struct {int *yyaa, *yybb; int *yystops; } *yylstate[], **yylsp, **yyolsp; 106 #if defined(__cplusplus) || defined(__STDC__) 107 int 108 YYREJECT(void) 109 #else 110 YYREJECT() 111 #endif 112 { 113 for (; yylsp < yyolsp; yylsp++) 114 YYTEXT[YYLENG++] = YYINPUT(); 115 if (*yyfnd > 0) 116 return (yyracc(*yyfnd++)); 117 while (yylsp-- > yylstate) { 118 YYUNPUT(YYTEXT[YYLENG-1]); 119 YYTEXT[--YYLENG] = 0; 120 if (*yylsp != 0 && (yyfnd = (*yylsp)->yystops) && *yyfnd > 0) 121 return (yyracc(*yyfnd++)); 122 } 123 #ifdef EOPTION 124 yyleng = wcstombs((char *)yytext, YYTEXT, YYLENG*MB_LEN_MAX); 125 #endif 126 if (YYTEXT[0] == 0) 127 return (0); 128 YYLENG = 0; 129 #ifdef EOPTION 130 yyleng = 0; 131 #endif 132 return (-1); 133 } 134 135 #ifdef EUC 136 static 137 #endif 138 #if defined(__cplusplus) || defined(__STDC__) 139 int 140 yyracc(int m) 141 #else 142 yyracc(m) 143 #endif 144 { 145 yyolsp = yylsp; 146 if (yyextra[m]) { 147 while (yyback((*yylsp)->yystops, -m) != 1 && yylsp > yylstate) { 148 yylsp--; 149 YYUNPUT(YYTEXT[--YYLENG]); 150 } 151 } 152 yyprevious = YYTEXT[YYLENG-1]; 153 YYTEXT[YYLENG] = 0; 154 #ifdef EOPTION 155 yyleng = wcstombs((char *)yytext, YYTEXT, YYLENG*MB_LEN_MAX); 156 #endif 157 return (m); 158 }