mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhmimetypes.pl,1.9,1.10

2002-09-24 20:53:56
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv12364

Modified Files:
	mhmimetypes.pl 
Log Message:
* Fallback to txt extension for unknown text types.
* Fixed problem determining next number count if a type as a numeric
  prefix/extension.  This happens for message types since they have
  a "822" prefix/extension.


Index: mhmimetypes.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhmimetypes.pl,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** mhmimetypes.pl	2 May 2002 17:20:04 -0000	1.9
--- mhmimetypes.pl	25 Sep 2002 03:53:51 -0000	1.10
***************
*** 248,251 ****
--- 248,254 ----
      if (defined($ext)) {
  	$ext = (split(/,/, $ext))[0];
+     } elsif ($ctype =~ /^text\//) {
+ 	$ext = 'txt';
+ 	$desc = 'Text Data';
      } else {
  	$ext = $UnknownExt;
***************
*** 324,343 ****
  	warn qq/Warning: Unable to open "$dir": $!\n/;
      } else {
! 	@files = sort file_numeric grep(/^$pre\d+\.$ext$/i, readdir(DIR));
! 	closedir(DIR);
! 	if (@files) {
! 	    ($cnt) = $files[$#files] =~ /(\d+)/;
  	}
      }
      ++$cnt;
      (sprintf("%05d", $cnt), $pre, $ext);
- }
- 
- ##---------------------------------------------------------------------------
- 
- sub file_numeric {
-     ($A) = $a =~ /(\d+)/;
-     ($B) = $b =~ /(\d+)/;
-     $A <=> $B;
  }
  
--- 327,340 ----
  	warn qq/Warning: Unable to open "$dir": $!\n/;
      } else {
! 	my($file, $num);
! 	foreach $file (grep(/^$pre\d+\.$ext$/i, readdir(DIR))) {
! 	    $num = substr($file, length($pre));
! 	    $num = substr($num, 0, length($num)-(length($ext)+1));
! 	    $cnt = $num  if $num > $cnt;
  	}
+ 	close(DIR);
      }
      ++$cnt;
      (sprintf("%05d", $cnt), $pre, $ext);
  }
  

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV