Mail Archives: djgpp-workers/1997/12/02/07:21:27
On Mon, 1 Dec 1997, DJ Delorie wrote:
> If we enable LFN during startup, it should ONLY be for finding the
> djgpp.env file. Expanding wildcards with it is a bad idea, as long as
> the short names can still be used after we switch to LFN.
I was not suggesting a change; what I described was how things work
since the release of v2.01. I attach the original v2.01 version of
`__crt1_startup' at the end of this message, for everybody's
reference. AFAIK, this is still unchanged in the latest v2.02 alpha,
except that the DOS version is queried at the beginning.
Using LFN for loading the env file alone is tricky and will have at
least one consequence that would surprise people.
It is tricky because, as you see below, the arguments are globbed
*before* the env file is loaded. (Changing this order might be not as
simple as it seems, since you need argv[0] to find the program's
section in the env file.) So the first _USE_LFN only looks at the DOS
environment; if that doesn't say LFN=n, and we are on an LFN platform,
the arguments are expanded with LFN calls. A possible solution would
be to expand the arguments twice, if after loading DJGPP.ENV it turns
out that the first expansion was improper.
Disregarding LFN when globbing is IMHO dangerous because the short
names would be displayed. For example, "ls *" would display the short
aliases. That's not what the user expects. So I think long names
*should* be used for globbing, but we need a way to revert to short
aliases if DJGPP.ENV says so. We also need to generate a short form
of DJDIR if DJGPP.ENV says LFN=n.
Any comments and ideas are welcome.
void
__crt1_startup(void)
{
char *pn;
__bss_count ++;
__crt0_argv = 0;
setup_core_selector();
setup_screens();
setup_go32_info_block();
__djgpp_exception_setup();
setup_environment();
__environ_changed++;
/* Make so rest of startup could use LFN. */
(void)_USE_LFN;
__crt0_setup_arguments();
pn = __crt0_argv ? __crt0_argv[0] : __dos_argv0;
__crt0_load_environment_file(pn);
(void)_USE_LFN; /* DJGPP.ENV might have set $LFN */
_npxsetup(pn);
_crt0_init_mcount();
__main();
exit(main(__crt0_argc, __crt0_argv, environ));
}
- Raw text -