Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1a00958f5a
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (56 sloc) 1.585 kb
# Copyright 2002-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
# $Id: file_info.coretag,v 1.4 2007-03-30 23:40:54 pajamian Exp $
UserTag file-info Order name
UserTag file-info attrAlias file name
UserTag file-info addAttr
UserTag file-info Version $Revision: 1.4 $
UserTag file-info Routine <<EOR
sub {
my ($fn, $opt) = @_;
if($opt->{server}) {
$fn = "$Global::VendRoot/$fn"
}
elsif($opt->{conf}) {
$fn = "$Global::ConfDir/$fn"
}
elsif($opt->{run}) {
$fn = "$Global::RunDir/$fn"
}
my @stat = stat($fn);
my %info;
my @ary;
my $size = $stat[7] < 1024
? $stat[7]
: ( $stat[7] < 1024 * 1024
? sprintf ("%.2fK", $stat[7] / 1024)
: sprintf ("%.2fM", $stat[7] / 1024 / 1024)
);
if($opt->{flags}) {
$opt->{flags} =~ s/\W//g;
my @flags = split //, $opt->{flags};
for(@flags) {
s/(.)/"-$1 _"/ee;
}
return join "\t", @flags;
}
if($opt->{size}) {
return $stat[7];
}
if($opt->{time}) {
return $stat[9];
}
if($opt->{date}) {
return $Tag->time($Scratch->{mv_locale},{time => $stat[9], gmt => $opt->{gmt}},'%c');
}
$opt->{fmt} = '%f bytes, last modified %Y-%m-%d %H:%M:%S'
if ! $opt->{fmt};
$opt->{fmt} =~ s/%f/$size/g;
$Tag->time($Scratch->{mv_locale},{time => $stat[9], gmt => $opt->{gmt}},$opt->{fmt});
}
EOR
Jump to Line
Something went wrong with that request. Please try again.