Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.wizards Subject: Re: Inside PWD Message-ID: <11310@smoke.BRL.MIL> Date: 16 Oct 89 06:43:18 GMT References: <166@volvo.vd.volvo.se> <1281@virtech.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <1281@virtech.UUCP> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >BTW - there is no system call to do this because the system doesn't know >where you are (other than the inode of your current directory). More accurately, the inode defines WHERE you are, but not how you got there. Note that the usual getcwd() methods return A path from the root, not THE path you used. Some shells (e.g. the one I maintain) keep track of how you reach your c.w.d., and some (e.g. ksh) even keep track of it in a variable. If the c.w.d. could reliably be trusted to be in an environment variable, then an alternate, and generally less confusing, implementation of getcwd() suggests itself. However, it wouldn't be reliable from a security standpoint.