/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
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
+ You should have received a copy of the GNU Affero 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.
+ 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.
*
* Kern Sibbald, 2000
*
- * Version $Id$
- *
*/
#include "bacula.h"
return (uint32_t)val;
}
+static uint64_t scan_pint64(LEX *lf, char *str)
+{
+ uint64_t val = 0;
+ if (!is_a_number(str)) {
+ scan_err1(lf, _("expected a positive integer number, got: %s"), str);
+ /* NOT REACHED */
+ } else {
+ errno = 0;
+ val = str_to_uint64(str);
+ if (errno != 0) {
+ scan_err1(lf, _("expected a positive integer number, got: %s"), str);
+ /* NOT REACHED */
+ }
+ }
+ return val;
+}
+
/*
*
* Get the next token from the input
}
break;
+ case T_PINT64_RANGE:
+ if (token == T_NUMBER) {
+ lf->pint64_val = scan_pint64(lf, lf->str);
+ lf->pint64_val2 = lf->pint64_val;
+ token = T_PINT64;
+ } else {
+ char *p = strchr(lf->str, '-');
+ if (!p) {
+ scan_err2(lf, _("expected an integer or a range, got %s: %s"),
+ lex_tok_to_str(token), lf->str);
+ token = T_ERROR;
+ break;
+ }
+ *p++ = 0; /* terminate first half of range */
+ lf->pint64_val = scan_pint64(lf, lf->str);
+ lf->pint64_val2 = scan_pint64(lf, p);
+ token = T_PINT64_RANGE;
+ }
+ break;
+
case T_NAME:
if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
scan_err2(lf, _("expected a name, got %s: %s"),