return token;
}
-
/*
* Format a scanner error message
*/
-void s_err(const char *file, int line, LEX *lc, const char *msg, ...)
+static void s_err(const char *file, int line, LEX *lc, const char *msg, ...)
{
va_list arg_ptr;
char buf[MAXSTRING];
}
}
+void lex_set_default_error_handler(LEX *lf)
+{
+ lf->scan_error = s_err;
+}
+
/*
* Free the current file, and retrieve the contents
if ((fd = fopen(fname, "r")) == NULL) {
return NULL;
}
- Dmsg1(2000, "Open config file: %s\n", fname);
+ Dmsg1(400, "Open config file: %s\n", fname);
nf = (LEX *)malloc(sizeof(LEX));
if (lf) {
memcpy(nf, lf, sizeof(LEX));
lf = nf; /* start new packet */
memset(lf, 0, sizeof(LEX));
}
- lf->fd = fd;
- lf->fname = fname;
- lf->state = lex_none;
- lf->ch = L_EOL;
if (scan_error) {
lf->scan_error = scan_error;
} else {
- lf->scan_error = s_err;
+ lex_set_default_error_handler(lf);
}
+ lf->fd = fd;
+ lf->fname = fname;
+ lf->state = lex_none;
+ lf->ch = L_EOL;
Dmsg1(2000, "Return lex=%x\n", lf);
return lf;
}
}
lf->line_no++;
lf->col_no = 0;
+ Dmsg2(400, "fget line=%d %s", lf->line_no, lf->line);
}
lf->ch = (uint8_t)lf->line[lf->col_no];
if (lf->ch == 0) {