delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/14/14:11:25

Message-ID: <B0000039659@stargate.astr.lu.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: Andris Pavenis <pavenis AT lanet DOT lv>, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Date: Fri, 14 Aug 1998 21:10:16 +0300
MIME-Version: 1.0
Subject: Re: -fxref bug?
CC: Gerhard Gruber <sparhawk AT eunet DOT at>, djgpp AT delorie DOT com
References: <B0000039165 AT stargate DOT astr DOT lu DOT lv>
In-reply-to: <Pine.SUN.3.91.980813141123.4803H-100000@is>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019