mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-24 00:10:05 +08:00
initialize.c: Do not expand quoted arguments.
2009-04-29 Pascal Obry <obry@adacore.com> * initialize.c: Do not expand quoted arguments. From-SVN: r146941
This commit is contained in:
parent
d45871da6e
commit
6d47b1e3e9
@ -1,3 +1,7 @@
|
||||
2009-04-29 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* initialize.c: Do not expand quoted arguments.
|
||||
|
||||
2009-04-29 Emmanuel Briot <briot@adacore.com>
|
||||
|
||||
* prj-ext.adb, prj.adb, prj.ads: Fix memory leaks.
|
||||
|
@ -130,6 +130,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
|
||||
int last;
|
||||
int argc_expanded = 0;
|
||||
TCHAR result [MAX_PATH];
|
||||
int quoted;
|
||||
|
||||
wargv = CommandLineToArgvW (GetCommandLineW(), &wargc);
|
||||
|
||||
@ -146,9 +147,12 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
|
||||
|
||||
for (k=1; k<wargc; k++)
|
||||
{
|
||||
/* Check for wildcard expansion. */
|
||||
if (_tcsstr (wargv[k], _T("?")) != 0 ||
|
||||
_tcsstr (wargv[k], _T("*")) != 0)
|
||||
quoted = (wargv[k][0] == _T('\''));
|
||||
|
||||
/* Check for wildcard expansion if the argument is not quoted. */
|
||||
if (!quoted
|
||||
&& (_tcsstr (wargv[k], _T("?")) != 0 ||
|
||||
_tcsstr (wargv[k], _T("*")) != 0))
|
||||
{
|
||||
/* Wilcards are present, append all corresponding matches. */
|
||||
WIN32_FIND_DATA FileData;
|
||||
@ -173,8 +177,19 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No wildcard. Store parameter as-is. */
|
||||
append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
|
||||
/* No wildcard. Store parameter as-is. Remove quote if
|
||||
needed. */
|
||||
if (quoted)
|
||||
{
|
||||
int len = _tcslen (wargv[k]);
|
||||
|
||||
/* Remove ending quote */
|
||||
wargv[k][len-1] = _T('\0');
|
||||
append_arg
|
||||
(&argc_expanded, &wargv[k][1], &gnat_argv, &last);
|
||||
}
|
||||
else
|
||||
append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user