chiark
/
gitweb
/
~ian
/
secnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
portability: use socklen_t for argument to recvfrom
[secnet.git]
/
conffile.fl
diff --git
a/conffile.fl
b/conffile.fl
index c1b4b042d06cf7c3dcbc430a7a1c7fde4441b2a2..2cfa21b10f96202635e8d33431802d136a6ca791 100644
(file)
--- a/
conffile.fl
+++ b/
conffile.fl
@@
-1,7
+1,13
@@
/* the "incl" state is used for picking up the name of an include file */
%x incl
/* the "incl" state is used for picking up the name of an include file */
%x incl
+%option nounput
+%option noinput
+%option never-interactive
+
%{
%{
+#include <assert.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-12,17
+18,25
@@
#define YY_NO_UNPUT
#define YY_NO_UNPUT
+#define YY_INPUT(buf,result,max_size) \
+do{ \
+ (result)= fread((buf),1,(max_size),yyin); \
+ if (ferror(yyin)) \
+ fatal_perror("Error reading configuration file (%s)", \
+ config_file); \
+}while(0)
+
#define MAX_INCLUDE_DEPTH 10
struct include_stack_item {
YY_BUFFER_STATE bst;
uint32_t lineno;
#define MAX_INCLUDE_DEPTH 10
struct include_stack_item {
YY_BUFFER_STATE bst;
uint32_t lineno;
- string_t file;
+
c
string_t file;
};
struct include_stack_item include_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr=0;
};
struct include_stack_item include_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr=0;
-
uint32_
t config_lineno=0;
-string_t config_file="xxx";
+
in
t config_lineno=0;
+
c
string_t config_file="xxx";
static struct p_node *leafnode(uint32_t type)
{
static struct p_node *leafnode(uint32_t type)
{
@@
-84,6
+98,15
@@
include BEGIN(incl);
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
BEGIN(INITIAL);
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
BEGIN(INITIAL);
}
+<incl>\n { /* include with no filename */
+ Message(M_FATAL,"config file %s line %d: %s\n",config_file,
+ config_lineno,"``include'' requires a filename");
+ BEGIN(INITIAL);
+ assert(config_lineno < INT_MAX);
+ ++config_lineno;
+ ++yynerrs;
+}
+
<<EOF>> {
if (--include_stack_ptr < 0) {
yyterminate();
<<EOF>> {
if (--include_stack_ptr < 0) {
yyterminate();