3 # This library is no longer being maintained, and is included for backward
4 # compatibility with Perl 4 programs which may require it.
6 # In particular, this should not be used as an example of modern Perl
7 # programming techniques.
9 # Suggested alternative: Cwd
11 # Usage: $cwd = &fastcwd;
13 # This is a faster version of getcwd. It's also more dangerous because
14 # you might chdir out of a directory that you can't chdir back into.
17 local($odev, $oino, $cdev, $cino, $tdev, $tino);
21 ($cdev, $cino) = stat('.');
23 ($odev, $oino) = ($cdev, $cino);
25 ($cdev, $cino) = stat('.');
26 last if $odev == $cdev && $oino == $cino;
34 ($tdev, $tino) = lstat($_);
35 last unless $tdev != $odev || $tino != $oino;
40 chdir($path = '/' . join('/', @path));