ENH: Added more special unix shell characters that require quoting. Added escaping of % as %% for shells inside mingw32-make.
This commit is contained in:
parent
871f7cf222
commit
cc507411d3
@ -60,7 +60,9 @@ static int kwsysSystem_Shell__CharIsWhitespace(char c)
|
|||||||
static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
|
static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
|
||||||
{
|
{
|
||||||
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
|
return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
|
||||||
(c == '&') || (c == '$') || (c == '(') || (c == ')'));
|
(c == '&') || (c == '$') || (c == '(') || (c == ')') ||
|
||||||
|
(c == '~') || (c == '<') || (c == '>') || (c == '|') ||
|
||||||
|
(c == '*') || (c == '\\'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
@ -289,10 +291,12 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
|
|||||||
}
|
}
|
||||||
else if(*c == '%')
|
else if(*c == '%')
|
||||||
{
|
{
|
||||||
if(flags & kwsysSystem_Shell_Flag_VSIDE)
|
if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
|
||||||
|
((flags & kwsysSystem_Shell_Flag_Make) &&
|
||||||
|
(flags & kwsysSystem_Shell_Flag_MinGWMake)))
|
||||||
{
|
{
|
||||||
/* In a VS IDE a percent is written %% so we need one extra
|
/* In the VS IDE or MinGW make a percent is written %% so we
|
||||||
characters. */
|
need one extra characters. */
|
||||||
size += 1;
|
size += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,9 +447,11 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
|
|||||||
}
|
}
|
||||||
else if(*c == '%')
|
else if(*c == '%')
|
||||||
{
|
{
|
||||||
if(flags & kwsysSystem_Shell_Flag_VSIDE)
|
if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
|
||||||
|
((flags & kwsysSystem_Shell_Flag_Make) &&
|
||||||
|
(flags & kwsysSystem_Shell_Flag_MinGWMake)))
|
||||||
{
|
{
|
||||||
/* In a VS IDE a percent is written %%. */
|
/* In the VS IDE or MinGW make a percent is written %%. */
|
||||||
*out++ = '%';
|
*out++ = '%';
|
||||||
*out++ = '%';
|
*out++ = '%';
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
|
#define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
|
||||||
#define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
|
#define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
|
||||||
#define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
|
#define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
|
||||||
|
#define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
|
||||||
#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
|
#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -86,12 +87,15 @@ enum kwsysSystem_Shell_Flag_e
|
|||||||
/** The target shell is in a Watcom WMake makefile. */
|
/** The target shell is in a Watcom WMake makefile. */
|
||||||
kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
|
kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
|
||||||
|
|
||||||
|
/** The target shell is in a MinGW Make makefile. */
|
||||||
|
kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
|
||||||
|
|
||||||
/** Make variable reference syntax $(MAKEVAR) should not be escaped
|
/** Make variable reference syntax $(MAKEVAR) should not be escaped
|
||||||
to allow a build tool to replace it. Replacement values
|
to allow a build tool to replace it. Replacement values
|
||||||
containing spaces, quotes, backslashes, or other
|
containing spaces, quotes, backslashes, or other
|
||||||
non-alphanumeric characters that have significance to some makes
|
non-alphanumeric characters that have significance to some makes
|
||||||
or shells produce undefined behavior. */
|
or shells produce undefined behavior. */
|
||||||
kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<4)
|
kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5)
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -112,6 +116,7 @@ enum kwsysSystem_Shell_Flag_e
|
|||||||
# undef kwsysSystem_Shell_Flag_VSIDE
|
# undef kwsysSystem_Shell_Flag_VSIDE
|
||||||
# undef kwsysSystem_Shell_Flag_EchoWindows
|
# undef kwsysSystem_Shell_Flag_EchoWindows
|
||||||
# undef kwsysSystem_Shell_Flag_WatcomWMake
|
# undef kwsysSystem_Shell_Flag_WatcomWMake
|
||||||
|
# undef kwsysSystem_Shell_Flag_MinGWMake
|
||||||
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
|
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user