[MPlayer-dev-eng] [PATCH] fix "Unknown argument" with cmd containing spaces
aurel at gnuage.org
Wed Feb 9 19:24:57 CET 2005
I've just found a bug in mp_input_parse_cmd.
First an example (silly but simple enough to show the bug).
Trying to parse :
run 'ls -l'
will display :
Unknown argument 1
But the command is still executed correctly.
When a string arg begin with a ' or a ", the parser read it up
to the closing ' or ". But after reading an argument, the parser
try to find the next one by searching for a space in the string,
begining at the START of last argument.
So with my example, the parser will first extract the command (run)
and then will parse the following string :
It will then set arg = "ls -l" and will search for the next space
character. So it will then try to parse this string :
Which is what causes the "Unknown argument 1".
This patch simply set ptr to the end of the parsed argument when
when encounter a quoted string, so we can't step on a space inside
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the MPlayer-dev-eng