[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'system-quote'

From: Eli Zaretskii
Subject: Re: new module 'system-quote'
Date: Wed, 09 May 2012 07:59:36 +0300

> From: Ben Pfaff <address@hidden>
> Cc: Eli Zaretskii <address@hidden>,  address@hidden
> Date: Tue, 08 May 2012 21:03:34 -0700
> Bruno Haible <address@hidden> 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>

main (void)
  int r = _putenv ("FOO=bar\nbaz");

  if (r)
    perror ("putenv");
      r = system ("echo %FOO%");
      fprintf (stderr, "`echo %%FOO%%' returned %d\n", r);
  return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]