This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Asterisk expansion...


All,

I found a solution to my problem.

If you're curious - the application involved was a wrapper binary that
performs version control functions.  So you can control which version of,
say, 'bash.exe' gets run when you type 'bash' at the commandline.  The
problem was that since the wrapper wasn't a Cygnus binary (it's native
Win32) it provided an artificial layer between a Cygnus parent and a Cygnus
child.  So if I have a script that calls 'echo \*.\*' echo would see that it
doesn't have a Cygnus parent (the wrapper) and improperly glob the argument.

To get around it I have the wrapper determine if it's a Cygnus binary and if
it is it sets a variable.  If a new wrapper process sees that variable it
calls SetEnvironmentVariable(..) to append 'noglob' to CYGWIN32.

Anyway, thank you all for your help.

Jason

> -----Original Message-----
> From: Robert Read [mailto:rread@home.com]
> Sent: Friday, July 24, 1998 6:59 PM
> To: Robertson, Jason V
> Subject: Re: Asterisk expansion...
>
>
> Your problem is that unix tools don't expand globs; the shell does all
> of that work.
>
> So when you are using the unix shell and you type this command:
>
> $ echo *
>
> The shell will look for files in the current directory and replace the
> '*' with all the filenames.  Then it executes echo with the filenames
> arguments.
>
> So, one way to do what you want is to execute the commands by using the
> shell.  On unix, I believe this is done with the system() function.  If
> that doesn't work, then your wrapper can execute the shell directly like
> this:
>
>   function_to_run_program("bash.exe -c program.exe *");
>
> robert
>
> Robertson, Jason V wrote:
> >
> > Hi,
> >
> > There seems to be an inconsistency in how * is interpreted.  When you
> > run, say, 'echo.exe' from the commandline you get the following:
> > C:> echo *.*
> > <Contents of C: are listed>
> > C:> echo \*.\*
> > \*.\*
> >
> > So why does it expand the glob in the first instance, and not unescape
> > them in the second?  And doesn't this mean it's impossible to echo the
> > string:
> > *.*
> > from cmd?
> >
> > Running from sh behaves as expected:
> > $ echo *.*
> > <contents of pwd are listed>
> > $ echo \*.\*
> > *.*
> >
> > Any ideas?  The reason this is causing problems is that we have a
> > wrapper around these binaries and it's clueless as to what's expected of
> > it because it seems indeterminate with respect to commandline expansion.
> > Is there some hook whereby the tools know if they're being run from
> > another Cygnus tool so they don't expand the command line?
> >
> > Thanks,
> > Jason
> > -
> > For help on using this list (especially unsubscribing), send a
> message to
> > "gnu-win32-request@cygnus.com" with one line of text: "help".
>

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]