This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: VAX PATCH: remove FILE_NAME_NONDIRECTORY
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Subject: Re: VAX PATCH: remove FILE_NAME_NONDIRECTORY
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Fri, 23 Feb 2001 19:22:46 +0000
- Cc: Lars Brinkhoff <lars dot spam at nocrew dot org>, tromey at redhat dot com,gcc-patches at gcc dot gnu dot org
- References: <858zmxxw5b.fsf@junk.nocrew.org> <200102231624.LAA06538@hiauly1.hia.nrc.ca>
This is what mkdeps.c used to use, before I pushed for use to use basename
instead (we dropped VMS support since no-one was prepared to fix the bit
rot at the time):
static const char *
base_name (fname)
const char *fname;
{
const char *s = fname;
const char *p;
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
if (ISALPHA (s[0]) && s[1] == ':') s += 2;
if ((p = strrchr (s, '\\'))) s = p + 1;
#elif defined VMS
if ((p = strrchr (s, ':'))) s = p + 1; /* Skip device. */
if ((p = strrchr (s, ']'))) s = p + 1; /* Skip directory. */
if ((p = strrchr (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
#endif
if ((p = strrchr (s, '/'))) s = p + 1;
return s;
}
This may or may not be useful; it would be great to have a common routine
getting this right for all targets.
Neil.
John David Anglin wrote:-
> I guess it could if we introduce a DRIVE_SEPARATOR or a third
> directory separator. DOS type systems effectively have three: '\',
> '/' and ':'.
>
> I wonder why alpha VMS ignores '>' and ':'. I can guess that '>' is
> used infrequently. I am told there is no difference between file
> name conventions on the alpha and vax.
>
> I also just noticed the VMS FILE_NAME_NONDIRECTORY translates the name to
> lower case. Thus, it now looks like we need to keep file_name_nondirectory
> because it is functionally different from basename under vax VMS. Does
> the alpha port need to define FILE_NAME_NONDIRECTORY?
>
> The argument to file_name_nondirectory shouldn't be const. The protos
> need to change.
>
> The PATH_SEPARATOR should be ',' for VMS. This isn't defined for either
> the alpha or vax.