|
Packit |
8480eb |
%{
|
|
Packit |
8480eb |
/* ----------------------------------------------------------------------- *
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* master_tok.l - master map tokenizer.
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* Copyright 2006 Ian Kent <raven@themaw.net>
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* This program is free software; you can redistribute it and/or modify
|
|
Packit |
8480eb |
* it under the terms of the GNU General Public License as published by
|
|
Packit |
8480eb |
* the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
|
|
Packit |
8480eb |
* USA; either version 2 of the License, or (at your option) any later
|
|
Packit |
8480eb |
* version.
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* This program is distributed in the hope that it will be useful,
|
|
Packit |
8480eb |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
8480eb |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
8480eb |
* GNU General Public License for more details.
|
|
Packit |
8480eb |
*
|
|
Packit |
8480eb |
* ----------------------------------------------------------------------- */
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifdef ECHO
|
|
Packit |
8480eb |
# undef ECHO
|
|
Packit |
8480eb |
#endif /* ECHO */
|
|
Packit |
8480eb |
static void master_echo(void); /* forward definition */
|
|
Packit |
8480eb |
#define ECHO master_echo()
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#include <stdio.h>
|
|
Packit |
8480eb |
#include <stdlib.h>
|
|
Packit |
8480eb |
#include <string.h>
|
|
Packit |
8480eb |
#include <ctype.h>
|
|
Packit |
8480eb |
#include "master_parse.tab.h"
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
/*
|
|
Packit |
8480eb |
* There are some things that need to be defined only if useing GNU flex.
|
|
Packit |
8480eb |
* These must not be defined if using standard lex
|
|
Packit |
8480eb |
*/
|
|
Packit |
8480eb |
#ifdef FLEX_SCANNER
|
|
Packit |
8480eb |
int master_lineno;
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
int master_lex(void);
|
|
Packit |
8480eb |
int master_wrap(void);
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
/* no need for yywrap() */
|
|
Packit |
8480eb |
#define YY_SKIP_YYWRAP
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifndef YY_STACK_USED
|
|
Packit |
8480eb |
#define YY_STACK_USED 0
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
#ifndef YY_ALWAYS_INTERACTIVE
|
|
Packit |
8480eb |
#define YY_ALWAYS_INTERACTIVE 0
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
#ifndef YY_NEVER_INTERACTIVE
|
|
Packit |
8480eb |
#define YY_NEVER_INTERACTIVE 0
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
#ifndef YY_MAIN
|
|
Packit |
8480eb |
#define YY_MAIN 0
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
void master_set_scan_buffer(const char *);
|
|
Packit |
8480eb |
const char *line = NULL;
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifdef FLEX_SCANNER
|
|
Packit |
8480eb |
const char *line_pos = NULL;
|
|
Packit |
8480eb |
const char *line_lim = NULL;
|
|
Packit |
8480eb |
int my_yyinput(char *, int);
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#undef YY_INPUT
|
|
Packit |
8480eb |
#define YY_INPUT(b, r, ms) (r = my_yyinput(b, ms))
|
|
Packit |
8480eb |
#else
|
|
Packit |
8480eb |
#undef input
|
|
Packit |
8480eb |
#undef unput
|
|
Packit |
8480eb |
#define input() (*(char *) line++)
|
|
Packit |
8480eb |
#define unput(c) (*(char *) --line = c)
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#define BUFF_LEN 1024
|
|
Packit |
8480eb |
char buff[BUFF_LEN];
|
|
Packit |
8480eb |
char *bptr;
|
|
Packit |
8480eb |
char *optr = buff;
|
|
Packit |
8480eb |
unsigned int tlen;
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
%}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
%option nounput
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
%x PATHSTR MAPSTR DNSTR OPTSTR OCTAL
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
WS [[:blank:]]+
|
|
Packit |
8480eb |
OPTWS [[:blank:]]*
|
|
Packit |
8480eb |
NL \r?\n
|
|
Packit |
8480eb |
CONT \\\n{OPTWS}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
OPTIONSTR ([\-]?([[:alpha:]_]([[:alnum:]_\-])*(=(\"?([[:alnum:]_\-\:\.])+\"?))?)+)
|
|
Packit |
8480eb |
MACROSTR (-D{OPTWS}([[:alpha:]_]([[:alnum:]_\-\.])*)=([[:alnum:]_\-\.])+)
|
|
Packit |
8480eb |
SLASHIFYSTR (--(no-)?slashify-colons)
|
|
Packit |
8480eb |
NUMBER [0-9]+
|
|
Packit |
8480eb |
OCTALNUMBER [0-7]+
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
DNSERVSTR1 ([[:alpha:]][[:alnum:]\-.]*(:[0-9]+)?:)
|
|
Packit |
8480eb |
DNSERVSTR2 (\[([[:xdigit:]]:.)+\](:[0-9]+)?:)
|
|
Packit |
8480eb |
DNSERVSTR3 (\/\/[[:alpha:]][[:alnum:]\-.]*(:[0-9]+)?\/)
|
|
Packit |
8480eb |
DNSERVSTR4 (\/\/\[([[:xdigit:]]:.)+\](:[0-9]+)?\/)
|
|
Packit |
8480eb |
DNSERVSTR5 (([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}(:[0-9]+)?:)
|
|
Packit |
8480eb |
DNSERVSTR6 (\/\/([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}(:[0-9]+)?\/)
|
|
Packit |
8480eb |
DNSERVERSTR ({DNSERVSTR1}|{DNSERVSTR2}|{DNSERVSTR3}|{DNSERVSTR4}|{DNSERVSTR5}|{DNSERVSTR6})
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
AT_CN ([cC][[nN])
|
|
Packit |
8480eb |
AT_NMN ([nN][iI][sS][Mm][aA][pP][Nn][aA][mM][eE])
|
|
Packit |
8480eb |
AT_AMN ([aA][uU][tT][oO][mM][oO][uU][nN][tT][Mm][aA][pP][Nn][aA][mM][eE])
|
|
Packit |
8480eb |
AT_OU ([oO][[uU])
|
|
Packit |
8480eb |
AT_DC ([dD][[cC])
|
|
Packit |
8480eb |
AT_O ([oO])
|
|
Packit |
8480eb |
AT_C ([cC])
|
|
Packit |
8480eb |
AT_L ([lL])
|
|
Packit |
8480eb |
DNATTRSTR ({AT_CN}|{AT_NMN}|{AT_AMN}|{AT_OU}|{AT_DC}|{AT_O}|{AT_C}|{AT_L})
|
|
Packit |
8480eb |
DNNAMESTR1 ([[:alnum:]_.\- ]+)
|
|
Packit |
8480eb |
DNNAMESTR2 ([[:alnum:]_.\-]+)
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
INTMAP (-hosts|-null)
|
|
Packit |
8480eb |
MULTI ((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
|
|
Packit |
8480eb |
MULTISEP ([\-]{2}[[:blank:]]+)
|
|
Packit |
8480eb |
MTYPE ((file|program|exec|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod|amd))?(:{OPTWS}|{WS}))
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
OPTTOUT (-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS})
|
|
Packit |
8480eb |
OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeout{OPTWS}={OPTWS})
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
MODE (--mode{OPTWS}|--mode{OPTWS}={OPTWS})
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
%%
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<INITIAL>{
|
|
Packit |
8480eb |
{NL} |
|
|
Packit |
8480eb |
\x00 {
|
|
Packit |
8480eb |
if (optr != buff) {
|
|
Packit |
8480eb |
*optr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return NILL;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#.* { return COMMENT; }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"/" {
|
|
Packit |
8480eb |
if (optr != buff) {
|
|
Packit |
8480eb |
*optr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return NILL;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
BEGIN(PATHSTR);
|
|
Packit |
8480eb |
bptr = buff;
|
|
Packit |
8480eb |
yyless(0);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
. { *optr++ = *master_text; }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<PATHSTR>{
|
|
Packit |
8480eb |
\x00 {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr++ = *master_text;
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return NILL;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
\\. { *bptr++ = *(master_text + 1); }
|
|
Packit |
8480eb |
\" {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr++ = *master_text;
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return QUOTE;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{WS} {
|
|
Packit |
8480eb |
BEGIN(MAPSTR);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
bptr = buff;
|
|
Packit |
8480eb |
memset(buff, 0, BUFF_LEN);
|
|
Packit |
8480eb |
return(PATH);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<<EOF>> {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return(PATH);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{NL} {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return PATH;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
. { *bptr++ = *master_text; }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<MAPSTR>{
|
|
Packit |
8480eb |
{OPTWS}\\\n{OPTWS} {}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MULTI} {
|
|
Packit |
8480eb |
tlen = master_leng - 1;
|
|
Packit |
8480eb |
if (bptr != buff && isblank(master_text[tlen])) {
|
|
Packit |
8480eb |
/*
|
|
Packit |
8480eb |
* We can't handle unescaped white space in map names
|
|
Packit |
8480eb |
* so just eat the white space. We always have the
|
|
Packit |
8480eb |
* "multi" at the beginning of the string so the while
|
|
Packit |
8480eb |
* will not fall off the end.
|
|
Packit |
8480eb |
*/
|
|
Packit |
8480eb |
while (isblank(master_text[tlen - 1]))
|
|
Packit |
8480eb |
tlen--;
|
|
Packit |
8480eb |
strncat(buff, master_text, tlen);
|
|
Packit |
8480eb |
bptr += tlen;
|
|
Packit |
8480eb |
yyless(tlen);
|
|
Packit |
8480eb |
} else {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(MULTITYPE);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MTYPE} |
|
|
Packit |
8480eb |
{MTYPE}/{DNSERVERSTR}{DNATTRSTR}= |
|
|
Packit |
8480eb |
{MTYPE}/{DNATTRSTR}= {
|
|
Packit |
8480eb |
tlen = master_leng - 1;
|
|
Packit |
8480eb |
if (bptr != buff && isblank(master_text[tlen])) {
|
|
Packit |
8480eb |
/*
|
|
Packit |
8480eb |
* We can't handle unescaped white space in map names
|
|
Packit |
8480eb |
* so just eat the white space. We always have the
|
|
Packit |
8480eb |
* maptype keyword at the beginning of the string so
|
|
Packit |
8480eb |
* the while will not fall off the end.
|
|
Packit |
8480eb |
*/
|
|
Packit |
8480eb |
while (isblank(master_text[tlen - 1]))
|
|
Packit |
8480eb |
tlen--;
|
|
Packit |
8480eb |
strncat(buff, master_text, tlen);
|
|
Packit |
8480eb |
bptr += tlen;
|
|
Packit |
8480eb |
yyless(tlen);
|
|
Packit |
8480eb |
} else {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(MAPTYPE);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MULTISEP} { return(DDASH); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
":" { return(COLON); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"-hosts" {
|
|
Packit |
8480eb |
BEGIN(OPTSTR);
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return MAPHOSTS;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"-null" {
|
|
Packit |
8480eb |
BEGIN(OPTSTR);
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return MAPNULL;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"-xfn" {
|
|
Packit |
8480eb |
/*
|
|
Packit |
8480eb |
* The X/Open Federated Naming service isn't supported
|
|
Packit |
8480eb |
* and the parser will call YYABORT() when it sees the
|
|
Packit |
8480eb |
* MAPXFN token so we must set the start state to the
|
|
Packit |
8480eb |
* INITIAL state here for the next yylex() call.
|
|
Packit |
8480eb |
*/
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return MAPXFN;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"//" {
|
|
Packit |
8480eb |
BEGIN(DNSTR);
|
|
Packit |
8480eb |
yyless(0);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNSERVERSTR}{DNATTRSTR}= {
|
|
Packit |
8480eb |
BEGIN(DNSTR);
|
|
Packit |
8480eb |
yyless(0);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNATTRSTR}= {
|
|
Packit |
8480eb |
BEGIN(DNSTR);
|
|
Packit |
8480eb |
yyless(0);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTWS}/{NL} {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
bptr = buff;
|
|
Packit |
8480eb |
return(MAPNAME);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
\\. { *bptr++ = *(master_text + 1); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{WS} {
|
|
Packit |
8480eb |
BEGIN(OPTSTR);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
bptr = buff;
|
|
Packit |
8480eb |
return(MAPNAME);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{NL} |
|
|
Packit |
8480eb |
\x00 {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return(MAPNAME);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<<EOF>> {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
*bptr = '\0';
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, buff);
|
|
Packit |
8480eb |
return(MAPNAME);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
. { *bptr++ = *master_text; }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<DNSTR>{
|
|
Packit |
8480eb |
{OPTWS}\\\n{OPTWS} {}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNSERVERSTR} {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return DNSERVER;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNATTRSTR}/"=" {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return DNATTR;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"=" {
|
|
Packit |
8480eb |
return EQUAL;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNNAMESTR1}/","{DNATTRSTR}"=" {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return DNNAME;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{DNNAMESTR2} {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return DNNAME;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTWS}","{OPTWS} {
|
|
Packit |
8480eb |
return COMMA;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{WS}"=" |
|
|
Packit |
8480eb |
"="{WS} {
|
|
Packit |
8480eb |
BEGIN(INITIAL);
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return SPACE;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{WS} { BEGIN(OPTSTR); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{NL} |
|
|
Packit |
8480eb |
\x00 { BEGIN(INITIAL); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<<EOF>> { BEGIN(INITIAL); }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<OPTSTR>{
|
|
Packit |
8480eb |
{OPTWS}\\\n{OPTWS} {}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MULTISEP} {
|
|
Packit |
8480eb |
BEGIN(MAPSTR);
|
|
Packit |
8480eb |
return(DDASH);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTTOUT}/{NUMBER} { return(OPT_TIMEOUT); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTNTOUT}/{NUMBER} { return(OPT_NTIMEOUT); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{NUMBER} {
|
|
Packit |
8480eb |
master_lval.longtype = atol(master_text);
|
|
Packit |
8480eb |
return(NUMBER);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
-?symlink { return(OPT_SYMLINK); }
|
|
Packit |
8480eb |
-?nobind { return(OPT_NOBIND); }
|
|
Packit |
8480eb |
-?nobrowse { return(OPT_NOGHOST); }
|
|
Packit Service |
bb8d86 |
-?slave { return(OPT_SLAVE); }
|
|
Packit Service |
bb8d86 |
-?private { return(OPT_PRIVATE); }
|
|
Packit Service |
a3f957 |
-?strictexpire { return(OPT_STRICTEXPIRE); }
|
|
Packit |
8480eb |
-g|--ghost|-?browse { return(OPT_GHOST); }
|
|
Packit |
8480eb |
-v|--verbose { return(OPT_VERBOSE); }
|
|
Packit |
8480eb |
-d|--debug { return(OPT_DEBUG); }
|
|
Packit |
8480eb |
-w|--use-weight-only { return(OPT_USE_WEIGHT); }
|
|
Packit |
8480eb |
-r|--random-multimount-selection { return(OPT_RANDOM); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MODE}/{OCTALNUMBER} {
|
|
Packit |
8480eb |
BEGIN(OCTAL);
|
|
Packit |
8480eb |
return(OPT_MODE);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTWS}","{OPTWS} { return(COMMA); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTWS} {}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{SLASHIFYSTR} {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(OPTION);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{MACROSTR} {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(OPTION);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{OPTIONSTR} {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(OPTION);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
"=" {
|
|
Packit |
8480eb |
strcpy(master_lval.strtype, master_text);
|
|
Packit |
8480eb |
return(EQUAL);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
{WS} {}
|
|
Packit |
8480eb |
{NL} |
|
|
Packit |
8480eb |
\x00 { BEGIN(INITIAL); }
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<<EOF>> { BEGIN(INITIAL); }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
<OCTAL>{
|
|
Packit |
8480eb |
{OCTALNUMBER} {
|
|
Packit |
8480eb |
master_lval.longtype = strtoul(master_text, NULL, 8);
|
|
Packit |
8480eb |
return(OCTALNUMBER);
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
. { BEGIN(OPTSTR); yyless(0); }
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
%%
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#include "automount.h"
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
int master_wrap(void)
|
|
Packit |
8480eb |
{
|
|
Packit |
8480eb |
return 1;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
static void master_echo(void)
|
|
Packit |
8480eb |
{
|
|
Packit |
8480eb |
logmsg("%s", master_text);
|
|
Packit |
8480eb |
return;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifdef FLEX_SCANNER
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
void master_set_scan_buffer(const char *buffer)
|
|
Packit |
8480eb |
{
|
|
Packit |
8480eb |
memset(buff, 0, sizeof(buff));
|
|
Packit |
8480eb |
optr = buff;
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
YY_FLUSH_BUFFER;
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
line = buffer;
|
|
Packit |
8480eb |
line_pos = &line[0];
|
|
Packit |
8480eb |
/*
|
|
Packit |
8480eb |
* Ensure buffer is 1 greater than string and is zeroed before
|
|
Packit |
8480eb |
* the parse so we can fit the extra NULL which allows us to
|
|
Packit |
8480eb |
* explicitly match an end of line within the buffer (ie. the
|
|
Packit |
8480eb |
* need for 2 NULLS when parsing in memeory buffers).
|
|
Packit |
8480eb |
*/
|
|
Packit |
8480eb |
line_lim = line + strlen(buffer) + 1;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#ifndef min
|
|
Packit |
8480eb |
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
Packit |
8480eb |
#endif
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
int my_yyinput(char *buffer, int max_size)
|
|
Packit |
8480eb |
{
|
|
Packit |
8480eb |
int n = min(max_size, line_lim - line_pos);
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
if (n > 0) {
|
|
Packit |
8480eb |
memcpy(buffer, line_pos, n);
|
|
Packit |
8480eb |
line_pos += n;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
return n;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#else
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
void master_set_scan_buffer(const char *buffer)
|
|
Packit |
8480eb |
{
|
|
Packit |
8480eb |
line = buffer;
|
|
Packit |
8480eb |
}
|
|
Packit |
8480eb |
|
|
Packit |
8480eb |
#endif
|