pike.git / lib / modules / Process.pmod

version» Context lines:

pike.git/lib/modules/Process.pmod:3:   constant create_process = __builtin.create_process;      //!   class Process   {    inherit __builtin.create_process;       //!    void create( string|array(string) args, mapping m )    { -  if( stringp( args ) ) -  args = split_quoted_string( args ); +  if( stringp( args ) ) { +  args = split_quoted_string( [string]args + #ifdef __NT__ +  ,1 + #endif /* __NT__ */ +  ); +  }    if( m )    ::create( args, m );    else    ::create( args );    }   }      //!   int exec(string file,string ... foo)   {
pike.git/lib/modules/Process.pmod:80:      //!   string sh_quote(string s)   {    return replace(s,    ({"\\", "'", "\"", " "}),    ({"\\\\", "\\'", "\\\"","\\ "}));   }      //! - array(string) split_quoted_string(string s) + array(string) split_quoted_string(string s, int(0..1)|void nt_mode)   { -  +  // Remove initial white-space.    sscanf(s,"%*[ \n\t]%s",s); -  +  +  // Prefix interresting characters with NUL, +  // and split on NUL.    s=replace(s, -  ({"\"", "'", "\\", " ", "\t", "\n"}), -  ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n"})); +  ({"\"", "'", "\\", " ", "\t", "\n", "\0"}), +  ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n", "\0\0"}));    array(string) x=s/"\0";    array(string) ret=({x[0]});       for(int e=1;e<sizeof(x);e++)    { -  +  if (!sizeof(x[e])) { +  // Escaped NUL. +  ret[-1] += "\0"; +  e++; +  continue; +  }    switch(x[e][0])    {    case '"':    ret[-1]+=x[e][1..];    while(x[++e][0]!='"')    {    if(strlen(x[e])==1 && x[e][0]=='\\' && x[e+1][0]=='"') e++;    ret[-1]+=x[e];    }    ret[-1]+=x[e][1..];
pike.git/lib/modules/Process.pmod:112:       case '\'':    ret[-1]+=x[e][1..];    while(x[++e][0]!='\'') ret[-1]+=x[e];    ret[-1]+=x[e][1..];    break;       case '\\':    if(strlen(x[e])>1)    { +  if (nt_mode) { +  // On NT we only escape special characters with \; +  // other \'s we keep verbatim. +  ret[-1]+=x[e]; +  } else {    ret[-1]+=x[e][1..]; -  +  }    }else{ -  +  // Escaped special character.    ret[-1]+=x[++e];    }    break;       case ' ':    case '\t':    case '\n':    while(strlen(x[e])==1)    {    if(e+1 < sizeof(x))