> From: Ben Pfaff <[email protected]>
> Cc: Eli Zaretskii <[email protected]>, [email protected]
> Date: Tue, 08 May 2012 21:03:34 -0700
>
> Bruno Haible <[email protected]> writes:
>
> > It turns out that on native Windows, when going through cmd.exe, it is
> > not possible to pass arguments that contains a newline ('\n') or a CR ('\r')
> > character: the command gets truncated at such a character. Compared to
> > this problem, the handling of the '%' character is easy.
>
> Is there any chance that putting a newline or CR in an
> environment variable, then using %varname%, would allow one to
> embed such a character?
Not surprisingly, it doesn't work, at least in my testing. The small
program below displays just "bar".
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
int r = _putenv ("FOO=bar\nbaz");
if (r)
perror ("putenv");
else
{
r = system ("echo %FOO%");
fprintf (stderr, "`echo %%FOO%%' returned %d\n", r);
}
return 0;
}