Branch: Tag:

2010-10-10

2010-10-10 21:56:29 by Martin Stjernholm <mast@lysator.liu.se>

Treat CR as a whitespace char in split_quoted_string.

343:   //!   //! @ul   //! @item - //! Sequences of whitespace, i.e. space, tab or newline, are treated - //! as argument separators by default. + //! Sequences of whitespace, i.e. space, tab, @expr{\n@} or + //! @expr{\r@}, are treated as argument separators by default.   //!   //! @item   //! Single or double quotes (@expr{'@} or @expr{"@}) can be used
379:   //! @endul   {    // Remove initial white-space. -  sscanf(s,"%*[ \n\t]%s",s); +  sscanf(s,"%*[ \t\n\r]%s",s);       // Prefix interesting characters with NUL,    // and split on NUL.    s=replace(s, -  ({"\"", "'", "\\", " ", "\t", "\n", "\0"}), -  ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n", "\0\0"})); +  ({"\"", "'", "\\", " ", "\t", "\n", "\r", "\0"}), +  ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n", "\0\r", "\0\0"}));    array(string) x=s/"\0";    array(string) ret = ({});    string last = x[0];
441:    case ' ':    case '\t':    case '\n': +  case '\r':    while(sizeof(piece)==1)    {    if(e+1 < sizeof(x))    { -  if((<' ','\t','\n'>) [x[e+1][0]]) +  if((<' ','\t','\n', '\r'>) [x[e+1][0]])    piece = x[++e];    else    break;