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: binutils at sourceware dot cygnus dot com
- Subject: Re: (Fwd) Re: Absolute paths in BFD
- From: Laurent Bardet <laurent dot bardet at detexis dot thomson-csf dot com>
- Date: Thu, 04 May 2000 11:21:26 +0200
- CC: Alan Modra <alan at linuxcare dot com dot au>, Eli Zaretskii <eliz at is dot elta dot co dot il>, binutils at sourceware dot cygnus dot com, snowball3 at bigfoot dot com
- References: <Pine.LNX.4.21.0005040844060.8334-100000@front.linuxcare.com.au>
Alan Modra a écrit :
> 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.
My 2 cents:
SUN's jdk documentation is quite clear about file naming conventions (parsing,
customizing and portability). See ~jdk1.2.2/docs/api/java/io/File.html.
Thinking ahead for future versions and portability:
- do you fell it reasonnable to translate any input file name in a unified
internal naming convention (e.g. URL) ?
- You might also want to access window$ network pathnames :
\\servername\sharename\directory\...\file
Laurent