On Fri, Aug 19, 2011 at 02:46, Nowres Rafid nowres.rafed@gmail.com wrote:
else { + pos = string; /* Remove any double quotes, which may be in the middle, eg. cd "C:\Program Files"\Microsoft is ok */ - pos = string;
That's a gratuitous change
while (*command) { if (*command != '"') *pos++ = *command; command++; } *pos = 0x00;
+ /* Remove any whitespace at the end of command + This was because "cd .. " wasn't working */ + pos--; + while ( *pos == ' ' || *pos == '\t' ) + *pos-- = 0x00; +
You don't need to alter the string more than necessary. I would do sthg like
while (*command) { if (*command != '"') *pos++ = *command; command++; } + pos--; + while (*pos == ' ' || *pos == '\t') pos--; *pos = 0x00;