[1/2] cmd: fixing an issue with extra whitespaces after cd parameter (retry2)
Frédéric Delanoy
frederic.delanoy at gmail.com
Fri Aug 19 20:10:24 CDT 2011
On Fri, Aug 19, 2011 at 02:46, Nowres Rafid <nowres.rafed at 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;
More information about the wine-devel
mailing list