bug-gnulib
[Top][All Lists]
Advanced

[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: Fri, 11 May 2012 12:57:53 +0300

> From: Bruno Haible <address@hidden>
> Cc: address@hidden
> Date: Fri, 11 May 2012 11:28:17 +0200
> 
> Since '^' is a quoting character in cmd.exe, maybe you can try whether
> it helps to protect "*" inside double-quotes on Windows 7? That is,
> try to pass arguments such as
>   ^*
>   ^^*
>   "*"
>   "^*"
>   "^^*"
>   \"*\"
>   \"^*\"
>   \"^^*\"
>   ^"*^"
>   ^^"*^^"

I will try that after this weekend, but I don't hold my breath, since
no amount of '^' characters I tried can protect '*' from being
expanded on XP.  E.g.,

  D:\usr\eli\data>touch "^foo"
  D:\usr\eli\data>touch "^^foo"
  D:\usr\eli\data>echocmd ^^*
  D:\usr\eli\data>echocmd ^^*
  `echocmd ^*'
  0: `echocmd'
  1: `^foo'
  D:\usr\eli\data>echocmd ^^^^*
  `echocmd ^^*'
  0: `echocmd'
  1: `^^foo'

where echocmd.c is shown below.

Evidently, '^' is used by cmd.exe, but is completely ignored by the
MSVCRT globbing code.  And since Windows 7 simply removes the quotes
and then globs the result, I expect to see the same on W7.  But I will
try that and see whether the theory matches the facts.

#include <stdio.h>
#include <windows.h>

int main (int argc, char *argv[])
{
  int i = 0;

  printf ("`%s'\n", GetCommandLine ());
  while (argc--)
    printf ("%d: `%s'\n", i++, *(argv++));
  return 0;
}



reply via email to

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