Mail Archives: cygwin/1999/01/14/14:24:50
In article <B0000013577 DOT cygnus DOT gnu-win32 AT mail DOT tcc DOT com DOT cn>,
<shijn AT tcc DOT com DOT cn> wrote:
>Hi! Evidently gcc treats argc/argv quite differently from
>Turbo C when * appears in any argvs. It always tries to
>replace this argv with as many as possible matching files.
>For example,
>
>main(int argc, char *argv[])
>{ int i;
> for (i=1; i<argc; i++) printf("argv[%d]=%s\n", i, argv[i]);
>}
>
>Run it with t*.c as the command argument,
>
>Compiled with GCC, it prints:
>argv[1]=Test.c
>argv[2]=Text2html.c
>argv[3]=Timezone.c
>
>Compiled with Turbo C, it prints:
>argv[1]=t*.c
>
>i know nothing about any standard or coding conventions
>about this, but could any of you tell me which is more
>standard or conventional?
For UNIX it is conventional to expand arguments on the
command line. For MS-DOS/Windows this is optional (at least
with MSVC) depending on whether you've linked your program
with a special object file: setargv.obj .
If you don't want your console command line expanded try
set CYGWIN=noglob
Note that this will not affect this behavior if you're running
under bash or some other shell. Since those are UNIX utilities
they will always expand * unless you quote it.
--
cgf AT cygnus DOT com
http://www.cygnus.com/
- Raw text -