Mail Archives: djgpp/1998/08/14/14:11:25
Date sent: Thu, 13 Aug 1998 14:18:44 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Subject: Re: -fxref bug?
>
> On Thu, 13 Aug 1998, Andris Pavenis wrote:
>
> > + #ifdef __DJGPP__
> > + #define FILE_NAME_ABSOLUTE_P(NAME) \
> > + ((NAME[0] == '/') || \
> > + (isascii(NAME[0]) && NAME[1]==':' && \
> > + (NAME[2]=='/' || NAME[2]=='\\')))
> > + #endif
>
> Thanks.
>
> However, this has a few drawbacks: a drive letter doesn't have to be
> isascii and a name such as d:foo should also be treated as absolute. It
> also doesn't support backslashes.
>
> So I would suggest the following:
>
> #define FILE_NAME_ABSOLUTE_P(NAME) \
> (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
> (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
>
I think
#define FILE_NAME_ABSOLUTE_P(NAME) \
(((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
((isalpha(NAME)[0]) && ((NAME)[1]==':')))
is even more better (we are excluding special symbols between
'Z' and 'a')
Andris
- Raw text -