1 # By Brandon S. Allbery
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
12 # Usage: $cwd = &getcwd;
16 local($dotdots, $cwd, @pst, @cst, $dir, @tst);
18 unless (@cst = stat('.'))
26 $dotdots .= '/' if $dotdots;
29 unless (opendir(getcwd
'PARENT, $dotdots)) #'))
31 warn "opendir($dotdots): $!";
34 unless (@cst = stat($dotdots))
36 warn "stat($dotdots): $!";
37 closedir(getcwd
'PARENT); #');
40 if ($pst[$[] == $cst[$[] && $pst[$[ + 1] == $cst[$[ + 1])
48 unless (defined ($dir = readdir(getcwd
'PARENT))) #'))
50 warn "readdir($dotdots): $!";
51 closedir(getcwd
'PARENT); #');
54 unless (@tst = lstat("$dotdots/$dir"))
56 # warn "lstat($dotdots/$dir): $!";
57 # closedir(getcwd'PARENT); #');
61 while ($dir eq '.' || $dir eq '..' || $tst[$[] != $pst[$[] ||
62 $tst[$[ + 1] != $pst[$[ + 1]);
65 closedir(getcwd
'PARENT); #');