@@ -120,35 +120,35 @@ /* Remove trailing crap (but not spaces). */ linebuf_ptr = &linebuf[strlen(linebuf) - 1]; while (*linebuf_ptr < ' ' && linebuf_ptr >= linebuf) { *linebuf_ptr = '\0'; - *linebuf_ptr--; + linebuf_ptr--; } /* Remove leading spaces. */ linebuf_ptr = &linebuf[0]; while (*linebuf_ptr == ' ' || *linebuf_ptr == '\t') { - *linebuf_ptr++; + linebuf_ptr++; } /* Handle section header. */ if (linebuf_ptr[0] == '<' && linebuf_ptr[strlen(linebuf_ptr) - 1] == '>') { /* Remove < and > from around the data. */ linebuf_ptr[strlen(linebuf_ptr) - 1] = '\0'; - *linebuf_ptr++; + linebuf_ptr++; /* Lowercase the command part of the section. */ tmp_ptr = linebuf_ptr; while (*tmp_ptr != '\0' && *tmp_ptr != ' ') { *tmp_ptr = tolower(*tmp_ptr); - *tmp_ptr++; + tmp_ptr++; } /* If this is a close section command, handle it */ if (linebuf_ptr[0] == '/') { - *linebuf_ptr++; + linebuf_ptr++; cmd = linebuf_ptr; /* Find the last section closed. */ tmp_ptr = strrchr(qualifbuf, '.'); if (tmp_ptr == NULL) { @@ -157,22 +157,26 @@ } else { lastsection = tmp_ptr + 1; } if (strcmp(cmd, lastsection) != 0) { - PRINTERR_D("Section closing does not match last opened section."); - PRINTERR_D("Last opened = \"%s\", Closing = \"%s\"", lastsection, cmd); +#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_errno = LC_ERR_BADFORMAT; /* For this error, we abort immediately. */ break; } lcpvret = lc_process_var(qualifbuf, NULL, NULL, LC_FLAGS_SECTIONEND); if (lcpvret < 0) { - PRINTERR_D("Invalid section terminating: \"%s\"", qualifbuf); +#ifdef DEBUG + fprintf(stderr, "Invalid section terminating: \"%s\"\n", qualifbuf); +#endif } /* Remove the "lastsection" part.. */ *tmp_ptr = '\0'; @@ -195,21 +199,21 @@ sep = strpbrk(linebuf_ptr, " \t"); if (sep != NULL) { cmdend = sep; /* Delete space at the end of the command. */ - *cmdend--; /* It currently derefs to the seperator.. */ + cmdend--; /* It currently derefs to the seperator.. */ while (*cmdend <= ' ') { *cmdend = '\0'; - *cmdend--; + cmdend--; } /* Delete the seperator char and any leading space. */ *sep = '\0'; - *sep++; + sep++; while (*sep == ' ' || *sep == '\t') { - *sep++; + sep++; } value = sep; } else { /* XXX: should this be "" or NULL ? */ value = ""; @@ -222,11 +226,13 @@ } strncat(qualifbuf, cmd, sizeof(qualifbuf) - strlen(qualifbuf) - 1); lcpvret = lc_process_var(qualifbuf, value, NULL, LC_FLAGS_SECTIONSTART); if (lcpvret < 0) { - PRINTERR_D("Invalid section: \"%s\"", qualifbuf); +#ifdef DEBUG + fprintf(stderr, "Invalid section: \"%s\"\n", qualifbuf); +#endif invalid_section = 1; lc_errno = LC_ERR_INVSECTION; retval = -1; } if (lcpvret == LC_CBRET_IGNORESECTION) { @@ -240,35 +246,39 @@ continue; } /* Don't handle things for a section that doesn't exist. */ if (invalid_section == 1) { - PRINTERR_D("Ignoring line (because invalid section): %s", linebuf); +#ifdef DEBUG + fprintf(stderr, "Ignoring line (because invalid section): %s\n", linebuf); +#endif continue; } if (ignore_section == 1) { - PRINTERR_D("Ignoring line (because ignored section): %s", linebuf); +#ifdef DEBUG + fprintf(stderr, "Ignoring line (because ignored section): %s\n", linebuf); +#endif continue; } /* Find the command and the data in the line. */ sep = strpbrk(linebuf_ptr, " \t"); if (sep != NULL) { cmdend = sep; /* Delete space at the end of the command. */ - *cmdend--; /* It currently derefs to the seperator.. */ + cmdend--; /* It currently derefs to the seperator.. */ while (*cmdend <= ' ') { *cmdend = '\0'; - *cmdend--; + cmdend--; } /* Delete the seperator char and any leading space. */ *sep = '\0'; - *sep++; + sep++; while (*sep == ' ' || *sep == '\t') { - *sep++; + sep++; } value = sep; } else { value = NULL; } @@ -278,17 +288,21 @@ /* Handle special commands. */ if (strcasecmp(cmd, "include") == 0) { if (value == NULL) { lc_errno = LC_ERR_BADFORMAT; retval = -1; - PRINTERR_D("Invalid include command."); +#ifdef DEBUG + fprintf(stderr, "Invalid include command.\n"); +#endif continue; } lpcafret = lc_process_conf_apache_include(value, qualifbuf); if (lpcafret < 0) { - PRINTERR_D("Error in included file."); +#ifdef DEBUG + fprintf(stderr, "Error in included file.\n"); +#endif retval = -1; } continue; } @@ -302,14 +316,18 @@ save_lc_errno = lc_errno; lc_errno = LC_ERR_NONE; lcpvret = lc_process_var(qualifbuf, NULL, value, LC_FLAGS_VAR); if (lcpvret < 0) { if (lc_errno == LC_ERR_NONE) { - PRINTERR_D("Invalid command: \"%s\"", cmd); +#ifdef DEBUG + fprintf(stderr, "Invalid command: \"%s\"\n", cmd); +#endif lc_errno = LC_ERR_INVCMD; } else { - PRINTERR_D("Error processing command (command was valid, but an error occured, errno was set)"); +#ifdef DEBUG + fprintf(stderr, "Error processing command (command was valid, but an error occured, errno was set)\n"); +#endif } retval = -1; } else { lc_errno = save_lc_errno; }