Compress-Bzip2

 view release on metacpan or  search on metacpan

bzlib-src/bzip2.c  view on Meta::CPAN

892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
   setExit(3);
   exit(exitValue);
}
 
 
/*---------------------------------------------------*/
/*--- The main driver machinery                   ---*/
/*---------------------------------------------------*/
 
/* All rather crufty.  The main problem is that input files
   are stat()d multiple times before use.  This should be
   cleaned up.
*/
 
/*---------------------------------------------*/
static
void pad ( Char *s )
{
   Int32 i;
   if ( (Int32)strlen(s) >= longestFileName ) return;
   for (i = 1; i <= longestFileName - (Int32)strlen(s); i++)

bzlib-src/bzip2.c  view on Meta::CPAN

1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
   into fileMetaInfo before starting to compress / decompress it,
   because doing it afterwards means we get the wrong access time.
 
   To complicate matters, in compress() and decompress() below, the
   sequence of tests preceding the call to saveInputFileMetaInfo()
   involves calling fileExists(), which in turn establishes its result
   by attempting to fopen() the file, and if successful, immediately
   fclose()ing it again.  So we have to assume that the fopen() call
   does not cause the access time field to be updated.
 
   Reading of the man page for stat() (man 2 stat) on RedHat 7.2 seems
   to imply that merely doing open() will not affect the access time.
   Therefore we merely need to hope that the C library only does
   open() as a result of fopen(), and not any kind of read()-ahead
   cleverness.
 
   It sounds pretty fragile to me.  Whether this carries across
   robustly to arbitrary Unix-like platforms (or even works robustly
   on this one, RedHat 7.2) is unknown to me.  Nevertheless ... 
*/
#if BZ_UNIX

lib/Compress/Bzip2.pm  view on Meta::CPAN

353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
    print STDERR "Error: file $infile is not readable\n";
    next;
  }
 
  @statbuf = stat _;
  if ( !@statbuf ) {
    print STDERR "Error: failed to stat $infile: '$!'\n";
    next;
  }
 
  if ( !_check_stat( $infile, \@statbuf, $opts{f} ) ) {
    print STDERR "Error: file $infile stat check fails: $bzerrno\n";
    next;
  }
}
 
my $outfile_exists;
if ( !$opts{c} ) {
  undef $out;
  if ( $opts{d} ) {
    $outfile = $infile . '.bz2';



( run in 0.256 second using v1.01-cache-2.11-cpan-0d8aa00de5b )