1 # By Brandon S. Allbery
3 # Usage: $cwd = &getcwd;
7 local($dotdots, $cwd, @pst, @cst, $dir, @tst);
9 unless (@cst = stat('.'))
17 $dotdots .= '/' if $dotdots;
20 unless (opendir(getcwd'PARENT, $dotdots)) #'))
22 warn "opendir($dotdots): $!";
25 unless (@cst = stat($dotdots))
27 warn "stat($dotdots): $!";
28 closedir(getcwd'PARENT); #');
31 if ($pst[$[] == $cst[$[] && $pst[$[ + 1] == $cst[$[ + 1])
39 unless (defined ($dir = readdir(getcwd'PARENT))) #'))
41 warn "readdir($dotdots): $!";
42 closedir(getcwd'PARENT); #');
45 unless (@tst = lstat("$dotdots/$dir"))
47 # warn "lstat($dotdots/$dir): $!";
48 # closedir(getcwd'PARENT); #');
52 while ($dir eq '.' || $dir eq '..' || $tst[$[] != $pst[$[] ||
53 $tst[$[ + 1] != $pst[$[ + 1]);
56 closedir(getcwd'PARENT); #');