[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mc problem - solved



Hi

1) Please disregard my previous posting with lots of Perl and stuff: 
I was falling asleep when I posted that.  I'm attaching a patch for
/usr/local/lib/mc/extfs/deb (or wherever it is on your box) below.
Note that the patch has Y2K bug, which leads me to

2) Is there a function in Perl to convert month from 2-digit MM to
3-letter Mon or do I have to roll my own?

---
Explanation: it seems that original scripts expects the date in 
`dpkg-deb -c` output to be in either MM DD HH:MM YY or 
Mon DD HH:MM YYYY format (not sure which) and it gets MM-DD-YYYY
instead.  That breaks split() and consequently the rest.
mc needs date converted to either MM-DD-YY or Mon DD YYYY.
In the patch below I simply subtract 1900 from YYYY to get YY, 
which is ugly.  What I really need is to convert MM to Mon --
hence the question above.

When that's done I'll send the patch to mc team, meanwhile you can
try the following hack.

--
Dimitri


--- deb.orig	Fri Jul  4 05:31:31 1997
+++ deb	Sun Jul  6 17:21:12 1997
@@ -34,8 +34,10 @@
 	{
 		while(<PIPEIN>)
 		{
-			($perm,$owgr,$size,$month,$day,$time,$year,$path,$arrow,$link,$link2)
+			($perm,$owgr,$size,$date,$time,$path,$arrow,$link,$link2)
 				= split;
+			($year,$month,$day) = split(/-/,$date);
+			$year -= 1900;
 			$owgr=~s!/! !;
 			next if $path=~m!/$!;
 			if($arrow eq 'link')
@@ -49,7 +51,7 @@
 				$arrow=' ' . $arrow;
 				$link= ' ' . $link;
 			}
-			print "$perm 1 $owgr $size $month $day $year $time CONTENTS/$path$arrow$link\n";
+			print "$perm 1 $owgr $size $month-$day-$year $time CONTENTS/$path$arrow$link\n";
 		}
 	}
 }

Reply to: