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: Understanding program startup


DG Ellis wrote:
> 
>   I am not new to C programming, however, I am new to writing programs
> that run under a unix shell like bash.  For history, I found that single
> quotes are not respected by applications that use cygwin.dll when the
> program is invoked from outside bash.

That bug has been discussed here.

> I chased down the code to the
> winsup/dcrt0.cc source file and was busy modifying it when I decided to
> check on the behavior of "normal" command lines under bash and under NT.
> Well, I see where the code should behave certain ways and does when run
> under NT command processor, but does not behave at all the same when
> under bash.

bash does its own command line processing, so doing it in dcrt0
for programs run under bash would just mess things up.

> Now here is my question:
> My suspicion is that the routine dll_crt0_1 is not called if the
> program is run under the shell. Is this correct?

No, not at all.  Note the code in dll_crt0_1:

  if (! u->self->cygwin_parent_p)
    globify (&argc, &argv);

That does wildcard expansion if cygwin_parent_p isn't set.
cygwin_parent_p is set in pinfo_init (which is called a bit earlier
in dll_crt0_1) if the PID environment variable is set and matches
the corresponding process table (pinfo) entry.  That will be the
case if this process was execed by a cygwin process, such as bash.
There are of course other messy and confusing details.

> I will try to check on
> libc's crt0 to see if this is true (if I can find the source).

cygwin_crt0 in winsup/libccrt0.c, which is linked into the application
code, calls the dll_crt0 in dcrt0.cc in cygwin.dll.

> It looks
> like there are a lot of important things in the dll_crt0_1 routine that
> should be done in each case. If they don't get done, what happens?

Nothing useful, since dll_crt0_1 calls main, among its other important
functions.

> Could this be the ctrl-C crash problem???

Nope, sorry.

--
<J Q B>
-
For help on using this list, 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]