Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.unix.internals Subject: Re: replacement getwd(3). Message-ID: <1990Nov7.221329.10269@Think.COM> Date: 7 Nov 90 22:13:29 GMT References: <1431@carol.fwi.uva.nl> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 23 In article eric@mks.com (Eric Gisin) writes: >In article <1431@carol.fwi.uva.nl> casper@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@think.com {uunet,harvard}!think!barmar