pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:336:    ({"\\", "'", "\"", " "}),    ({"\\\\", "\\'", "\\\"","\\ "}));   }      array(string) split_quoted_string(string s, int(0..1)|void nt_mode)   //! Splits the given string into a list of arguments, according to   //! common (i.e. @expr{/bin/sh@}-based) command line quoting rules:   //!   //! @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   //! around an argument to avoid whitespace splitting inside it. If   //! such quoted strings are used next to each other then they get   //! concatenated to one argument; e.g. @expr{a"b"'c'@} becomes a   //! single argument @expr{abc@}.   //!   //! @item   //! Backslash (@expr{\@}) can be used in front of one of the space
pike.git/lib/modules/Process.pmod:372:   //! @item   //! Backslashes are treated literally inside quoted strings, with   //! the exception that @expr{\"@} is treated as a literal @expr{"@}   //! inside a @expr{"@}-quoted string. It's therefore possible to   //! include a literal @expr{"@} in a @expr{"@}-quoted string, as   //! opposed to @expr{'@}-quoted strings which cannot contain a   //! @expr{'@}.   //! @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];    int always_keep_last;      piece_loop:    for(int e=1;e<sizeof(x);e++)    {    string piece = x[e];    if (!sizeof(piece)) {
pike.git/lib/modules/Process.pmod:434:    }    }else if (sizeof (x) > e + 1) {    // Escaped special character.    last+=x[++e];    }    break;       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;    }else{    break piece_loop;    }    }    if (sizeof (last) || always_keep_last)    ret += ({last});    last = piece[1..];