From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Faylor To: gdb@sources.redhat.com Cc: keiths@redhat.com Subject: Re: DOS/Windows-specific code: main.c Date: Tue, 08 May 2001 07:58:00 -0000 Message-id: <20010508105707.B24160@redhat.com> References: <20010503211502.21716.qmail@web6401.mail.yahoo.com> <3AF1DAA0.3060702@cygnus.com> <200105071609.TAA24129@is.elta.co.il> <200105081148.OAA06240@is.elta.co.il> X-SW-Source: 2001-05/msg00126.html On Tue, May 08, 2001 at 02:48:05PM +0300, Eli Zaretskii wrote: > > * main.c: > > #ifdef __CYGWIN__ > #include /* for MAX_PATH */ > #include /* for cygwin32_conv_to_posix_path */ > #endif > >See the next snippet. > > * main.c:captured_main() > > /* Read and execute $HOME/.gdbinit file, if it exists. This is done > *before* all the command line arguments are processed; it sets > global parameters, which are independent of what file you are > debugging or what directory you are in. */ > #ifdef __CYGWIN32__ > { > char *tmp = getenv ("HOME"); > > if (tmp != NULL) > { > homedir = (char *) alloca (MAX_PATH + 1); > cygwin32_conv_to_posix_path (tmp, homedir); > } > else > homedir = NULL; > } > #else > homedir = getenv ("HOME"); > #endif > >What does cygwin32_conv_to_posix_path do? Does it convert the >drive-letter braindamage to the /cygdrive/d/foo thingy? Yes. >If so, why is that needed? Doesn't Cygwin support the native Windows >file names with drive letters? Actually CYGWIN converts the HOME environment variable to "posix" format well before the code ever reaches here. I believe that this code is to accomodate gdbtk which might change the environment variable back to MS-DOS format explicitly. I remember trying to get rid of this years ago. Keith Seitz told me that I couldn't do that. Maybe the solution is to create a "gethome ()" function which is either a macro or a call to a function in win32-nat.c? Or, maybe this isn't needed anymore. Keith do you remember this? I think it may have been the first piece of email we ever exchanged. >In any case, this could use FILENAME_MAX instead of MAX_PATH, and then >the previous snippet would not need , since stdio.h is >already included by defs.h. Yep. cgf