Changeset 1429


Ignore:
Timestamp:
May 10, 2007, 12:49:13 AM (12 years ago)
Author:
bruno
Message:

Should solve mix and match of comments and quotes in conf file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/lib/mr_conf.c

    r1428 r1429  
    287287    size_t k;                   /*conditioned iterator for tmp_buffer */
    288288    bool found_quote = FALSE;
     289    bool found_comment = FALSE;
    289290
    290291    length = strlen(buffer);
     
    295296    while (i < length) {
    296297        /* Handle quotes to detect strings */
    297         if (buffer[i] == '"') {
     298        if ((buffer[i] == '"') && (! found_comment)) {
    298299            if (found_quote) {
    299300                found_quote = FALSE;
     
    302303            }
    303304        }
    304         if ((buffer[i] != MRCONF_COMM_CHAR) || (found_quote)) {
     305        /* Handle start of comment - only when not in a string */
     306        if (buffer[i] == MRCONF_COMM_CHAR) {
     307            if (found_quote) {
     308                found_comment = FALSE;
     309            } else {
     310                found_comment = TRUE;
     311            }
     312        }
     313        /* Comments end with EOL */
     314        if (buffer[i] == '\n') {
     315            found_comment = FALSE;
     316        }
     317        if (! found_comment) {
    305318            k++;
    306319            i++;
    307320        } else {
    308             /* Skip comment as it's not inside a string */
     321            /* Skip comment */
    309322            while ((buffer[i] != '\n') && (buffer[i] != (char) 0)) {
    310323                i++;
Note: See TracChangeset for help on using the changeset viewer.