Mail Archives: djgpp/1998/08/13/07:21:28
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] == ':')))
- Raw text -