This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: (Fwd) Re: Absolute paths in BFD
- To: Eli Zaretskii <eliz at is dot elta dot co dot il>
- Subject: Re: (Fwd) Re: Absolute paths in BFD
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Thu, 4 May 2000 09:54:03 +1000 (EST)
- cc: binutils at sourceware dot cygnus dot com, snowball3 at bigfoot dot com
On Wed, 3 May 2000, Eli Zaretskii wrote:
> I'm not sure I see why my code (reproduced below) has a bug. It seems
> to be functionally equivalent to yours. I tested my version,
> including on your "abc\\def/ghi" example, and it seems to work
> correctly. Can you tell where you see a problem?
>
> filename = strrchr (file, '/');
> #ifdef DOSISH_FILENAMES
> /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
> if (!filename || strchr (filename, '\\'))
> {
> filename = strrchr (filename ? filename : file, '\\');
> if (!filename && *file && file[1] == ':')
> filename = file + 1;
> }
> #endif
Ah well, when I look at it again, it seems to be OK :)
The example code I gave was clearer and more concise IMO. Clarity of code
is fairly important for maintenance reasons.
>
> > 2) IS_ABSOLUTE in include/filename.h should test for a slash after the
> > colon. a:zzz is not an absolute file.
>
> I beg to disagree. Strictly speaking, a:zzz is neither absolute nor
> relative. However, the purpose for which IS_ABSOLUTE was introduced
> is to DTRT in code which prepends a directory name to file names which
Please add a comment in filename.h describing the purpose of IS_ABSOLUTE.
I stand by my assertion that a:zzz is not an absolute file name, but quite
accept that checking for a slash would be wrong, given the way IS_ABSOLUTE
is used.
Regards, Alan Modra
--
Linuxcare. Support for the Revolution.