[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pwd vs. extremely long pathnames

From: Paul Eggert
Subject: Re: pwd vs. extremely long pathnames
Date: 28 Feb 2003 22:26:26 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3

Jim Meyering <address@hidden> writes:

> It's probably best to avoid using getcwd altogether.

One partial workaround for "pwd" is to add support for the -L and -P
options to "pwd" that are required by POSIX 1003.1-2001.  Since -L is
the default, getcwd won't be invoked at all in the normal case.

The basic idea is that pwd normally will invoke stat (getenv ("PWD"))
and make sure that it returns the same device and inode that stat
(".")  does; if so, it merely prints $PWD.  (There are special cases
if $PWD contains "." or ".." path name components.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]