Changeset 1427 in MondoRescue for branches/stable


Ignore:
Timestamp:
May 9, 2007, 12:15:34 PM (17 years ago)
Author:
Bruno Cornec
Message:

String detection corrected

File:
1 edited

Legend:

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

    r1426 r1427  
    5858#define MRCONF_STR_CALL_BUT_NOT_OPEN _("attempt to use mr_conf when it has not been opened yet")
    5959#define MRCONF_STR_STRING_QUOTE     _("string should be surrounded by quotes")
     60#define MRCONF_STR_STRING_ENDQUOTE      _("a string is not finished by a quote")
    6061
    6162/*Flags of internal state*/
     
    293294    i = 0;
    294295    while (i < length) {
    295         /* Handle quotes */
     296        /* Handle quotes to detect strings */
    296297        if (buffer[i] == '"') {
    297298            if (found_quote) {
     
    301302            }
    302303        }
    303         if ((buffer[i] != MRCONF_COMM_CHAR) && (! found_quote)){
     304        if ((buffer[i] != MRCONF_COMM_CHAR) || (found_quote)) {
    304305            k++;
    305306            i++;
    306307        } else {
     308            /* Skip comment as it's not inside a string */
    307309            while ((buffer[i] != '\n') && (buffer[i] != (char) 0)) {
    308310                i++;
     311            }
     312            if (buffer[i] == (char) 0) {
     313                mr_conf_error_msg(MRCONF_STRING_ENDQUOTE, "");
    309314            }
    310315        }
     
    323328            }
    324329        }
    325         if ((buffer[i] != MRCONF_COMM_CHAR) && (! found_quote)){
     330        if ((buffer[i] != MRCONF_COMM_CHAR) || (found_quote)) {
    326331            tmp_buf[k++] = buffer[i++];
    327332        } else {
     333            /* Skip comment as it's not inside a string */
    328334            while ((buffer[i] != '\n') && (buffer[i] != (char) 0)) {
    329335                i++;
Note: See TracChangeset for help on using the changeset viewer.