ENH: Adding Shell_Flag_EchoWindows option to setup escapes for arguments to the native echo command in a shell. This special case is needed to avoid adding quotes when passing text to echo in a native windows shell which does no command line parsing at all.
This commit is contained in:
parent
5a6b0792cd
commit
038c9e27d7
@ -66,6 +66,12 @@ static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
|
static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
|
||||||
{
|
{
|
||||||
|
/* On Windows the built-in command shell echo never needs quotes. */
|
||||||
|
if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* On all platforms quotes are needed to preserve whitespace. */
|
/* On all platforms quotes are needed to preserve whitespace. */
|
||||||
if(kwsysSystem_Shell__CharIsWhitespace(c))
|
if(kwsysSystem_Shell__CharIsWhitespace(c))
|
||||||
{
|
{
|
||||||
@ -227,6 +233,10 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
|
|||||||
++size;
|
++size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
|
||||||
|
{
|
||||||
|
/* On Windows the built-in command shell echo never needs escaping. */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* On Windows only backslashes and double-quotes need escaping. */
|
/* On Windows only backslashes and double-quotes need escaping. */
|
||||||
@ -334,6 +344,10 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
|
|||||||
*out++ = '\\';
|
*out++ = '\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
|
||||||
|
{
|
||||||
|
/* On Windows the built-in command shell echo never needs escaping. */
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* On Windows only backslashes and double-quotes need escaping. */
|
/* On Windows only backslashes and double-quotes need escaping. */
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
|
#define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
|
||||||
#define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
|
#define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
|
||||||
#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_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
|
#define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -78,12 +79,15 @@ enum kwsysSystem_Shell_Flag_e
|
|||||||
Shell_Flag_Make. */
|
Shell_Flag_Make. */
|
||||||
kwsysSystem_Shell_Flag_VSIDE = (1<<1),
|
kwsysSystem_Shell_Flag_VSIDE = (1<<1),
|
||||||
|
|
||||||
|
/** In a windows whell the argument is being passed to "echo". */
|
||||||
|
kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
|
||||||
|
|
||||||
/** 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<<2)
|
kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<3)
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
@ -102,6 +106,7 @@ enum kwsysSystem_Shell_Flag_e
|
|||||||
# undef kwsysSystem_Shell_Flag_e
|
# undef kwsysSystem_Shell_Flag_e
|
||||||
# undef kwsysSystem_Shell_Flag_Make
|
# undef kwsysSystem_Shell_Flag_Make
|
||||||
# undef kwsysSystem_Shell_Flag_VSIDE
|
# undef kwsysSystem_Shell_Flag_VSIDE
|
||||||
|
# undef kwsysSystem_Shell_Flag_EchoWindows
|
||||||
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
|
# undef kwsysSystem_Shell_Flag_AllowMakeVariables
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user