Overview
Comment: | Added filename and line numbers to error messages. Began adding support for lists of options rather than just one option per item. libconfig 0.1.19 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | 0.1.19 |
Files: | files | file ages | folders |
SHA1: |
730308bffd7be6879a2c9c32d1eb7ee8 |
User & Date: | rkeene on 2005-09-30 08:27:32 |
Other Links: | manifest | tags |
Context
2005-10-18
| ||
16:00 | Added missing error line/file information for conf_apache libconfig 0.1.20 check-in: b9a32192b7 user: rkeene tags: 0.1.20, trunk | |
2005-09-30
| ||
08:27 | Added filename and line numbers to error messages. Began adding support for lists of options rather than just one option per item. libconfig 0.1.19 check-in: 730308bffd user: rkeene tags: 0.1.19, trunk | |
2005-07-18
| ||
11:54 | Updated configure process on Win32 to use DLL base. Fixed "lc_cleanup" causing segfaults. check-in: 793852910f user: rkeene tags: 0.1.18, trunk | |
Changes
Modified Makefile.in from [e7001c02f6] to [53b907f18c].
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | + | SHOBJFLAGS = @SHOBJFLAGS@ SHOBJLDFLAGS = @SHOBJLDFLAGS@ SHOBJEXT = @SHOBJEXT@ ARFLAGS = # @ARFLAGS@ AREXT = @AREXT@ PKGVERS = @PACKAGE_VERSION@ PKGVERSMAJOR = `echo $(PKGVERS) | cut -f 1 -d .` EXEEXT = @EXEEXT@ prefix = @prefix@ mandir = @mandir@ sysconfdir = @sysconfdir@ datadir = @datadir@ exec_prefix = @exec_prefix@ bindir = @bindir@ |
︙ |
Modified build/h-to-hin from [e6b4d57000] to [34a6b6eb8a].
1 2 3 4 | 1 2 3 4 5 6 7 8 9 | - + | #! /bin/sh if [ libconfig.h -nt libconfig.h.in ]; then echo 'Updating libconfig.h.in ...' |
Added build/test.conf version [9a98f498a7].
|
Modified compat.h from [e7ac67c392] to [b6a11fd72e].
︙ | |||
84 85 86 87 88 89 90 91 92 93 94 95 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | + + + + + + + + | #endif #ifdef HAVE_OPENNET_H #include <opennet.h> #endif #ifdef HAVE_LIBOPENNET #define lc_fopen(path, mode) fopen_net(path, mode) #define lc_fgets(buf, size, stream) fgets_net(buf, size, stream) #define lc_feof(stream) feof_net(stream) #define lc_fclose(stream) fclose_net(stream) #define LC_FILE NETFILE #else #define lc_fopen(path, mode) fopen(path, mode) #define lc_fgets(buf, size, stream) fgets(buf, size, stream) #define lc_feof(stream) feof(stream) #define lc_fclose(stream) fclose(stream) #define LC_FILE FILE #endif #endif |
Modified conf_apache.c from [cd77d73d2e] to [dfc17c3008].
︙ | |||
77 78 79 80 81 82 83 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | - + + + + + + + + + + - + - + + + | } } return(retval); } static int lc_process_conf_apache_file(const char *configfile, const char *pathprefix) { |
︙ | |||
160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | + + | if (strcmp(cmd, lastsection) != 0) { #ifdef DEBUG fprintf(stderr, "Section closing does not match last opened section.\n"); fprintf(stderr, "Last opened = \"%s\", Closing = \"%s\"\n", lastsection, cmd); #endif retval = -1; lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_BADFORMAT; /* For this error, we abort immediately. */ break; } lcpvret = lc_process_var(qualifbuf, NULL, NULL, LC_FLAGS_SECTIONEND); |
︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | + + | lcpvret = lc_process_var(qualifbuf, value, NULL, LC_FLAGS_SECTIONSTART); if (lcpvret < 0) { #ifdef DEBUG fprintf(stderr, "Invalid section: \"%s\"\n", qualifbuf); #endif invalid_section = 1; lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_INVSECTION; retval = -1; } if (lcpvret == LC_CBRET_IGNORESECTION) { ignore_section = 1; } continue; |
︙ | |||
284 285 286 287 288 289 290 291 292 293 294 295 296 297 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | + + | } cmd = linebuf_ptr; /* Handle special commands. */ if (strcasecmp(cmd, "include") == 0) { if (value == NULL) { lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_BADFORMAT; retval = -1; #ifdef DEBUG fprintf(stderr, "Invalid include command.\n"); #endif continue; } |
︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | + + - + | #endif lc_errno = LC_ERR_INVCMD; } else { #ifdef DEBUG fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n"); #endif } lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; retval = -1; } else { lc_errno = save_lc_errno; } /* Remove the "cmd" part of the buffer. */ tmp_ptr = strrchr(qualifbuf, '.'); if (tmp_ptr == NULL) { tmp_ptr = qualifbuf; } *tmp_ptr = '\0'; } |
Modified conf_section.c from [f6fa72ff6b] to [291ca9d7b9].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + + + + + + + + + + - + - + + + | #endif #ifdef HAVE_STRING_H #include <string.h> #endif int lc_process_conf_section(const char *appname, const char *configfile) { |
︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + | currsection = strdup(linebuf_ptr); lcpvret = lc_process_var(currsection, NULL, NULL, LC_FLAGS_SECTIONSTART); if (lcpvret < 0) { #ifdef DEBUG fprintf(stderr, "Invalid section: \"%s\"\n", currsection); #endif invalid_section = 1; lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_INVSECTION; retval = -1; } else { invalid_section = 0; ignore_section = 0; } |
︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | + + - + | #endif lc_errno = LC_ERR_INVCMD; } else { #ifdef DEBUG fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n"); #endif } lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; retval = -1; } else { lc_errno = save_lc_errno; } } /* Close any open section, and clean-up. */ if (currsection != NULL) { lcpvret = lc_process_var(currsection, NULL, NULL, LC_FLAGS_SECTIONEND); if (lcpvret < 0) { #ifdef DEBUG fprintf(stderr, "Invalid section terminating: \"%s\"\n", currsection); #endif } free(currsection); } |
Modified conf_space.c from [22b1310a4a] to [0072873b48].
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + + + + + + + + + + - + - + + + | #endif #ifdef HAVE_STRING_H #include <string.h> #endif int lc_process_conf_space(const char *appname, const char *configfile) { |
︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | + + - + | #endif lc_errno = LC_ERR_INVCMD; } else { #ifdef DEBUG fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n"); #endif } lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; retval = -1; } else { lc_errno = save_lc_errno; } } |
Modified configure.ac from [9c0f5749ef] to [e806c2cabd].
1 | 1 2 3 4 5 6 7 8 9 | - + | AC_REVISION($Revision $) |
︙ |
Modified libconfig.c from [9adb43042b] to [341b40c218].
︙ | |||
34 35 36 37 38 39 40 41 42 43 44 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | + + - + + + - + + + + + - + - + - - - - - + | #ifdef HAVE_PWD_H #include <pwd.h> #endif struct lc_varhandler_st *varhandlers = NULL; lc_err_t lc_errno = LC_ERR_NONE; const char *lc_errfile = NULL; int lc_optind = 0; int lc_errline = 0; extern char **environ; |
︙ | |||
94 95 96 97 98 99 100 101 102 103 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | + + - + - + - + - + - + - + - + - + - + + + - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + | break; } dotptr++; } *dataval = retval; *endptr = (char *) dotptr; return(0); } |
︙ | |||
202 203 204 205 206 207 208 | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | - + - + - + - + - + - + - + - + - + - + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + | break; } } return(retval); } |
︙ | |||
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | + + + + + + + | size_t appnamelen = 0; char varnamebuf[128] = {0}; char **currvar; char *sep = NULL, *value = NULL, *cmd = NULL; char *ucase_appname = NULL, *ucase_appname_itr = NULL; char *lastcomponent_handler = NULL; int varnamelen = 0; char *local_lc_errfile; int local_lc_errline; /* Make sure we have an environment to screw with, if not, no arguments were found to be in error */ if (environ == NULL || appname == NULL) { return(0); } local_lc_errfile = "<environment>"; local_lc_errline = 0; /* Allocate and create our uppercase appname. */ ucase_appname = strdup(appname); if (ucase_appname == NULL) { lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_ENOMEM; return(-1); } for (ucase_appname_itr = ucase_appname; *ucase_appname_itr != '\0'; ucase_appname_itr++) { *ucase_appname_itr = toupper(*ucase_appname_itr); } |
︙ | |||
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | + + + + + + + + + - + | char *lastcomponent_handler = NULL; char **newargv = NULL; char *usedargv = NULL; int cmdargidx = 0; int newargvidx = 0; int retval = 0, chkretval = 0; int ch = 0; char *local_lc_errfile; int local_lc_errline; local_lc_errfile = "<cmdline>"; local_lc_errline = 0; /* Allocate "argc + 1" (+1 for the NULL terminator) elements. */ newargv = malloc((argc + 1) * sizeof(*newargv)); if (newargv == NULL) { lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_ENOMEM; return(-1); } newargv[newargvidx++] = argv[0]; newargv[argc] = NULL; /* Allocate space to indicate which arguments have been used. */ usedargv = malloc(argc * sizeof(*usedargv)); if (usedargv == NULL) { lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_ENOMEM; free(newargv); return(-1); } for (cmdargidx = 0; cmdargidx < argc; cmdargidx++) { usedargv[cmdargidx] = 0; } for (cmdargidx = 1; cmdargidx < argc; cmdargidx++) { cmdarg = argv[cmdargidx]; /* Make sure we have an argument here. */ if (cmdarg == NULL) { break; } |
︙ | |||
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | + + + + | if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) { cmdoptarg = NULL; } else { cmdargidx++; if (cmdargidx >= argc) { fprintf(stderr, "Argument required.\n"); lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_BADFORMAT; free(usedargv); free(newargv); return(-1); } cmdoptarg = argv[cmdargidx]; newargv[newargvidx++] = cmdoptarg; usedargv[cmdargidx] = 1; } chkretval = lc_handle(handler, handler->var, NULL, cmdoptarg, LC_FLAGS_CMDLINE); if (chkretval < 0) { retval = -1; } break; } if (handler == NULL) { fprintf(stderr, "Unknown option: --%s\n", cmdarg); lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_INVCMD; free(usedargv); free(newargv); return(-1); } } else { for (; *cmdarg != '\0'; cmdarg++) { |
︙ | |||
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | + + + + + + | if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) { cmdoptarg = NULL; } else { cmdargidx++; if (cmdargidx >= argc) { fprintf(stderr, "Argument required.\n"); lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_BADFORMAT; free(usedargv); free(newargv); return(-1); } cmdoptarg = argv[cmdargidx]; newargv[newargvidx++] = cmdoptarg; usedargv[cmdargidx] = 1; } chkretval = lc_handle(handler, handler->var, NULL, cmdoptarg, LC_FLAGS_CMDLINE); if (chkretval < 0) { lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; retval = -1; } break; } if (handler == NULL) { fprintf(stderr, "Unknown option: -%c\n", ch); lc_errfile = local_lc_errfile; lc_errline = local_lc_errline; lc_errno = LC_ERR_INVCMD; free(usedargv); free(newargv); return(-1); } } } |
︙ | |||
937 938 939 940 941 942 943 | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | + - + - + - + - + - + - + - + - + - + + + + + + + + - - - - - - + + + + + + + + + + | lc_errno = LC_ERR_NONE; return(retval); } char *lc_geterrstr(void) { static char retval[512]; |
Modified libconfig.h.in from [46fa13e1cf] to [6dd0b27349].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | - + + + + + | !ifndef _RSK_LIBCONFIG_H !define _RSK_LIBCONFIG_H |
︙ | |||
35 36 37 38 39 40 41 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - - - - - - + + + + + + | LC_VAR_TIME, LC_VAR_DATE, LC_VAR_SECTION, LC_VAR_SECTIONSTART, LC_VAR_SECTIONEND, LC_VAR_BOOL_BY_EXISTANCE, LC_VAR_SIZE_SIZE_T, |
︙ | |||
87 88 89 90 91 92 93 94 95 96 | 91 92 93 94 95 96 97 98 99 100 101 102 | + - | !define LC_CBRET_ERROR (-1) __BLANK_LINE__ extern int lc_optind; __BLANK_LINE__ !ifdef __cplusplus } !endif |
Modified libconfig_private.h from [0dfd11fd0f] to [8f8355315c].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + + | #ifndef _RSK_LIBCONFIG_PRIVATE_H #define _RSK_LIBCONFIG_PRIVATE_H #include "libconfig.h" extern lc_err_t lc_errno; extern int lc_errline; extern const char *lc_errfile; int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags); struct lc_varhandler_st; struct lc_varhandler_st { struct lc_varhandler_st *_next; |
︙ |
Modified test-lc.c from [5bdc823df0] to [ae325a3444].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + - + + + + + + - + + | int main(int argc, char **argv) { char *joeval = NULL; size_t xval = -1; int onoff = -1; int lcpret = -1; int i = 0; int onoff2 = 0; |
︙ |