1998-12-27 21:47:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
|
|
|
|
*
|
2002-03-26 15:13:54 +00:00
|
|
|
* Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* i4b daemon - runtime configuration lexical analyzer
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*
|
1999-12-14 21:14:28 +00:00
|
|
|
* $FreeBSD$
|
|
|
|
*
|
2002-08-11 15:47:26 +00:00
|
|
|
* last edit-date: [Sun Aug 11 12:27:50 2002]
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
|
|
|
#include <err.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sysexits.h>
|
|
|
|
|
|
|
|
#include "y.tab.h"
|
|
|
|
|
|
|
|
int lineno;
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
%option noyywrap
|
|
|
|
%option nounput
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
#.*$ { /*
|
|
|
|
* Drop comment. NB: this prevents a hash
|
|
|
|
* sign from appearing inside a quoted string.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
["][^"]*["] {
|
|
|
|
char *str;
|
|
|
|
if ((str = malloc(yyleng - 1)) == 0)
|
|
|
|
errx(EX_OSERR, "Out of virtual memory");
|
|
|
|
memcpy(str, yytext + 1, yyleng - 2);
|
|
|
|
str[yyleng - 2] = 0;
|
|
|
|
yylval.str = str;
|
|
|
|
return STRING;
|
|
|
|
}
|
|
|
|
|
|
|
|
(-*[0-9]+)|\* {
|
|
|
|
char *str;
|
|
|
|
char *p = yytext;
|
|
|
|
int i = 0;
|
|
|
|
if ((str = malloc(128)) == 0)
|
|
|
|
errx(EX_OSERR, "Out of virtual memory");
|
|
|
|
while(*p == '-' || isdigit(*p) || *p == '*')
|
|
|
|
str[i++] = *p++;
|
|
|
|
str[i] = '\0';
|
|
|
|
yylval.str = str;
|
|
|
|
return NUMBERSTR;
|
|
|
|
}
|
|
|
|
|
|
|
|
acctall { return ACCTALL; }
|
|
|
|
acctfile { return ACCTFILE; }
|
2002-08-12 07:53:55 +00:00
|
|
|
add-prefix { return ADDPREFIX; }
|
1998-12-27 21:47:14 +00:00
|
|
|
alert { return ALERT; }
|
|
|
|
aliasing { return ALIASING; }
|
|
|
|
aliasfile { return ALIASFNAME; }
|
|
|
|
answerprog { return ANSWERPROG; }
|
|
|
|
b1protocol { return B1PROTOCOL; }
|
2002-08-11 15:47:26 +00:00
|
|
|
bcap { return BCAP; }
|
1999-03-07 16:12:47 +00:00
|
|
|
beepconnect { return BEEPCONNECT; }
|
2000-10-09 14:22:51 +00:00
|
|
|
budget-callbackperiod { return BUDGETCALLBACKPERIOD; }
|
|
|
|
budget-callbackncalls { return BUDGETCALLBACKNCALLS; }
|
|
|
|
budget-callbacksfile { return BUDGETCALLBACKSFILE; }
|
|
|
|
budget-callbacksfile-rotate { return BUDGETCALLBACKSFILEROTATE; }
|
|
|
|
budget-calloutperiod { return BUDGETCALLOUTPERIOD; }
|
|
|
|
budget-calloutncalls { return BUDGETCALLOUTNCALLS; }
|
|
|
|
budget-calloutsfile { return BUDGETCALLOUTSFILE; }
|
|
|
|
budget-calloutsfile-rotate { return BUDGETCALLOUTSFILEROTATE; }
|
1998-12-27 21:47:14 +00:00
|
|
|
callbackwait { return CALLBACKWAIT; }
|
|
|
|
calledbackwait { return CALLEDBACKWAIT; }
|
2001-05-25 08:43:30 +00:00
|
|
|
clone { return CLONE; }
|
1998-12-27 21:47:14 +00:00
|
|
|
connectprog { return CONNECTPROG; }
|
1999-12-14 21:14:28 +00:00
|
|
|
controller { return CONTROLLER; }
|
1998-12-27 21:47:14 +00:00
|
|
|
dialin-reaction { return REACTION; }
|
|
|
|
dialout-type { return DIALOUTTYPE; }
|
|
|
|
dialrandincr { return DIALRANDINCR; }
|
|
|
|
dialretries { return DIALRETRIES; }
|
|
|
|
direction { return DIRECTION; }
|
|
|
|
disconnectprog { return DISCONNECTPROG; }
|
|
|
|
downtries { return DOWNTRIES; }
|
|
|
|
downtime { return DOWNTIME; }
|
|
|
|
earlyhangup { return EARLYHANGUP; }
|
|
|
|
entry { return ENTRY; }
|
2000-10-09 14:22:51 +00:00
|
|
|
extcallattr { return EXTCALLATTR; }
|
2001-05-25 08:43:30 +00:00
|
|
|
firmware { return FIRMWARE; }
|
2000-10-09 14:22:51 +00:00
|
|
|
holidayfile { return HOLIDAYFILE; }
|
1998-12-27 21:47:14 +00:00
|
|
|
idletime-incoming { return IDLETIME_IN; }
|
|
|
|
idletime-outgoing { return IDLETIME_OUT; }
|
1999-03-07 16:12:47 +00:00
|
|
|
idle-algorithm-outgoing { return IDLE_ALG_OUT; }
|
1998-12-27 21:47:14 +00:00
|
|
|
isdncontroller { return ISDNCONTROLLER; }
|
|
|
|
isdnchannel { return ISDNCHANNEL; }
|
|
|
|
isdntime { return ISDNTIME; }
|
|
|
|
isdntxdel-incoming { return ISDNTXDELIN; }
|
|
|
|
isdntxdel-outgoing { return ISDNTXDELOUT; }
|
|
|
|
local-phone-dialout { return LOCAL_PHONE_DIALOUT; }
|
2002-03-26 15:13:54 +00:00
|
|
|
local-subaddr-dialout { return LOCAL_SUBADDR_DIALOUT; }
|
1998-12-27 21:47:14 +00:00
|
|
|
local-phone-incoming { return LOCAL_PHONE_INCOMING; }
|
2002-03-26 15:13:54 +00:00
|
|
|
local-subaddr-incoming { return LOCAL_SUBADDR_INCOMING; }
|
1999-12-14 21:14:28 +00:00
|
|
|
mailer { return MAILER; }
|
|
|
|
mailto { return MAILTO; }
|
2001-07-21 11:29:40 +00:00
|
|
|
maxconnecttime { return MAXCONNECTTIME; }
|
1998-12-27 21:47:14 +00:00
|
|
|
monitor-allowed { return MONITORSW; }
|
|
|
|
monitor-port { return MONITORPORT; }
|
|
|
|
monitor { return MONITOR; }
|
|
|
|
monitor-access { return MONITORACCESS; }
|
|
|
|
fullcmd { return FULLCMD; }
|
|
|
|
restrictedcmd { return RESTRICTEDCMD; }
|
|
|
|
channelstate { return CHANNELSTATE; }
|
|
|
|
callin { return CALLIN; }
|
|
|
|
callout { return CALLOUT; }
|
|
|
|
logevents { return LOGEVENTS; }
|
|
|
|
name { return NAME; }
|
|
|
|
no { return NO; }
|
|
|
|
off { return OFF; }
|
|
|
|
on { return ON; }
|
2000-10-09 14:22:51 +00:00
|
|
|
ppp-auth-rechallenge { return PPP_AUTH_RECHALLENGE; }
|
|
|
|
ppp-auth-paranoid { return PPP_AUTH_PARANOID; }
|
|
|
|
ppp-expect-auth { return PPP_EXPECT_AUTH; }
|
|
|
|
ppp-expect-name { return PPP_EXPECT_NAME; }
|
2001-01-10 09:41:42 +00:00
|
|
|
ppp-expect-password { return PPP_EXPECT_PASSWORD; }
|
2000-10-09 14:22:51 +00:00
|
|
|
ppp-send-auth { return PPP_SEND_AUTH; }
|
|
|
|
ppp-send-name { return PPP_SEND_NAME; }
|
|
|
|
ppp-send-password { return PPP_SEND_PASSWORD; }
|
2002-08-12 07:53:55 +00:00
|
|
|
prefix-international { return PREFIXINTERNATIONAL; }
|
|
|
|
prefix-national { return PREFIXNATIONAL; }
|
1999-12-14 21:14:28 +00:00
|
|
|
protocol { return PROTOCOL; }
|
1998-12-27 21:47:14 +00:00
|
|
|
ratesfile { return RATESFILE; }
|
|
|
|
ratetype { return RATETYPE; }
|
|
|
|
recoverytime { return RECOVERYTIME; }
|
|
|
|
regexpr { return REGEXPR; }
|
|
|
|
regprog { return REGPROG; }
|
|
|
|
remdial-handling { return REMOTE_NUMBERS_HANDLING; }
|
|
|
|
remote-phone-dialout { return REMOTE_PHONE_DIALOUT; }
|
2002-03-26 15:13:54 +00:00
|
|
|
remote-subaddr-dialout { return REMOTE_SUBADDR_DIALOUT; }
|
1998-12-27 21:47:14 +00:00
|
|
|
remote-phone-incoming { return REMOTE_PHONE_INCOMING; }
|
2002-03-26 15:13:54 +00:00
|
|
|
remote-subaddr-incoming { return REMOTE_SUBADDR_INCOMING; }
|
1999-08-06 14:05:10 +00:00
|
|
|
rotatesuffix { return ROTATESUFFIX; }
|
1998-12-27 21:47:14 +00:00
|
|
|
rtprio { return RTPRIO; }
|
|
|
|
system { return SYSTEM; }
|
1999-05-20 10:14:57 +00:00
|
|
|
tinainitprog { return TINAINITPROG; }
|
1998-12-27 21:47:14 +00:00
|
|
|
unitlength { return UNITLENGTH; }
|
|
|
|
unitlengthsrc { return UNITLENGTHSRC; }
|
|
|
|
useacctfile { return USEACCTFILE; }
|
2002-03-26 15:13:54 +00:00
|
|
|
usesubaddr { return USESUBADDR; }
|
1998-12-27 21:47:14 +00:00
|
|
|
usrdevicename { return USRDEVICENAME; }
|
|
|
|
usrdeviceunit { return USRDEVICEUNIT; }
|
|
|
|
usedown { return USEDOWN; }
|
2000-10-09 14:22:51 +00:00
|
|
|
valid { return VALID; }
|
1998-12-27 21:47:14 +00:00
|
|
|
yes { return YES; }
|
|
|
|
|
|
|
|
\n { lineno++; return '\n'; }
|
|
|
|
|
|
|
|
[A-Za-z/.][-A-Za-z0-9_/.]* {
|
|
|
|
char *str;
|
|
|
|
if ((str = strdup(yytext)) == 0)
|
|
|
|
err(EX_OSERR, "Out of virtual memory");
|
|
|
|
yylval.str = str;
|
|
|
|
return STRING;
|
|
|
|
}
|
|
|
|
|
|
|
|
[ \t] { /* drop white space */ }
|
|
|
|
|
|
|
|
. { return yytext[0]; }
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
void
|
|
|
|
reset_scanner(FILE *infile)
|
|
|
|
{
|
|
|
|
yyrestart(infile);
|
|
|
|
lineno = 1;
|
|
|
|
}
|