]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/i4b/isdnd/rc_scan.l
unfinished sblive driver, playback/mixer only for now - not enabled in
[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  *      $Id: rc_scan.l,v 1.27 1999/12/13 21:25:25 hm Exp $ 
34  *
35  * $FreeBSD$
36  *
37  *      last edit-date: [Mon Dec 13 21:48:57 1999]
38  *
39  *---------------------------------------------------------------------------*/
40
41 %{
42
43 #include <err.h>
44 #include <stdlib.h>
45 #include <stdio.h>
46 #include <string.h>
47 #include <ctype.h>
48 #include <sysexits.h>
49
50 #include "y.tab.h"
51
52 int lineno;
53
54 %}
55
56 %option noyywrap
57 %option nounput
58
59 %%
60
61 #.*$                            { /*
62                                    * Drop comment.  NB: this prevents a hash
63                                    * sign from appearing inside a quoted string.
64                                    */
65                                 }
66
67 ["][^"]*["]                     {
68                                 char *str;
69                                 if ((str = malloc(yyleng - 1)) == 0)
70                                         errx(EX_OSERR, "Out of virtual memory");
71                                 memcpy(str, yytext + 1, yyleng - 2);
72                                 str[yyleng - 2] = 0;
73                                 yylval.str = str;
74                                 return STRING;
75                                 }
76
77 (-*[0-9]+)|\*                   {
78                                 char *str;
79                                 char *p = yytext;
80                                 int i = 0;
81                                 if ((str = malloc(128)) == 0)
82                                         errx(EX_OSERR, "Out of virtual memory");
83                                 while(*p == '-' || isdigit(*p) || *p == '*')
84                                         str[i++] = *p++;
85                                 str[i] = '\0';
86                                 yylval.str = str;
87                                 return NUMBERSTR;
88                                 }
89
90 acctall                         { return ACCTALL; }
91 acctfile                        { return ACCTFILE; }
92 alert                           { return ALERT; }
93 aliasing                        { return ALIASING; }
94 aliasfile                       { return ALIASFNAME; }
95 answerprog                      { return ANSWERPROG; }
96 b1protocol                      { return B1PROTOCOL; }
97 beepconnect                     { return BEEPCONNECT; }
98 callbackwait                    { return CALLBACKWAIT; }
99 calledbackwait                  { return CALLEDBACKWAIT; }
100 connectprog                     { return CONNECTPROG; }
101 controller                      { return CONTROLLER; }
102 dialin-reaction                 { return REACTION; }
103 dialout-type                    { return DIALOUTTYPE; }
104 dialrandincr                    { return DIALRANDINCR; }
105 dialretries                     { return DIALRETRIES; }
106 direction                       { return DIRECTION; }
107 disconnectprog                  { return DISCONNECTPROG; }
108 downtries                       { return DOWNTRIES; }
109 downtime                        { return DOWNTIME; }
110 earlyhangup                     { return EARLYHANGUP; }
111 entry                           { return ENTRY; }
112 idletime-incoming               { return IDLETIME_IN; }
113 idletime-outgoing               { return IDLETIME_OUT; }
114 idle-algorithm-outgoing         { return IDLE_ALG_OUT; }
115 isdncontroller                  { return ISDNCONTROLLER; }
116 isdnchannel                     { return ISDNCHANNEL; }
117 isdntime                        { return ISDNTIME; }
118 isdntxdel-incoming              { return ISDNTXDELIN; }
119 isdntxdel-outgoing              { return ISDNTXDELOUT; }
120 local-phone-dialout             { return LOCAL_PHONE_DIALOUT; }
121 local-phone-incoming            { return LOCAL_PHONE_INCOMING; }
122 mailer                          { return MAILER; }
123 mailto                          { return MAILTO; }
124 monitor-allowed                 { return MONITORSW; }
125 monitor-port                    { return MONITORPORT; }
126 monitor                         { return MONITOR; }
127 monitor-access                  { return MONITORACCESS; }
128 fullcmd                         { return FULLCMD; }
129 restrictedcmd                   { return RESTRICTEDCMD; }
130 channelstate                    { return CHANNELSTATE; }
131 callin                          { return CALLIN; }
132 callout                         { return CALLOUT; }
133 logevents                       { return LOGEVENTS; }
134 name                            { return NAME; }
135 no                              { return NO; }
136 off                             { return OFF; }
137 on                              { return ON; }
138 protocol                        { return PROTOCOL; }
139 ratesfile                       { return RATESFILE; }
140 ratetype                        { return RATETYPE; }
141 recoverytime                    { return RECOVERYTIME; }
142 regexpr                         { return REGEXPR; }
143 regprog                         { return REGPROG; }
144 remdial-handling                { return REMOTE_NUMBERS_HANDLING; }
145 remote-phone-dialout            { return REMOTE_PHONE_DIALOUT; }
146 remote-phone-incoming           { return REMOTE_PHONE_INCOMING; }
147 rotatesuffix                    { return ROTATESUFFIX; }
148 rtprio                          { return RTPRIO; }
149 system                          { return SYSTEM; }
150 tinainitprog                    { return TINAINITPROG; }
151 unitlength                      { return UNITLENGTH; }
152 unitlengthsrc                   { return UNITLENGTHSRC; }
153 useacctfile                     { return USEACCTFILE; }
154 usrdevicename                   { return USRDEVICENAME; }
155 usrdeviceunit                   { return USRDEVICEUNIT; }
156 usedown                         { return USEDOWN; }
157 yes                             { return YES; }
158
159 \n                              { lineno++; return '\n'; }
160
161 [A-Za-z/.][-A-Za-z0-9_/.]*      {
162                                 char *str;
163                                 if ((str = strdup(yytext)) == 0)
164                                         err(EX_OSERR, "Out of virtual memory");
165                                 yylval.str = str;
166                                 return STRING;
167                                 }
168
169 [ \t]                           { /* drop white space */ }
170
171 .                               { return yytext[0]; }
172
173 %%
174
175 void
176 reset_scanner(FILE *infile)
177 {
178         yyrestart(infile);
179         lineno = 1;
180 }