This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: (Fwd) Re: Absolute paths in BFD


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]