access()

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Feb 9 11:30:55 AEST 1989


In article <LFK.89Feb8170836 at mbio.med.upenn.edu> lfk at mbio.med.upenn.edu (Lee Kolakowski) writes:
>What does ANSI say about the filename argument passed to the access()
>function? Especially with regard to directorys.
>For example, in RCS there are statements like
>	access("./RCS/", 000)
>But under a supposedly ANSI compiler (MSC 5.1) these lines return an
>error that says RCS/ does not exist when RCS/ is fine.
>If the filename is "RCS" everything is just fine, and the proper
>response is returned.
>Is this the correct behavior?

This is not an ANSI C issue; interpretation and validity of strings
used as filenames is up to the implementation.

Your operating system apparently thinks that "RCS/" is not a valid
pathname.  I seem to recall that the SVID requires this behavior.
7th Edition UNIX interpreted that string as denoting file "" in
directory "RCS", and took "" to mean the current directory (same as
".").  One would guess that RCS was developed on a 7th-Ed.-derived
system, probably 4.somethingBSD.  The simplest fix is to append "."
to such strings.



More information about the Comp.lang.c mailing list