]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/i4b/isdnd/rc_scan.l
This commit was generated by cvs2svn to compensate for changes in r51415,
[FreeBSD/FreeBSD.git] / usr.sbin / i4b / isdnd / rc_scan.l
1 /*
2  *   Copyright (c) 1997 Joerg Wunsch. All rights reserved.
3  *
4  *   Copyright (c) 1997, 1999 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: [Thu May 20 14:04:13 1999]
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 alert                           { return ALERT; }
91 aliasing                        { return ALIASING; }
92 aliasfile                       { return ALIASFNAME; }
93 answerprog                      { return ANSWERPROG; }
94 b1protocol                      { return B1PROTOCOL; }
95 beepconnect                     { return BEEPCONNECT; }
96 callbackwait                    { return CALLBACKWAIT; }
97 calledbackwait                  { return CALLEDBACKWAIT; }
98 connectprog                     { return CONNECTPROG; }
99 dialin-reaction                 { return REACTION; }
100 dialout-type                    { return DIALOUTTYPE; }
101 dialrandincr                    { return DIALRANDINCR; }
102 dialretries                     { return DIALRETRIES; }
103 direction                       { return DIRECTION; }
104 disconnectprog                  { return DISCONNECTPROG; }
105 downtries                       { return DOWNTRIES; }
106 downtime                        { return DOWNTIME; }
107 earlyhangup                     { return EARLYHANGUP; }
108 entry                           { return ENTRY; }
109 idletime-incoming               { return IDLETIME_IN; }
110 idletime-outgoing               { return IDLETIME_OUT; }
111 idle-algorithm-outgoing         { return IDLE_ALG_OUT; }
112 isdncontroller                  { return ISDNCONTROLLER; }
113 isdnchannel                     { return ISDNCHANNEL; }
114 isdntime                        { return ISDNTIME; }
115 isdntxdel-incoming              { return ISDNTXDELIN; }
116 isdntxdel-outgoing              { return ISDNTXDELOUT; }
117 local-phone-dialout             { return LOCAL_PHONE_DIALOUT; }
118 local-phone-incoming            { return LOCAL_PHONE_INCOMING; }
119 monitor-allowed                 { return MONITORSW; }
120 monitor-port                    { return MONITORPORT; }
121 monitor                         { return MONITOR; }
122 monitor-access                  { return MONITORACCESS; }
123 fullcmd                         { return FULLCMD; }
124 restrictedcmd                   { return RESTRICTEDCMD; }
125 channelstate                    { return CHANNELSTATE; }
126 callin                          { return CALLIN; }
127 callout                         { return CALLOUT; }
128 logevents                       { return LOGEVENTS; }
129 name                            { return NAME; }
130 no                              { return NO; }
131 off                             { return OFF; }
132 on                              { return ON; }
133 ratesfile                       { return RATESFILE; }
134 ratetype                        { return RATETYPE; }
135 recoverytime                    { return RECOVERYTIME; }
136 regexpr                         { return REGEXPR; }
137 regprog                         { return REGPROG; }
138 remdial-handling                { return REMOTE_NUMBERS_HANDLING; }
139 remote-phone-dialout            { return REMOTE_PHONE_DIALOUT; }
140 remote-phone-incoming           { return REMOTE_PHONE_INCOMING; }
141 rotatesuffix                    { return ROTATESUFFIX; }
142 rtprio                          { return RTPRIO; }
143 system                          { return SYSTEM; }
144 tinainitprog                    { return TINAINITPROG; }
145 unitlength                      { return UNITLENGTH; }
146 unitlengthsrc                   { return UNITLENGTHSRC; }
147 useacctfile                     { return USEACCTFILE; }
148 usrdevicename                   { return USRDEVICENAME; }
149 usrdeviceunit                   { return USRDEVICEUNIT; }
150 usedown                         { return USEDOWN; }
151 yes                             { return YES; }
152
153 \n                              { lineno++; return '\n'; }
154
155 [A-Za-z/.][-A-Za-z0-9_/.]*      {
156                                 char *str;
157                                 if ((str = strdup(yytext)) == 0)
158                                         err(EX_OSERR, "Out of virtual memory");
159                                 yylval.str = str;
160                                 return STRING;
161                                 }
162
163 [ \t]                           { /* drop white space */ }
164
165 .                               { return yytext[0]; }
166
167 %%
168
169 void
170 reset_scanner(FILE *infile)
171 {
172         yyrestart(infile);
173         lineno = 1;
174 }