ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/conf.C
(Generate patch)

Comparing gvpe/src/conf.C (file contents):
Revision 1.55 by root, Sun Mar 6 19:40:28 2011 UTC vs.
Revision 1.56 by root, Sun Mar 6 21:01:36 2011 UTC

212 else if (!strcmp (val, "true")) target = trueval; \ 212 else if (!strcmp (val, "true")) target = trueval; \
213 else if (!strcmp (val, "false")) target = falseval; \ 213 else if (!strcmp (val, "false")) target = falseval; \
214 else if (!strcmp (val, "on")) target = trueval; \ 214 else if (!strcmp (val, "on")) target = trueval; \
215 else if (!strcmp (val, "off")) target = falseval; \ 215 else if (!strcmp (val, "off")) target = falseval; \
216 else \ 216 else \
217 return _("illegal boolean value, only 'yes|true|on' or 'no|false|off' allowed. (ignored)"); \ 217 return _("illegal boolean value, only 'yes|true|on' or 'no|false|off' allowed, ignored"); \
218} while (0) 218} while (0)
219 219
220const char * 220const char *
221configuration_parser::parse_line (char *line) 221configuration_parser::parse_line (char *line)
222{ 222{
240 return 0; /* comment: ignore */ 240 return 0; /* comment: ignore */
241 241
242 char *val = strtok (NULL, "\t\n\r ="); 242 char *val = strtok (NULL, "\t\n\r =");
243 243
244 if (!val || val[0] == '#') 244 if (!val || val[0] == '#')
245 return _("no value given for variable. (ignored)"); 245 return _("no value given for variable, ignored");
246 246
247 else if (!strcmp (var, "on")) 247 else if (!strcmp (var, "on"))
248 { 248 {
249 if (!::thisnode 249 if (::thisnode
250 || (val[0] == '!' && strcmp (val + 1, ::thisnode)) 250 && ((val[0] == '!' && strcmp (val + 1, ::thisnode))
251 || !strcmp (val, ::thisnode)) 251 || !strcmp (val, ::thisnode)))
252 return parse_line (strtok (NULL, "\n\r")); 252 return parse_line (strtok (NULL, "\n\r"));
253 } 253 }
254 254
255 else if (!strcmp (var, "include")) 255 else if (!strcmp (var, "include"))
256 { 256 {
263 else if (!strcmp (var, "loglevel")) 263 else if (!strcmp (var, "loglevel"))
264 { 264 {
265 loglevel l = string_to_loglevel (val); 265 loglevel l = string_to_loglevel (val);
266 266
267 if (l == L_NONE) 267 if (l == L_NONE)
268 return _("unknown loglevel. (skipping)"); 268 return _("unknown loglevel, ignored");
269 } 269 }
270 else if (!strcmp (var, "ip-proto")) 270 else if (!strcmp (var, "ip-proto"))
271 conf.ip_proto = atoi (val); 271 conf.ip_proto = atoi (val);
272 else if (!strcmp (var, "icmp-type")) 272 else if (!strcmp (var, "icmp-type"))
273 { 273 {
449 else if (!strcmp (val, "always")) 449 else if (!strcmp (val, "always"))
450 node->connectmode = conf_node::C_ALWAYS; 450 node->connectmode = conf_node::C_ALWAYS;
451 else if (!strcmp (val, "disabled")) 451 else if (!strcmp (val, "disabled"))
452 node->connectmode = conf_node::C_DISABLED; 452 node->connectmode = conf_node::C_DISABLED;
453 else 453 else
454 return _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled'. (ignored)"); 454 return _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', ignored");
455 } 455 }
456 else if (!strcmp (var, "inherit-tos")) 456 else if (!strcmp (var, "inherit-tos"))
457 parse_bool (node->inherit_tos, "inherit-tos", true, false); 457 parse_bool (node->inherit_tos, "inherit-tos", true, false);
458 else if (!strcmp (var, "compress")) 458 else if (!strcmp (var, "compress"))
459 parse_bool (node->compress, "compress", true, false); 459 parse_bool (node->compress, "compress", true, false);
556{ 556{
557 if (FILE *f = fopen (fname, "r")) 557 if (FILE *f = fopen (fname, "r"))
558 { 558 {
559 char line [2048]; 559 char line [2048];
560 int lineno = 0; 560 int lineno = 0;
561 node = &conf.default_node;
562 561
563 while (fgets (line, sizeof (line), f)) 562 while (fgets (line, sizeof (line), f))
564 { 563 {
565 lineno++; 564 lineno++;
566 565
588: conf (conf),need_keys (need_keys), argc (argc), argv (argv) 587: conf (conf),need_keys (need_keys), argc (argc), argv (argv)
589{ 588{
590 char *fname; 589 char *fname;
591 590
592 conf.clear (); 591 conf.clear ();
592 node = &conf.default_node;
593 593
594 asprintf (&fname, "%s/gvpe.conf", confbase); 594 asprintf (&fname, "%s/gvpe.conf", confbase);
595 parse_file (fname); 595 parse_file (fname);
596 free (fname); 596 free (fname);
597 597

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines