/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ Bacula® is a registered trademark of Kern Sibbald.
The licensor of Bacula is the Free Software Foundation Europe
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
if (fname[0] == '|') {
- if ((bpipe = open_bpipe(fname, 0, "rb")) == NULL) {
+ if ((bpipe = open_bpipe(fname+1, 0, "rb")) == NULL) {
free(fname);
return NULL;
}
int lex_get_char(LEX *lf)
{
if (lf->ch == L_EOF) {
- Emsg0(M_ABORT, 0, _("get_char: called after EOF\n"));
+ Emsg0(M_ABORT, 0, _("get_char: called after EOF."
+ " You may have a open double quote without the closing double quote.\n"));
}
if (lf->ch == L_EOL) {
if (bfgets(lf->line, MAXSTRING, lf->fd) == NULL) {
case lex_identifier: return _("identifier");
case lex_string: return _("string");
case lex_quoted_string: return _("quoted_string");
+ case lex_include: return _("include");
+ case lex_include_quoted_string: return _("include_quoted_string");
case lex_utf8_bom: return _("UTF-8 Byte Order Mark");
case lex_utf16_le_bom: return _("UTF-16le Byte Order Mark");
default: return "??????";
}
add_str(lf, ch);
break;
+ case lex_include_quoted_string:
+ if (ch == L_EOF) {
+ token = T_ERROR;
+ break;
+ }
+ if (esc_next) {
+ add_str(lf, ch);
+ esc_next = false;
+ break;
+ }
+ if (ch == '\\') {
+ esc_next = true;
+ break;
+ }
+ if (ch == '"') {
+ /* Keep the original LEX so we can print an error if the included file can't be opened. */
+ LEX* lfori = lf;
+ /* Skip the double quote when restarting parsing */
+ lex_get_char(lf);
+
+ lf->state = lex_none;
+ lf = lex_open_file(lf, lf->str, lf->scan_error);
+ if (lf == NULL) {
+ berrno be;
+ scan_err2(lfori, _("Cannot open included config file %s: %s\n"),
+ lfori->str, be.bstrerror());
+ return T_ERROR;
+ }
+ break;
+ }
+ add_str(lf, ch);
+ break;
case lex_include: /* scanning a filename */
if (ch == L_EOF) {
token = T_ERROR;
break;
}
+ if (ch == '"') {
+ lf->state = lex_include_quoted_string;
+ break;
+ }
+
+
if (B_ISSPACE(ch) || ch == '\n' || ch == L_EOL || ch == '}' || ch == '{' ||
ch == ';' || ch == ',' || ch == '"' || ch == '#') {
/* Keep the original LEX so we can print an error if the included file can't be opened. */