]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - usr.sbin/i4b/isdnd/rc_scan.l
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / usr.sbin / i4b / isdnd / rc_scan.l
1 /*
2  *   Copyright (c) 1997 Joerg Wunsch. All rights reserved.
3  *
4  *   Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *   1. Redistributions of source code must retain the above copyright
11  *      notice, this list of conditions and the following disclaimer.
12  *   2. Redistributions in binary form must reproduce the above copyright
13  *      notice, this list of conditions and the following disclaimer in the
14  *      documentation and/or other materials provided with the distribution.
15  *   
16  *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  *   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  *   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  *   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  *   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  *   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  *   SUCH DAMAGE.
27  *
28  *---------------------------------------------------------------------------
29  *
30  *      i4b daemon - runtime configuration lexical analyzer
31  *      ---------------------------------------------------
32  *
33  * $FreeBSD$
34  *
35  *      last edit-date: [Sun Aug 11 12:27:50 2002]
36  *
37  *---------------------------------------------------------------------------*/
38
39 %{
40
41 #include <err.h>
42 #include <stdlib.h>
43 #include <stdio.h>
44 #include <string.h>
45 #include <ctype.h>
46 #include <sysexits.h>
47
48 #include "y.tab.h"
49
50 int lineno;
51
52 %}
53
54 %option noyywrap
55 %option nounput
56
57 %%
58
59 #.*$                            { /*
60                                    * Drop comment.  NB: this prevents a hash
61                                    * sign from appearing inside a quoted string.
62                                    */
63                                 }
64
65 ["][^"]*["]                     {
66                                 char *str;
67                                 if ((str = malloc(yyleng - 1)) == 0)
68                                         errx(EX_OSERR, "Out of virtual memory");
69                                 memcpy(str, yytext + 1, yyleng - 2);
70                                 str[yyleng - 2] = 0;
71                                 yylval.str = str;
72                                 return STRING;
73                                 }
74
75 (-*[0-9]+)|\*                   {
76                                 char *str;
77                                 char *p = yytext;
78                                 int i = 0;
79                                 if ((str = malloc(128)) == 0)
80                                         errx(EX_OSERR, "Out of virtual memory");
81                                 while(*p == '-' || isdigit(*p) || *p == '*')
82                                         str[i++] = *p++;
83                                 str[i] = '\0';
84                                 yylval.str = str;
85                                 return NUMBERSTR;
86                                 }
87
88 acctall                         { return ACCTALL; }
89 acctfile                        { return ACCTFILE; }
90 add-prefix                      { return ADDPREFIX; }
91 alert                           { return ALERT; }
92 aliasing                        { return ALIASING; }
93 aliasfile                       { return ALIASFNAME; }
94 answerprog                      { return ANSWERPROG; }
95 b1protocol                      { return B1PROTOCOL; }
96 bcap                            { return BCAP; }
97 beepconnect                     { return BEEPCONNECT; }
98 budget-callbackperiod           { return BUDGETCALLBACKPERIOD; }
99 budget-callbackncalls           { return BUDGETCALLBACKNCALLS; }
100 budget-callbacksfile            { return BUDGETCALLBACKSFILE; }
101 budget-callbacksfile-rotate     { return BUDGETCALLBACKSFILEROTATE; }
102 budget-calloutperiod            { return BUDGETCALLOUTPERIOD; }
103 budget-calloutncalls            { return BUDGETCALLOUTNCALLS; }
104 budget-calloutsfile             { return BUDGETCALLOUTSFILE; }
105 budget-calloutsfile-rotate      { return BUDGETCALLOUTSFILEROTATE; }
106 callbackwait                    { return CALLBACKWAIT; }
107 calledbackwait                  { return CALLEDBACKWAIT; }
108 clone                           { return CLONE; }
109 connectprog                     { return CONNECTPROG; }
110 controller                      { return CONTROLLER; }
111 dialin-reaction                 { return REACTION; }
112 dialout-type                    { return DIALOUTTYPE; }
113 dialrandincr                    { return DIALRANDINCR; }
114 dialretries                     { return DIALRETRIES; }
115 direction                       { return DIRECTION; }
116 disconnectprog                  { return DISCONNECTPROG; }
117 downtries                       { return DOWNTRIES; }
118 downtime                        { return DOWNTIME; }
119 earlyhangup                     { return EARLYHANGUP; }
120 entry                           { return ENTRY; }
121 extcallattr                     { return EXTCALLATTR; }
122 firmware                        { return FIRMWARE; }
123 holidayfile                     { return HOLIDAYFILE; }
124 idletime-incoming               { return IDLETIME_IN; }
125 idletime-outgoing               { return IDLETIME_OUT; }
126 idle-algorithm-outgoing         { return IDLE_ALG_OUT; }
127 isdncontroller                  { return ISDNCONTROLLER; }
128 isdnchannel                     { return ISDNCHANNEL; }
129 isdntime                        { return ISDNTIME; }
130 isdntxdel-incoming              { return ISDNTXDELIN; }
131 isdntxdel-outgoing              { return ISDNTXDELOUT; }
132 local-phone-dialout             { return LOCAL_PHONE_DIALOUT; }
133 local-subaddr-dialout           { return LOCAL_SUBADDR_DIALOUT; }
134 local-phone-incoming            { return LOCAL_PHONE_INCOMING; }
135 local-subaddr-incoming          { return LOCAL_SUBADDR_INCOMING; }
136 mailer                          { return MAILER; }
137 mailto                          { return MAILTO; }
138 maxconnecttime                  { return MAXCONNECTTIME; }
139 monitor-allowed                 { return MONITORSW; }
140 monitor-port                    { return MONITORPORT; }
141 monitor                         { return MONITOR; }
142 monitor-access                  { return MONITORACCESS; }
143 fullcmd                         { return FULLCMD; }
144 restrictedcmd                   { return RESTRICTEDCMD; }
145 channelstate                    { return CHANNELSTATE; }
146 callin                          { return CALLIN; }
147 callout                         { return CALLOUT; }
148 logevents                       { return LOGEVENTS; }
149 name                            { return NAME; }
150 no                              { return NO; }
151 off                             { return OFF; }
152 on                              { return ON; }
153 ppp-auth-rechallenge            { return PPP_AUTH_RECHALLENGE; }
154 ppp-auth-paranoid               { return PPP_AUTH_PARANOID; }
155 ppp-expect-auth                 { return PPP_EXPECT_AUTH; }
156 ppp-expect-name                 { return PPP_EXPECT_NAME; }
157 ppp-expect-password             { return PPP_EXPECT_PASSWORD; }
158 ppp-send-auth                   { return PPP_SEND_AUTH; }
159 ppp-send-name                   { return PPP_SEND_NAME; }
160 ppp-send-password               { return PPP_SEND_PASSWORD; }
161 prefix-international            { return PREFIXINTERNATIONAL; }
162 prefix-national                 { return PREFIXNATIONAL; }
163 protocol                        { return PROTOCOL; }
164 ratesfile                       { return RATESFILE; }
165 ratetype                        { return RATETYPE; }
166 recoverytime                    { return RECOVERYTIME; }
167 regexpr                         { return REGEXPR; }
168 regprog                         { return REGPROG; }
169 remdial-handling                { return REMOTE_NUMBERS_HANDLING; }
170 remote-phone-dialout            { return REMOTE_PHONE_DIALOUT; }
171 remote-subaddr-dialout          { return REMOTE_SUBADDR_DIALOUT; }
172 remote-phone-incoming           { return REMOTE_PHONE_INCOMING; }
173 remote-subaddr-incoming         { return REMOTE_SUBADDR_INCOMING; }
174 rotatesuffix                    { return ROTATESUFFIX; }
175 rtprio                          { return RTPRIO; }
176 system                          { return SYSTEM; }
177 tinainitprog                    { return TINAINITPROG; }
178 unitlength                      { return UNITLENGTH; }
179 unitlengthsrc                   { return UNITLENGTHSRC; }
180 useacctfile                     { return USEACCTFILE; }
181 usesubaddr                      { return USESUBADDR; }
182 usrdevicename                   { return USRDEVICENAME; }
183 usrdeviceunit                   { return USRDEVICEUNIT; }
184 usedown                         { return USEDOWN; }
185 valid                           { return VALID; }
186 yes                             { return YES; }
187
188 \n                              { lineno++; return '\n'; }
189
190 [A-Za-z/.][-A-Za-z0-9_/.]*      {
191                                 char *str;
192                                 if ((str = strdup(yytext)) == 0)
193                                         err(EX_OSERR, "Out of virtual memory");
194                                 yylval.str = str;
195                                 return STRING;
196                                 }
197
198 [ \t]                           { /* drop white space */ }
199
200 .                               { return yytext[0]; }
201
202 %%
203
204 void
205 reset_scanner(FILE *infile)
206 {
207         yyrestart(infile);
208         lineno = 1;
209 }