[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: path separator (was: target triplet)
From: |
Keith MARSHALL |
Subject: |
Re: path separator (was: target triplet) |
Date: |
Tue, 23 Jan 2007 16:50:24 +0000 |
Ralf Wildenhues wrote:
> most applications don't need
> the notion of two possible path separators.
I wonder...
I first discovered the need for two distinct representations, when
I did the MinGW port for `groff', now officially incorporated into
the GNU sources. I also needed to distinguish them, for a later
port of `man', and again in a port of `catgets' and `gencat', which
I'm currently working on, as add-ons for MinGW. Maybe it's the
specific combination of the MSYS build environment with a native
Win32 compiler tool chain that exhibits the requirement, but it
seems to me that it will be desirable for any application which
needs to know what the PATH_SEPARATOR is, not only at build time,
but also when the binary is invoked, whether that may be from
MSYS, or from cmd.exe.
> #ifndef DIR_SEPARATOR
> # define DIR_SEPARATOR '/'
> # define PATH_SEPARATOR ':'
> #endif
>
> #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
AFAIK, all compilers targetting native Win32 define _WIN32, and that's
consistent with your usage. Doesn't DJGPP define __MSDOS__ anyway,
making the duplicate test redundant? Or maybe it's __MS_DOS__? Or
maybe I'm just confused, since I never really explored DJGPP much as
a build tool anyway, and it's a long time since I last used its
runtime environment to enhance bare MS-DOS.
> defined (__OS2__)
> # define HAVE_DOS_BASED_FILE_SYSTEM
> # ifndef DIR_SEPARATOR_2
> # define DIR_SEPARATOR_2 '\\'
> # endif
> # ifndef PATH_SEPARATOR_2
> # define PATH_SEPARATOR_2 ';'
> # endif
> #endif
I've never found it particularly useful to distinguish between '/'
and '\\' as DIR_SEPARATOR chars; for most purposes MS-Windows, and
MS-DOS before it, *don't* *need* '\\', so you may as well just use
'/' on every platform. There is only one exception I can think of,
and IME it's rarely encountered in practice; of course, it may be
different on OS2, of which I have no experience.
Regards,
Keith.
- Re: path separator, (continued)
- Re: path separator, Paul Eggert, 2007/01/22
- Re: path separator, Ralf Wildenhues, 2007/01/23
- Re: path separator, Bob Rossi, 2007/01/23
- Re: path separator, Brian Dessent, 2007/01/23
- Re: path separator, Keith MARSHALL, 2007/01/24
- Re: path separator, Matthew Woehlke, 2007/01/24
- Re: path separator, Brian Dessent, 2007/01/24
- Re: path separator, Ralf Wildenhues, 2007/01/24
- Re: path separator, Matthew Woehlke, 2007/01/24
- Re: path separator, Keith MARSHALL, 2007/01/24
- Re: path separator (was: target triplet),
Keith MARSHALL <=
- Re: path separator, Ralf Wildenhues, 2007/01/23
- Re: path separator, Keith MARSHALL, 2007/01/24
- Re: target triplet, Keith MARSHALL, 2007/01/22