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