replacement getwd(3).

Barry Margolin barmar at think.com
Thu Nov 8 09:13:29 AEST 1990


In article <ERIC.90Nov7131425 at femto.mks.com> eric at mks.com (Eric Gisin) writes:
>In article <1431 at carol.fwi.uva.nl> casper at fwi.uva.nl (Casper H.S. Dik) writes:
>   I've written a replacement getwd(3) for SunOS 4.x that returns ~user/tail
>   (with ~user expanded as in /etc/passwd) if the current directory
>Any program that effectively does chdir(getwd()) would break
>with your getwd. ~ expansion is handled by applications,
>not libc and the kernel.

Read what he said again: "with ~user expanded".  He was just using the ~
notation as a shorthand in his explanation.

Basically, the difference between his getwd() and the standard one is that
his will return a pathname that may include symbolic links, while the
standard one should always contain only hard links.  One property of the
standard return value is that if it returns "/foo/bar/baz" then you can be
sure that "/foo/bar/baz/.." and "/foo/bar" are equivalent; I can't think of
any applications that would depend on this.

--
Barry Margolin, Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.unix.internals mailing list