Branch: Tag:

2000-07-11

2000-07-11 20:42:22 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

fixed Process.split_quoted_string

Rev: lib/modules/Process.pmod:1.24

34:      array(string) split_quoted_string(string s)   { -  s=replace(s, ({"\"","'","\\"," "}), ({"\0\"","\0'","\0\\","\0 "})); +  s=replace(s, +  ({"\"", "'", "\\", " ", "\t", "\n"}), +  ({"\0\"","\0'","\0\\","\0 ","\0\t","\0\n"}));    array(string) x=s/"\0";    array(string) ret=({x[0]});   
44:    {    case '"':    ret[-1]+=x[e][1..]; -  while(x[++e][0]!='"') ret[-1]+=x[e]; +  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..];    break;   
64:    break;       case ' ': -  if(strlen(x[e]) > 1 || sizeof(x)==e+1 || x[e+1][0]!=' ') +  case '\t': +  case '\n': +  while(strlen(x[e])==1 && (<' ','\t','\n'>) [x[e][0]] ) +  if(++e >= sizeof(x)) +  return ret;    ret+=({x[e][1..]});    break;