muta...@gmail.com
2021-04-23 16:19:39 UTC
In MSDOS (and is it universal?), who is responsible
for scanning through the PATH environment variable
when you do a system()?
And what is the logic behind this decision?
Options I see are:
1. The C library can scan the PATH, since the
environment variable is available to it.
2. The C library can invoke a new copy of "command.com"
(or whatever "SHELL" is set to (will it always be set?))
and pass "/c" and the command, and it will scan the PATH.
3. MSDOS can receive the program name and scan the
PATH to find the executable, since it also has access
to the environment variable (after all, it passed that to
the executable in the first place).
Or maybe all of them can do it.
I'm interested in the philosophy before coding one or
more of those things.
Thanks. Paul.
for scanning through the PATH environment variable
when you do a system()?
And what is the logic behind this decision?
Options I see are:
1. The C library can scan the PATH, since the
environment variable is available to it.
2. The C library can invoke a new copy of "command.com"
(or whatever "SHELL" is set to (will it always be set?))
and pass "/c" and the command, and it will scan the PATH.
3. MSDOS can receive the program name and scan the
PATH to find the executable, since it also has access
to the environment variable (after all, it passed that to
the executable in the first place).
Or maybe all of them can do it.
I'm interested in the philosophy before coding one or
more of those things.
Thanks. Paul.