*** ls.orig Thu Aug 5 17:17:43 2004
--- ls Wed Jul 19 00:48:16 2006
***************
*** 6,11 ****
--- 6,12 ----
# ------ use/require pragmas
use File::stat;
use Getopt::Std;
+ use File::Spec; #to remove $PathSep
#use strict;
# ------ partial inline of Stat::lsMode v0.50 code
***************
*** 64,72 ****
my $Maxlen = 1; # longest string we've seen
my $Now = time; # time we were invoked
my %Options = (); # option/flag arguments
- my $PathSep = "/"; # path separator
- # (someone might want to patch this via
- # File::Spec...)
my $SixMonths = # long listing time if < 6 months, else year
60*60*24*(365/2);
my $VERSION = '0.70'; # because we're V7-compatible :)
--- 65,70 ----
***************
*** 98,104 ****
my %Attributes = (); # entry/attributes hash
my @Entries = (); # entries in original order
my $Name = ""; # entry name
-
if (!opendir(DH, $_[0]) || exists($Options{'d'})) {
if (-e $_[0]) {
closedir(DH) if (defined(DH));
--- 96,101 ----
***************
*** 114,120 ****
next if (!exists($Options->{'a'}) &&
$Name =~ m/^\./o);
push(@Entries, $Name);
! $Attributes{$Name} = stat("$_[0]$PathSep$Name");
}
closedir(DH);
--- 111,117 ----
next if (!exists($Options->{'a'}) &&
$Name =~ m/^\./o);
push(@Entries, $Name);
! $Attributes{$Name} = stat(File::Spec->catfile($_[0],$Name));
}
closedir(DH);
***************
*** 358,367 ****
next if ($Entry eq "." || $Entry eq "..");
if (defined($Attributes->{$Entry}) &&
$Attributes->{$Entry}->mode & 0040000) {
! $Path = "$Name: $PathSep$Entry";
! if ($Name =~ m#$PathSep$#) {
! $Path = "$Name: $Entry";
! }
@Dirs = DirEntries(\%Options, $Path);
List($Path, \%Options, 0, @Dirs);
}
--- 355,361 ----
next if ($Entry eq "." || $Entry eq "..");
if (defined($Attributes->{$Entry}) &&
$Attributes->{$Entry}->mode & 0040000) {
! $Path = File::Spec->canonpath(File::Spec->catdir($Name,$Entry));
@Dirs = DirEntries(\%Options, $Path);
List($Path, \%Options, 0, @Dirs);
}