summaryrefslogtreecommitdiff
path: root/x2p/find2perl
diff options
context:
space:
mode:
Diffstat (limited to 'x2p/find2perl')
-rwxr-xr-xx2p/find2perl34
1 files changed, 19 insertions, 15 deletions
diff --git a/x2p/find2perl b/x2p/find2perl
index 62e6b1b740..7bbeccd55d 100755
--- a/x2p/find2perl
+++ b/x2p/find2perl
@@ -1,4 +1,8 @@
#!/usr/local/bin/perl
+#
+# Modified September 26, 1993 to provide proper handling of years after 1999
+# Tom Link <tml+@pitt.edu>
+# University of Pittsburgh
eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
@@ -62,18 +66,18 @@ while (@ARGV) {
$out .= &tab;
$type = shift;
if ($type eq 'nfs')
- { $out .= '$dev < 0'; }
+ { $out .= '($dev < 0)'; }
else
- { $out .= '$dev >= 0'; }
+ { $out .= '($dev >= 0)'; }
}
elsif ($_ eq 'user') {
$uname = shift;
- $out .= &tab . "\$uid == \$uid{'$uname'}";
+ $out .= &tab . "(\$uid == \$uid{'$uname'})";
$inituser++;
}
elsif ($_ eq 'group') {
$gname = shift;
- $out .= &tab . "\$gid == \$gid{'$gname'}";
+ $out .= &tab . "(\$gid == \$gid{'$gname'})";
$initgroup++;
}
elsif ($_ eq 'nouser') {
@@ -85,22 +89,22 @@ while (@ARGV) {
$initgroup++;
}
elsif ($_ eq 'links') {
- $out .= &tab . '$nlink ' . &n(shift);
+ $out .= &tab . '($nlink ' . &n(shift);
}
elsif ($_ eq 'inum') {
- $out .= &tab . '$ino ' . &n(shift);
+ $out .= &tab . '($ino ' . &n(shift);
}
elsif ($_ eq 'size') {
- $out .= &tab . 'int((-s _ + 511) / 512) ' . &n(shift);
+ $out .= &tab . '(int(((-s _) + 511) / 512) ' . &n(shift);
}
elsif ($_ eq 'atime') {
- $out .= &tab . 'int(-A _) ' . &n(shift);
+ $out .= &tab . '(int(-A _) ' . &n(shift);
}
elsif ($_ eq 'mtime') {
- $out .= &tab . 'int(-M _) ' . &n(shift);
+ $out .= &tab . '(int(-M _) ' . &n(shift);
}
elsif ($_ eq 'ctime') {
- $out .= &tab . 'int(-C _) ' . &n(shift);
+ $out .= &tab . '(int(-C _) ' . &n(shift);
}
elsif ($_ eq 'exec') {
for (@cmd = (); @ARGV && $ARGV[0] ne ';'; push(@cmd,shift)) { }
@@ -146,7 +150,7 @@ while (@ARGV) {
$newername = 'AGE_OF' . $file;
$newername =~ s/[^\w]/_/g;
$newername = '$' . $newername;
- $out .= "-M _ < $newername";
+ $out .= "(-M _ < $newername)";
$initnewer .= "$newername = -M " . &quote($file) . ";\n";
}
elsif ($_ eq 'eval') {
@@ -319,7 +323,7 @@ sub ls {
($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime);
$moname = $moname[$mon];
if (-M _ > 365.25 / 2) {
- $timeyear = '19' . $year;
+ $timeyear = $year + 1900;
}
else {
$timeyear = sprintf("%02d:%02d", $hour, $min);
@@ -548,9 +552,9 @@ ENDOFSTAT
sub fileglob_to_re {
local($tmp) = @_;
- $tmp =~ s/([.^\$()])/\\$1/g;
+ $tmp =~ s#([./^\$()])#\\$1#g;
$tmp =~ s/([?*])/.$1/g;
- "^$tmp$";
+ "^$tmp\$";
}
sub n {
@@ -558,7 +562,7 @@ sub n {
$n =~ s/^-/< / || $n =~ s/^\+/> / || $n =~ s/^/== /;
$n =~ s/ 0*(\d)/ $1/;
- $n;
+ $n . ')';
}
sub quote {