DOS/Windows-specific code: main.c

Eli Zaretskii
2001-05-08T04:46:00Z

* main.c:

#ifdef __CYGWIN__
#include <windows.h> /* for MAX_PATH */
#include <sys/cygwin.h> /* 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? If so, why is
that needed? Doesn't Cygwin support the native Windows file names
with drive letters?

In any case, this could use FILENAME_MAX instead of MAX_PATH, and then
the previous snippet would not need <windows.h>, since stdio.h is
already included by defs.h.