1
2
+text
set-gnome2
set-gnome1.4
kerns-gprof-config
- Kern's ToDo List
- 06 Septermber 2004
+ Kern's ToDo List
+ 07 Septermber 2004
Major development:
Project Developer
========================================================
1.35 Items to do for release:
-- Fix silly restriction requiring Include { Options { xxx } } to be
- on separate lines.
-- Improve error message if old/new FileSet syntax mixed.
- Restore c: with a prefix into /prefix/c/ to prevent c: and d:
files with the same name from overwritting each other.
- Add new DCR calling sequences everywhere in SD. This will permit
simultaneous use of multiple devices by a single job.
-
- Document a get out of jail procedure if everything breaks if
you lost/broke the Catalog -- do the same for "I know my
file is there how do I get it back?".
-- New IP address specification is used as follows:
- [sdaddresses|diraddresses|fdaddresses] = { [[ip|ipv4|ipv6] = {
- [[addr|port] = [^ ]+[\n;]+] }] }
-
- so it could look for example like this:
- SDaddresses = { ip = {
- addr = 1.2.3.4; port = 1205; }
- ipv4 = {
- addr = 1.2.3.4; port = http; }
- ipv6 = {
- addr = 1.2.3.4;
- port = 1205;
- }
- ip = {
- addr = 1.2.3.4
- port = 1205
- }
- ip = {
- addr = 1.2.3.4
- }
- ip = {
- addr = 201:220:222::2
- }
- ip = {
- addr = bluedot.thun.net
- }
- }
- as a consequence, you can now specify multiple IP addresses and
- ports to be used. In the case of a server, it will listen on
- all those that you specify. In the case of connecting to the server,
- Bacula will attempt connecting to one at a time until it succeeds.
- And, in a few other special cases, Bacula will use only the first
- address specified.
-
- The default port numbers are still the same and the services and hosts
- are also resolved by name. So now you could use the real names for the
- port numbers.
-
- An ip section will allow resolution to either an ipv4 or an ipv6 address.
- An ipv4 section forces the resolution to be only ipv4, and an ipv6 section
- forces the resolution to be only ipv6.
-
Maybe for 1.35:
- Look at patches/bacula_db.b2z postgresql that loops during restore.
- Add bscan to four-concurrent-jobs regression.
- Add IPv6 to regression
- Perhaps add read/write programs and/or plugins to FileSets.
-
+- How to handle backing up portables ...
Documentation to do: (any release a little bit at a time)
- Alternative to static linking "ldd prog" save all binaries listed,
- Document that console commands can be abbreviated.
- Doc update AllFromVol
- Doc -p option in stored
+- New IP address specification is used as follows:
+ [sdaddresses|diraddresses|fdaddresses] = { [[ip|ipv4|ipv6] = {
+ [[addr|port] = [^ ]+[\n;]+] }] }
+
+ so it could look for example like this:
+ SDaddresses = { ip = {
+ addr = 1.2.3.4; port = 1205; }
+ ipv4 = {
+ addr = 1.2.3.4; port = http; }
+ ipv6 = {
+ addr = 1.2.3.4;
+ port = 1205;
+ }
+ ip = {
+ addr = 1.2.3.4
+ port = 1205
+ }
+ ip = {
+ addr = 1.2.3.4
+ }
+ ip = {
+ addr = 201:220:222::2
+ }
+ ip = {
+ addr = bluedot.thun.net
+ }
+ }
+ as a consequence, you can now specify multiple IP addresses and
+ ports to be used. In the case of a server, it will listen on
+ all those that you specify. In the case of connecting to the server,
+ Bacula will attempt connecting to one at a time until it succeeds.
+ And, in a few other special cases, Bacula will use only the first
+ address specified.
+
+ The default port numbers are still the same and the services and hosts
+ are also resolved by name. So now you could use the real names for the
+ port numbers.
+
+ An ip section will allow resolution to either an ipv4 or an ipv6 address.
+ An ipv4 section forces the resolution to be only ipv4, and an ipv6 section
+ forces the resolution to be only ipv6.
+- Fix silly restriction requiring Include { Options { xxx } } to be
+ on separate lines.
+
}
if ((row = sql_fetch_row(mdb)) == NULL) {
- Mmsg1(&mdb->errmsg, _("No Job record found: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg2(&mdb->errmsg, _("No Job record found: ERR=%s\nCMD=%s\n"),
+ sql_strerror(mdb), mdb->cmd);
sql_free_result(mdb);
db_unlock(mdb);
return 0;
recurse = false;
}
switch (type) {
- case R_CONSOLE:
- printf("Console: name=%s rcfile=%s histfile=%s\n", reshdr->name,
- res->res_cons.rc_file, res->res_cons.hist_file);
- break;
- case R_DIRECTOR:
- printf("Director: name=%s address=%s DIRport=%d\n", reshdr->name,
- res->res_dir.address, res->res_dir.DIRport);
- break;
- default:
- printf("Unknown resource type %d\n", type);
+ case R_CONSOLE:
+ printf("Console: name=%s rcfile=%s histfile=%s\n", reshdr->name,
+ res->res_cons.rc_file, res->res_cons.hist_file);
+ break;
+ case R_DIRECTOR:
+ printf("Director: name=%s address=%s DIRport=%d\n", reshdr->name,
+ res->res_dir.address, res->res_dir.DIRport);
+ break;
+ default:
+ printf("Unknown resource type %d\n", type);
}
if (recurse && res->res_dir.hdr.next) {
dump_resource(type, res->res_dir.hdr.next, sendit, sock);
}
switch (type) {
- case R_CONSOLE:
- if (res->res_cons.rc_file) {
- free(res->res_cons.rc_file);
- }
- if (res->res_cons.hist_file) {
- free(res->res_cons.hist_file);
- }
- case R_DIRECTOR:
- if (res->res_dir.address)
- free(res->res_dir.address);
- break;
- default:
- printf("Unknown resource type %d\n", type);
+ case R_CONSOLE:
+ if (res->res_cons.rc_file) {
+ free(res->res_cons.rc_file);
+ }
+ if (res->res_cons.hist_file) {
+ free(res->res_cons.hist_file);
+ }
+ case R_DIRECTOR:
+ if (res->res_dir.address)
+ free(res->res_dir.address);
+ break;
+ default:
+ printf("Unknown resource type %d\n", type);
}
/* Common stuff again -- free the resource, recurse to next one */
free(res);
/* The following code is only executed during pass 1 */
switch (type) {
- case R_CONSOLE:
- size = sizeof(CONRES);
- break;
- case R_DIRECTOR:
- size = sizeof(DIRRES);
- break;
- default:
- printf("Unknown resource type %d\n", type);
- error = 1;
- size = 1;
- break;
+ case R_CONSOLE:
+ size = sizeof(CONRES);
+ break;
+ case R_DIRECTOR:
+ size = sizeof(DIRRES);
+ break;
+ default:
+ printf("Unknown resource type %d\n", type);
+ error = 1;
+ size = 1;
+ break;
}
/* Common */
if (!error) {
set_bit(index, res_all.hdr.item_present);
}
-
-#ifdef old_deprecated_code
-/*
- * Store backup/verify info for Job record
- *
- * Note, this code is used for both BACKUP and VERIFY jobs
- *
- * Backup = Client=<client-name> FileSet=<FileSet-name> Level=<level>
- */
-static void store_backup(LEX *lc, RES_ITEM *item, int index, int pass)
-{
- int token, i;
- RES *res;
- int options = lc->options;
-
- lc->options |= LOPT_NO_IDENT; /* make spaces significant */
-
-
- ((JOB *)(item->value))->JobType = item->code;
- while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
- bool found = false;
-
- Dmsg1(900, "store_backup got token=%s\n", lex_tok_to_str(token));
-
- if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
- scan_err1(lc, "Expected a backup/verify keyword, got: %s", lc->str);
- }
- Dmsg1(900, "Got keyword: %s\n", lc->str);
- for (i=0; BakVerFields[i].name; i++) {
- if (strcasecmp(lc->str, BakVerFields[i].name) == 0) {
- found = true;
- if (lex_get_token(lc, T_ALL) != T_EQUALS) {
- scan_err1(lc, "Expected an equals, got: %s", lc->str);
- }
- token = lex_get_token(lc, T_NAME);
- Dmsg1(900, "Got value: %s\n", lc->str);
- switch (BakVerFields[i].token) {
- case 'C':
- /* Find Client Resource */
- if (pass == 2) {
- res = GetResWithName(R_CLIENT, lc->str);
- if (res == NULL) {
- scan_err1(lc, "Could not find specified Client Resource: %s",
- lc->str);
- }
- res_all.res_job.client = (CLIENT *)res;
- }
- break;
- case 'F':
- /* Find FileSet Resource */
- if (pass == 2) {
- res = GetResWithName(R_FILESET, lc->str);
- if (res == NULL) {
- scan_err1(lc, "Could not find specified FileSet Resource: %s\n",
- lc->str);
- }
- res_all.res_job.fileset = (FILESET *)res;
- }
- break;
- case 'L':
- /* Get level */
- for (i=0; joblevels[i].level_name; i++) {
- if (joblevels[i].job_type == item->code &&
- strcasecmp(lc->str, joblevels[i].level_name) == 0) {
- ((JOB *)(item->value))->level = joblevels[i].level;
- i = 0;
- break;
- }
- }
- if (i != 0) {
- scan_err1(lc, "Expected a Job Level keyword, got: %s", lc->str);
- }
- break;
- } /* end switch */
- break;
- } /* end if strcmp() */
- } /* end for */
- if (!found) {
- scan_err1(lc, "%s not a valid Backup/verify keyword", lc->str);
- }
- } /* end while */
- lc->options = options; /* reset original options */
- set_bit(index, res_all.hdr.item_present);
-}
-
-/*
- * Store restore info for Job record
- *
- * Restore = JobId=<job-id> Where=<root-directory> Replace=<options> Bootstrap=<file>
- *
- */
-static void store_restore(LEX *lc, RES_ITEM *item, int index, int pass)
-{
- int token, i;
- RES *res;
- int options = lc->options;
-
- lc->options |= LOPT_NO_IDENT; /* make spaces significant */
-
- Dmsg0(900, "Enter store_restore()\n");
-
- ((JOB *)(item->value))->JobType = item->code;
- while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
- bool found = false;
-
- if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
- scan_err1(lc, "expected a name, got: %s", lc->str);
- }
- for (i=0; RestoreFields[i].name; i++) {
- Dmsg1(900, "Restore kw=%s\n", lc->str);
- if (strcasecmp(lc->str, RestoreFields[i].name) == 0) {
- found = true;
- if (lex_get_token(lc, T_ALL) != T_EQUALS) {
- scan_err1(lc, "Expected an equals, got: %s", lc->str);
- }
- token = lex_get_token(lc, T_ALL);
- Dmsg1(900, "Restore value=%s\n", lc->str);
- switch (RestoreFields[i].token) {
- case 'B':
- /* Bootstrap */
- if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
- scan_err1(lc, "Expected a Restore bootstrap file, got: %s", lc->str);
- }
- if (pass == 1) {
- res_all.res_job.RestoreBootstrap = bstrdup(lc->str);
- }
- break;
- case 'C':
- /* Find Client Resource */
- if (pass == 2) {
- res = GetResWithName(R_CLIENT, lc->str);
- if (res == NULL) {
- scan_err1(lc, "Could not find specified Client Resource: %s",
- lc->str);
- }
- res_all.res_job.client = (CLIENT *)res;
- }
- break;
- case 'F':
- /* Find FileSet Resource */
- if (pass == 2) {
- res = GetResWithName(R_FILESET, lc->str);
- if (res == NULL) {
- scan_err1(lc, "Could not find specified FileSet Resource: %s\n",
- lc->str);
- }
- res_all.res_job.fileset = (FILESET *)res;
- }
- break;
- case 'J':
- /* JobId */
- if (token != T_NUMBER) {
- scan_err1(lc, "expected an integer number, got: %s", lc->str);
- }
- errno = 0;
- res_all.res_job.RestoreJobId = strtol(lc->str, NULL, 0);
- Dmsg1(900, "RestorJobId=%d\n", res_all.res_job.RestoreJobId);
- if (errno != 0) {
- scan_err1(lc, "expected an integer number, got: %s", lc->str);
- }
- break;
- case 'W':
- /* Where */
- if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
- scan_err1(lc, "Expected a Restore root directory, got: %s", lc->str);
- }
- if (pass == 1) {
- res_all.res_job.RestoreWhere = bstrdup(lc->str);
- }
- break;
- case 'R':
- /* Replacement options */
- if (token != T_IDENTIFIER && token != T_UNQUOTED_STRING && token != T_QUOTED_STRING) {
- scan_err1(lc, "Expected a keyword name, got: %s", lc->str);
- }
- /* Fix to scan Replacement options */
- for (i=0; ReplaceOptions[i].name; i++) {
- if (strcasecmp(lc->str, ReplaceOptions[i].name) == 0) {
- ((JOB *)(item->value))->replace = ReplaceOptions[i].token;
- i = 0;
- break;
- }
- }
- if (i != 0) {
- scan_err1(lc, "Expected a Restore replacement option, got: %s", lc->str);
- }
- break;
- } /* end switch */
- break;
- } /* end if strcmp() */
- } /* end for */
- if (!found) {
- scan_err1(lc, "%s not a valid Restore keyword", lc->str);
- }
- } /* end while */
- lc->options = options; /* reset original options */
- set_bit(index, res_all.hdr.item_present);
-}
-#endif
/*
*
* Store FileSet Include/Exclude info
+ * NEW style includes are handled in store_newinc()
*/
void store_inc(LEX *lc, RES_ITEM *item, int index, int pass)
{
* new Include is followed immediately by open brace, whereas the
* old include has options following the Include.
*/
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token == T_BOB) {
store_newinc(lc, item, index, pass);
return;
}
+
+ /* What follows is scanning for the OLD style Include/Exclude */
+
if (token != T_EQUALS) {
scan_err1(lc, _("Expecting an equals sign, got: %s\n"), lc->str);
}
/* Get include options */
inc_opts[0] = 0;
- while ((token=lex_get_token(lc, T_ALL)) != T_BOB) {
+ while ((token=lex_get_token(lc, T_SKIP_EOL)) != T_BOB) {
keyword = INC_KW_NONE;
for (i=0; FS_option_kw[i].name; i++) {
scan_err1(lc, _("Expected a FileSet keyword, got: %s"), lc->str);
}
/* Option keyword should be following by = <option> */
- if ((token=lex_get_token(lc, T_ALL)) != T_EQUALS) {
+ if ((token=lex_get_token(lc, T_SKIP_EOL)) != T_EQUALS) {
scan_err1(lc, _("expected an = following keyword, got: %s"), lc->str);
} else {
/* Scan right hand side of option */
/* Pickup include/exclude names. They are stored in INCEXE
* structures which contains the options and the name.
*/
- while ((token = lex_get_token(lc, T_ALL)) != T_EOB) {
+ while ((token = lex_get_token(lc, T_SKIP_EOL)) != T_EOB) {
switch (token) {
case T_COMMA:
- case T_EOL:
continue;
case T_IDENTIFIER:
/*
- * Store FileSet FInclude/FExclude info
+ * Store NEW style FileSet FInclude/FExclude info
+ *
* Note, when this routine is called, we are inside a FileSet
* resource. We treat the Include/Execlude like a sort of
* mini-resource within the FileSet resource.
if (!res_all.res_fs.have_MD5) {
MD5Init(&res_all.res_fs.md5c);
- res_all.res_fs.have_MD5 = TRUE;
+ res_all.res_fs.have_MD5 = true;
}
memset(&res_incexe, 0, sizeof(INCEXE));
res_all.res_fs.new_include = true;
- while ((token = lex_get_token(lc, T_ALL)) != T_EOF) {
- if (token == T_EOL) {
- continue;
- }
+ while ((token = lex_get_token(lc, T_SKIP_EOL)) != T_EOF) {
if (token == T_EOB) {
break;
}
options = strcasecmp(lc->str, "options") == 0;
if (strcasecmp(newinc_items[i].name, lc->str) == 0) {
if (!options) {
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_EQUALS) {
scan_err1(lc, "expected an equals, got: %s", lc->str);
}
regex_t preg;
char prbuf[500];
+ token = lex_get_token(lc, T_SKIP_EOL);
if (pass == 1) {
/* Pickup regex string
*/
- token = lex_get_token(lc, T_ALL);
switch (token) {
case T_IDENTIFIER:
case T_UNQUOTED_STRING:
default:
scan_err1(lc, _("Expected a regex string, got: %s\n"), lc->str);
}
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
{
int token;
+ token = lex_get_token(lc, T_NAME);
if (pass == 1) {
/*
* Pickup Base Job Name
*/
- token = lex_get_token(lc, T_NAME);
res_incexe.current_opts->base.append(bstrdup(lc->str));
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
{
int token;
+ token = lex_get_token(lc, T_NAME);
if (pass == 1) {
/*
* Pickup reader command
*/
- token = lex_get_token(lc, T_NAME);
res_incexe.current_opts->reader = bstrdup(lc->str);
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
{
int token;
+ token = lex_get_token(lc, T_NAME);
if (pass == 1) {
/*
* Pickup writer command
*/
- token = lex_get_token(lc, T_NAME);
res_incexe.current_opts->writer = bstrdup(lc->str);
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
{
int token;
+ token = lex_get_token(lc, T_SKIP_EOL);
if (pass == 1) {
/*
* Pickup Wild-card string
*/
- token = lex_get_token(lc, T_ALL);
switch (token) {
case T_IDENTIFIER:
case T_UNQUOTED_STRING:
default:
scan_err1(lc, _("Expected a wild-card string, got: %s\n"), lc->str);
}
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
int token;
INCEXE *incexe;
+ token = lex_get_token(lc, T_SKIP_EOL);
if (pass == 1) {
/* Pickup Filename string
*/
- token = lex_get_token(lc, T_ALL);
switch (token) {
case T_IDENTIFIER:
case T_UNQUOTED_STRING:
default:
scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
}
- } else { /* pass 2 */
- lex_get_token(lc, T_ALL);
}
scan_to_eol(lc);
}
{
int token, i;
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_BOB) {
scan_err1(lc, "Expecting open brace. Got %s", lc->str);
}
}
for (i=0; options_items[i].name; i++) {
if (strcasecmp(options_items[i].name, lc->str) == 0) {
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_EQUALS) {
scan_err1(lc, "expected an equals, got: %s", lc->str);
}
scan_err1(lc, "Keyword %s not permitted in this resource", lc->str);
}
}
- scan_to_eol(lc);
}
const char *build_addresses_str(dlist *addrs, char *buf, int blen)
{
- if (!addrs->size()) {
+ if (addrs->size() == 0) {
bstrncpy(buf, "", blen);
return buf;
}
return ((IPADDR *)(addrs->first()))->get_port_host_order();
}
-static int skip_to_next_not_eol(LEX * lc)
-{
- int token;
-
- do {
- token = lex_get_token(lc, T_ALL);
- } while (token == T_EOL);
- return token;
-}
-
-
void init_default_addresses(dlist **out, int port)
{
char *errstr;
} else if (iaddr->get_type() != type) {
*errstr = (char *)malloc(1024);
bsnprintf(*errstr, 1023,
- "the old style addresses could mixed with new style");
+ "the old style addresses cannot be mixed with new style");
return 0;
}
}
return 1;
}
+/*
+ * my tests
+ * positiv
+ * = { ip = { addr = 1.2.3.4; port = 1205; } ipv4 = { addr = 1.2.3.4; port = http; } }
+ * = { ip = {
+ * addr = 1.2.3.4; port = 1205; }
+ * ipv4 = {
+ * addr = 1.2.3.4; port = http; }
+ * ipv6 = {
+ * addr = 1.2.3.4;
+ * port = 1205;
+ * }
+ * ip = {
+ * addr = 1.2.3.4
+ * port = 1205
+ * }
+ * ip = {
+ * addr = 1.2.3.4
+ * }
+ * ip = {
+ * addr = 2001:220:222::2
+ * }
+ * ip = {
+ * addr = bluedot.thun.net
+ ( }
+ * }
+ * negativ
+ * = { ip = { } }
+ * = { ipv4 { addr = doof.nowaytoheavenxyz.uhu; } }
+ * = { ipv4 { port = 4711 } }
+ */
void store_addresses(LEX * lc, RES_ITEM * item, int index, int pass)
{
int token;
char port_str[128];
int family = 0;
-
-
- /*
- * = { [[ip|ipv4|ipv6] = { [[addr|port] = [^ ]+[\n;]+] }]+ }
- * or my tests
- * positiv
- * = { ip = { addr = 1.2.3.4; port = 1205; } ipv4 = { addr = 1.2.3.4; port = http; } }
- * = { ip = {
- * addr = 1.2.3.4; port = 1205; }
- * ipv4 = {
- * addr = 1.2.3.4; port = http; }
- * ipv6 = {
- * addr = 1.2.3.4;
- * port = 1205;
- * }
- * ip = {
- * addr = 1.2.3.4
- * port = 1205
- * }
- * ip = {
- * addr = 1.2.3.4
- * }
- * ip = {
- * addr = 2001:220:222::2
- * }
- * ip = {
- * addr = bluedot.thun.net
- ( }
- * }
- * negativ
- * = { ip = { } }
- * = { ipv4 { addr = doof.nowaytoheavenxyz.uhu; } }
- * = { ipv4 { port = 4711 } }
- */
-
- token = skip_to_next_not_eol(lc);
+
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_BOB) {
scan_err1(lc, _("Expected a block begin { , got: %s"), lc->str);
}
- token = skip_to_next_not_eol(lc);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token == T_EOB) {
scan_err0(lc, _("Empty addr block is not allowed"));
}
if (!(token == T_UNQUOTED_STRING || token == T_IDENTIFIER)) {
scan_err1(lc, _("Expected a string, got: %s"), lc->str);
}
- if (!strcmp("ip", lc->str) || !strcmp("ipv4", lc->str)) {
+ if (strcmp("ip", lc->str) == 0 || strcmp("ipv4", lc->str) == 0) {
family = AF_INET;
}
#ifdef HAVE_IPV6
- else if (!strcmp("ipv6", lc->str)) {
+ else if (strcmp("ipv6", lc->str) == 0) {
family = AF_INET6;
+ } else {
+ scan_err1(lc, _("Expected a string [ip|ipv4|ipv6], got: %s"), lc->str);
}
-#endif
+#else
else {
- scan_err1(lc, _("Expected a string [ip|ipv4|ipv6], got: %s"), lc->str);
+ scan_err1(lc, _("Expected a string [ip|ipv4], got: %s"), lc->str);
}
- token = skip_to_next_not_eol(lc);
+#endif
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_EQUALS) {
scan_err1(lc, _("Expected a equal =, got: %s"), lc->str);
}
- token = skip_to_next_not_eol(lc);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_BOB) {
scan_err1(lc, _("Expected a block beginn { , got: %s"), lc->str);
}
- token = skip_to_next_not_eol(lc);
+ token = lex_get_token(lc, T_SKIP_EOL);
exist = EMPTYLINE;
port_str[0] = hostname_str[0] = '\0';
do {
if (token != T_IDENTIFIER) {
scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
}
- if (!strcmp("port", lc->str)) {
+ if (strcmp("port", lc->str) == 0) {
next_line = PORTLINE;
if (exist & PORTLINE) {
scan_err0(lc, _("Only one port per address block"));
}
exist |= PORTLINE;
- } else if (!strcmp("addr", lc->str)) {
+ } else if (strcmp("addr", lc->str) == 0) {
next_line = ADDRLINE;
if (exist & ADDRLINE) {
scan_err0(lc, _("Only one addr per address block"));
} else {
scan_err1(lc, _("Expected a identifier [addr|port], got: %s"), lc->str);
}
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token != T_EQUALS) {
scan_err1(lc, _("Expected a equal =, got: %s"), lc->str);
}
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
switch (next_line) {
case PORTLINE:
if (!
break;
case ADDRLINE:
if (!(token == T_UNQUOTED_STRING || token == T_IDENTIFIER)) {
- scan_err1(lc, _("Expected a ipnumber or a hostname, got: %s"),
+ scan_err1(lc, _("Expected an IP number or a hostname, got: %s"),
lc->str);
}
bstrncpy(hostname_str, lc->str, sizeof(hostname_str));
break;
case EMPTYLINE:
- scan_err0(lc, _("Statemachine missmatch"));
+ scan_err0(lc, _("State machine missmatch"));
break;
}
- token = skip_to_next_not_eol(lc);
+ token = lex_get_token(lc, T_SKIP_EOL);
} while (token == T_IDENTIFIER);
if (token != T_EOB) {
scan_err1(lc, _("Expected a end of block }, got: %s"), lc->str);
hostname_str, port_str, errstr);
free(errstr);
}
- token = skip_to_next_not_eol(lc);
+ token = scan_to_next_not_eol(lc);
} while ((token == T_IDENTIFIER || token == T_UNQUOTED_STRING));
if (token != T_EOB) {
scan_err1(lc, _("Expected a end of block }, got: %s"), lc->str);
void store_addresses_address(LEX * lc, RES_ITEM * item, int index, int pass)
{
- int token = lex_get_token(lc, T_ALL);
+ int token = lex_get_token(lc, T_SKIP_EOL);
if (!(token == T_UNQUOTED_STRING || token == T_NUMBER || token == T_IDENTIFIER)) {
- scan_err1(lc, _("Expected a hostname or ipnummer, got: %s"), lc->str);
+ scan_err1(lc, _("Expected a hostname or IP nummer, got: %s"), lc->str);
}
char *errstr;
if (pass == 1 && !add_address((dlist **) (item->value), IPADDR::R_SINGLE_ADDR,
void store_addresses_port(LEX * lc, RES_ITEM * item, int index, int pass)
{
- int token = lex_get_token(lc, T_ALL);
+ int token = lex_get_token(lc, T_SKIP_EOL);
if (!(token == T_UNQUOTED_STRING || token == T_NUMBER || token == T_IDENTIFIER)) {
- scan_err1(lc, _("Expected a port nummer or string, got: %s"), lc->str);
+ scan_err1(lc, _("Expected a port number or string, got: %s"), lc->str);
}
char *errstr;
if (pass == 1 && !add_address((dlist **)(item->value), IPADDR::R_SINGLE_PORT,
/*
* Scan to "logical" end of line. I.e. end of line,
- * or semicolon.
+ * or semicolon, but stop on T_EOB (same as end of
+ * line except it is not eaten).
*/
void scan_to_eol(LEX *lc)
{
+ int token;
Dmsg0(2000, "start scan to eof\n");
- while (lex_get_token(lc, T_ALL) != T_EOL)
- { }
- Dmsg0(2000, "done scan to eof\n");
+ while ((token = lex_get_token(lc, T_ALL)) != T_EOL) {
+ if (token == T_EOB) {
+ lex_unget_char(lc);
+ return;
+ }
+ }
+}
+
+/*
+ * Get next token, but skip EOL
+ */
+int scan_to_next_not_eol(LEX * lc)
+{
+ int token;
+ do {
+ token = lex_get_token(lc, T_ALL);
+ } while (token == T_EOL);
+ return token;
}
{
int ch;
int token = T_NONE;
- int esc_next = FALSE;
+ bool esc_next = false;
Dmsg0(2000, "enter lex_get_token\n");
while (token == T_NONE) {
begin_str(lf, ch);
break;
case ';':
- token = T_EOL; /* treat ; like EOL */
+ if (expect != T_SKIP_EOL) {
+ token = T_EOL; /* treat ; like EOL */
+ }
break;
case L_EOL:
Dmsg0(2000, "got L_EOL set token=T_EOL\n");
- token = T_EOL;
+ if (expect != T_SKIP_EOL) {
+ token = T_EOL;
+ }
break;
case '@':
lf->state = lex_include;
Dmsg1(2000, "Lex state lex_comment ch=%x\n", ch);
if (ch == L_EOL) {
lf->state = lex_none;
- token = T_EOL;
+ if (expect != T_SKIP_EOL) {
+ token = T_EOL;
+ }
} else if (ch == L_EOF) {
token = T_ERROR;
}
break;
}
if (ch == L_EOL) {
- esc_next = FALSE;
+ esc_next = false;
break;
}
if (esc_next) {
add_str(lf, ch);
- esc_next = FALSE;
+ esc_next = false;
break;
}
if (ch == '\\') {
- esc_next = TRUE;
+ esc_next = true;
break;
}
if (ch == '"') {
#define T_EQUALS 110
#define T_COMMA 111
#define T_EOL 112
-#define T_SEMI 113
#define T_ERROR 200
/*
* The following will be returned only if
* the appropriate expect flag has been set
*/
+#define T_SKIP_EOL 113 /* scan through EOLs */
#define T_PINT32 114 /* positive integer */
#define T_PINT32_RANGE 115 /* positive integer range */
#define T_INT32 116 /* integer */
#define scan_err6(lc, msg, a1, a2, a3, a4, a5, a6) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3, a4, a5, a6)
void scan_to_eol(LEX *lc);
+int scan_to_next_not_eol(LEX * lc);
#endif /* _LEX_H */
token = lex_get_token(lc, T_NAME); /* scan destination */
dest = check_pool_memory_size(dest, dest_len + lc->str_len + 2);
if (dest[0] != 0) {
- pm_strcat(&dest, " "); /* separate multiple destinations with space */
+ pm_strcat(dest, " "); /* separate multiple destinations with space */
dest_len++;
}
- pm_strcat(&dest, lc->str);
+ pm_strcat(dest, lc->str);
dest_len += lc->str_len;
Dmsg2(900, "store_msgs newdest=%s: dest=%s:\n", lc->str, NPRT(dest));
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
if (token == T_COMMA) {
continue; /* get another destination */
}
dest = get_pool_memory(PM_MESSAGE);
/* Pick up a single destination */
token = lex_get_token(lc, T_NAME); /* scan destination */
- pm_strcpy(&dest, lc->str);
+ pm_strcpy(dest, lc->str);
dest_len = lc->str_len;
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
Dmsg1(900, "store_msgs dest=%s:\n", NPRT(dest));
if (token != T_EQUALS) {
scan_err1(lc, _("expected an =, got: %s"), lc->str);
uint64_t uvalue;
Dmsg0(900, "Enter store_size\n");
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
errno = 0;
switch (token) {
case T_NUMBER:
utime_t utime;
char period[500];
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
errno = 0;
switch (token) {
case T_NUMBER:
/* If the ITEM_NO_EQUALS flag is set we do NOT
* scan for = after the keyword */
if (!(items[i].flags & ITEM_NO_EQUALS)) {
- token = lex_get_token(lc, T_ALL);
+ token = lex_get_token(lc, T_SKIP_EOL);
Dmsg1 (900, "in T_IDENT got token=%s\n", lex_tok_to_str(token));
if (token != T_EQUALS) {
scan_err1(lc, _("expected an equals, got: %s"), lc->str);
{"sdaddresses", store_addresses, ITEM(res_store.sdaddrs), 0, ITEM_DEFAULT, 9103},
{"messages", store_res, ITEM(res_store.messages), 0, R_MSGS, 0},
{"sdport", store_addresses_port, ITEM(res_store.sdaddrs), 0, ITEM_DEFAULT, 9103},
- {"sddport", store_addresses_port, ITEM(res_store.sddaddrs), 0, 0, 0}, /* deprecated */
{"workingdirectory", store_dir, ITEM(res_store.working_directory), 0, ITEM_REQUIRED, 0},
{"piddirectory", store_dir, ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
{"subsysdirectory", store_dir, ITEM(res_store.subsys_directory), 0, 0, 0},
/* */
#undef VERSION
#define VERSION "1.35.3"
-#define BDATE "06 September 2004"
-#define LSMDATE "06Sep04"
+#define BDATE "07 September 2004"
+#define LSMDATE "07Sep04"
/* Debug flags */
#undef DEBUG