Sync usage with man page.
[netbsd-mini2440.git] / usr.sbin / isdn / isdnd / rc_scan.l
blob2de775030229e5c77de4d7009b9f3dfad4fcccd0
1 /*
2  *   Copyright (c) 1997 Joerg Wunsch. All rights reserved.
3  *
4  *   Copyright (c) 1997, 2000 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.7 2009/10/29 14:39:24 christos Exp $ 
34  *
35  * $FreeBSD$
36  *
37  *      last edit-date: [Mon Oct  2 22:49:40 2000]
38  *
39  *---------------------------------------------------------------------------*/
43 #include <err.h>
44 #include <stdlib.h>
45 #include <stdio.h>
46 #include <string.h>
47 #include <ctype.h>
48 #include <sysexits.h>
50 #include "rc_parse.h"
52 int lineno;
53 void reset_scanner(FILE *infile);
54 int yylex(void);
58 %option noyywrap nounput noinput
62 #.*$                            { /*
63                                    * Drop comment.  NB: this prevents a hash
64                                    * sign from appearing inside a quoted string.
65                                    */
66                                 }
68 ["][^"]*["]                     {
69                                 char *str;
70                                 if ((str = malloc(yyleng - 1)) == 0)
71                                         errx(EX_OSERR, "Out of virtual memory");
72                                 memcpy(str, yytext + 1, yyleng - 2);
73                                 str[yyleng - 2] = 0;
74                                 yylval.str = str;
75                                 return STRING;
76                                 }
78 (-*[0-9]+)|\*                   {
79                                 char *str;
80                                 char *p = yytext;
81                                 int i = 0;
82                                 if ((str = malloc(128)) == 0)
83                                         errx(EX_OSERR, "Out of virtual memory");
84                                 while(*p == '-' || isdigit((unsigned char)*p) || *p == '*')
85                                         str[i++] = *p++;
86                                 str[i] = '\0';
87                                 yylval.str = str;
88                                 return NUMBERSTR;
89                                 }
91 acctall                         { return ACCTALL; }
92 acctfile                        { return ACCTFILE; }
93 alert                           { return ALERT; }
94 aliasing                        { return ALIASING; }
95 aliasfile                       { return ALIASFNAME; }
96 answerprog                      { return ANSWERPROG; }
97 autoupdown                      { return AUTOUPDOWN; }
98 b1protocol                      { return B1PROTOCOL; }
99 beepconnect                     { return BEEPCONNECT; }
100 budget-callbackperiod           { return BUDGETCALLBACKPERIOD; }
101 budget-callbackncalls           { return BUDGETCALLBACKNCALLS; }
102 budget-callbacksfile            { return BUDGETCALLBACKSFILE; }
103 budget-callbacksfile-rotate     { return BUDGETCALLBACKSFILEROTATE; }
104 budget-calloutperiod            { return BUDGETCALLOUTPERIOD; }
105 budget-calloutncalls            { return BUDGETCALLOUTNCALLS; }
106 budget-calloutsfile             { return BUDGETCALLOUTSFILE; }
107 budget-calloutsfile-rotate      { return BUDGETCALLOUTSFILEROTATE; }
108 callbackwait                    { return CALLBACKWAIT; }
109 calledbackwait                  { return CALLEDBACKWAIT; }
110 connectprog                     { return CONNECTPROG; }
111 controller                      { return CONTROLLER; }
112 dialin-reaction                 { return REACTION; }
113 dialout-type                    { return DIALOUTTYPE; }
114 dialrandincr                    { return DIALRANDINCR; }
115 dialretries                     { return DIALRETRIES; }
116 direction                       { return DIRECTION; }
117 disconnectprog                  { return DISCONNECTPROG; }
118 downtries                       { return DOWNTRIES; }
119 downtime                        { return DOWNTIME; }
120 earlyhangup                     { return EARLYHANGUP; }
121 entry                           { return ENTRY; }
122 extcallattr                     { return EXTCALLATTR; }
123 firmware                        { return FIRMWARE; }
124 holidayfile                     { return HOLIDAYFILE; }
125 idletime-incoming               { return IDLETIME_IN; }
126 idletime-outgoing               { return IDLETIME_OUT; }
127 idle-algorithm-outgoing         { return IDLE_ALG_OUT; }
128 isdncontroller                  { return ISDNCONTROLLER; }
129 isdnchannel                     { return ISDNCHANNEL; }
130 isdntime                        { return ISDNTIME; }
131 isdntxdel-incoming              { return ISDNTXDELIN; }
132 isdntxdel-outgoing              { return ISDNTXDELOUT; }
133 local-phone-dialout             { return LOCAL_PHONE_DIALOUT; }
134 local-phone-incoming            { return LOCAL_PHONE_INCOMING; }
135 mailer                          { return MAILER; }
136 mailto                          { return MAILTO; }
137 monitor-allowed                 { return MONITORSW; }
138 monitor-port                    { return MONITORPORT; }
139 monitor                         { return MONITOR; }
140 monitor-access                  { return MONITORACCESS; }
141 fullcmd                         { return FULLCMD; }
142 restrictedcmd                   { return RESTRICTEDCMD; }
143 channelstate                    { return CHANNELSTATE; }
144 callin                          { return CALLIN; }
145 callout                         { return CALLOUT; }
146 logevents                       { return LOGEVENTS; }
147 name                            { return NAME; }
148 no                              { return NO; }
149 off                             { return OFF; }
150 on                              { return ON; }
151 ppp-auth-rechallenge            { return PPP_AUTH_RECHALLENGE; }
152 ppp-auth-paranoid               { return PPP_AUTH_PARANOID; }
153 ppp-expect-auth                 { return PPP_EXPECT_AUTH; }
154 ppp-expect-name                 { return PPP_EXPECT_NAME; }
155 ppp-expect-password             { return PPP_EXPECT_PASSWORD; }
156 ppp-send-auth                   { return PPP_SEND_AUTH; }
157 ppp-send-name                   { return PPP_SEND_NAME; }
158 ppp-send-password               { return PPP_SEND_PASSWORD; }
159 protocol                        { return PROTOCOL; }
160 ratesfile                       { return RATESFILE; }
161 ratetype                        { return RATETYPE; }
162 recoverytime                    { return RECOVERYTIME; }
163 regexpr                         { return REGEXPR; }
164 regprog                         { return REGPROG; }
165 remdial-handling                { return REMOTE_NUMBERS_HANDLING; }
166 remote-phone-dialout            { return REMOTE_PHONE_DIALOUT; }
167 remote-phone-incoming           { return REMOTE_PHONE_INCOMING; }
168 rotatesuffix                    { return ROTATESUFFIX; }
169 rtprio                          { return RTPRIO; }
170 system                          { return SYSTEM; }
171 tinainitprog                    { return TINAINITPROG; }
172 unitlength                      { return UNITLENGTH; }
173 unitlengthsrc                   { return UNITLENGTHSRC; }
174 useacctfile                     { return USEACCTFILE; }
175 usrdevicename                   { return USRDEVICENAME; }
176 usrdeviceunit                   { return USRDEVICEUNIT; }
177 usedown                         { return USEDOWN; }
178 valid                           { return VALID; }
179 yes                             { return YES; }
181 \n                              { lineno++; return '\n'; }
183 [A-Za-z/.][-A-Za-z0-9_/.]*      {
184                                 char *str;
185                                 if ((str = strdup(yytext)) == 0)
186                                         err(EX_OSERR, "Out of virtual memory");
187                                 yylval.str = str;
188                                 return STRING;
189                                 }
191 [ \t]                           { /* drop white space */ }
193 .                               { return yytext[0]; }
197 void
198 reset_scanner(FILE *infile)
200         yyrestart(infile);
201         lineno = 1;