Ticket #378: list_esc.diff

File list_esc.diff, 876 bytes (added by reimar, 20 years ago)

quoting for list options

  • m_option.c

    RCS file: /cvsroot/mplayer/main/m_option.c,v
    retrieving revision 1.48
    diff -u -r1.48 m_option.c
     
    560560  n = 0;
    561561
    562562  while(1) {
     563    if (ptr[0] == '"') {
     564      last_ptr = &ptr[1];
     565      ptr = strchr(last_ptr, '"');
     566      if (!ptr || (ptr[1] && ptr[1] != LIST_SEPARATOR)) {
     567        res[n] = NULL;
     568        free_str_list(res);
     569        return M_OPT_PARSER_ERR;
     570      }
     571      len = ptr - last_ptr;
     572      ptr++;
     573    } else {
    563574    last_ptr = ptr;
    564575    ptr = strchr(ptr,LIST_SEPARATOR);
    565576    if(!ptr) {
     
    568579      break;
    569580    }
    570581    len = ptr - last_ptr;
     582    }
    571583    res[n] = (char*)malloc(len + 1);
    572584    if(len) strncpy(res[n],last_ptr,len);
    573585    res[n][len] = '\0';