2 * Copyright (c) 1997 Joerg Wunsch. All rights reserved.
4 * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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
28 *---------------------------------------------------------------------------
30 * i4b daemon - runtime configuration lexical analyzer
31 * ---------------------------------------------------
33 * $Id: rc_scan.l,v 1.27 1999/12/13 21:25:25 hm Exp $
37 * last edit-date: [Mon Dec 13 21:48:57 1999]
39 *---------------------------------------------------------------------------*/
62 * Drop comment. NB: this prevents a hash
63 * sign from appearing inside a quoted string.
69 if ((str = malloc(yyleng - 1)) == 0)
70 errx(EX_OSERR, "Out of virtual memory");
71 memcpy(str, yytext + 1, yyleng - 2);
81 if ((str = malloc(128)) == 0)
82 errx(EX_OSERR, "Out of virtual memory");
83 while(*p == '-' || isdigit(*p) || *p == '*')
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; }
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; }
159 \n { lineno++; return '\n'; }
161 [A-Za-z/.][-A-Za-z0-9_/.]* {
163 if ((str = strdup(yytext)) == 0)
164 err(EX_OSERR, "Out of virtual memory");
169 [ \t] { /* drop white space */ }
171 . { return yytext[0]; }
176 reset_scanner(FILE *infile)