|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T g
Length: 1131 (0x46b)
Types: TextFile
Names: »getcwd.pl«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦b5330643c⟧ »./cops/perl-4.019/perl.tar.Z«
└─⟦2b9a58213⟧
└─⟦this⟧ »perl-4.019/lib/getcwd.pl«
# By Brandon S. Allbery
#
# Usage: $cwd = &getcwd;
sub getcwd
{
local($dotdots, $cwd, @pst, @cst, $dir, @tst);
unless (@cst = stat('.'))
{
warn "stat(.): $!";
return '';
}
$cwd = '';
do
{
$dotdots .= '/' if $dotdots;
$dotdots .= '..';
@pst = @cst;
unless (opendir(getcwd'PARENT, $dotdots)) #'))
{
warn "opendir($dotdots): $!";
return '';
}
unless (@cst = stat($dotdots))
{
warn "stat($dotdots): $!";
closedir(getcwd'PARENT); #');
return '';
}
if ($pst[$[] == $cst[$[] && $pst[$[ + 1] == $cst[$[ + 1])
{
$dir = '';
}
else
{
do
{
unless ($dir = readdir(getcwd'PARENT)) #'))
{
warn "readdir($dotdots): $!";
closedir(getcwd'PARENT); #');
return '';
}
unless (@tst = stat("$dotdots/$dir"))
{
warn "stat($dotdots/$dir): $!";
closedir(getcwd'PARENT); #');
return '';
}
}
while ($dir eq '.' || $dir eq '..' || $tst[$[] != $pst[$[] ||
$tst[$[ + 1] != $pst[$[ + 1]);
}
$cwd = "$dir/$cwd";
closedir(getcwd'PARENT); #');
} while ($dir);
chop($cwd);
$cwd;
}
1;