+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 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.
+ This program is Free Software; you can redistribute it and/or
+ modify it under the terms of version two of the GNU General Public
+ License as published by the Free Software Foundation plus additions
+ that are listed in the file LICENSE.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
/*
* Lexical scanner for Bacula configuration file
*
* Version $Id$
*
*/
-/*
- Copyright (C) 2000-2006 Kern Sibbald
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as amended with additional clauses defined in the
- file LICENSE in the main source directory.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- the file LICENSE for additional details.
-
- */
-
#include "bacula.h"
#include "lex.h"
int ch;
int token = T_NONE;
bool esc_next = false;
+ int unicode_count = 0;
Dmsg0(dbglvl, "enter lex_get_token\n");
while (token == T_NONE) {
lf->state = lex_include;
begin_str(lf, 0);
break;
+ case 0xEF:
+ if (lf->line_no != 1 || lf->col_no != 1)
+ {
+ lf->state = lex_string;
+ begin_str(lf, ch);
+ break;
+ }
+ lf->state = lex_unicode_mark;
+ unicode_count = 1;
+ break;
default:
lf->state = lex_string;
begin_str(lf, ch);
}
add_str(lf, ch);
break;
+ case lex_unicode_mark:
+ if (ch == L_EOF) {
+ token = T_ERROR;
+ break;
+ }
+ unicode_count++;
+ if (unicode_count == 2) {
+ if (ch != 0xBB) {
+ token = T_ERROR;
+ break;
+ }
+ } else if (unicode_count == 3) {
+ if (ch != 0xBF) {
+ token = T_ERROR;
+ break;
+ }
+ token = T_UNICODE_MARK;
+ lf->state = lex_none;
+ break;
+ }
+ break;
}
Dmsg4(dbglvl, "ch=%d state=%s token=%s %c\n", ch, lex_state_to_str(lf->state),
lex_tok_to_str(token), ch);