File: uncompr.pl

package info (click to toggle)
lzo2 2.06-1%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 4,380 kB
  • sloc: ansic: 23,220; sh: 15,260; asm: 3,624; perl: 261; makefile: 186
file content (32 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /usr/bin/perl
##
## vi:ts=4
##
##---------------------------------------------------------------------------##
##
##  Author:
##      Markus F.X.J. Oberhumer         <markus@oberhumer.com>
##
##  Description:
##      Create incompressible files for compression test
##
##  Copyright (C) 1996-2011 Markus Franz Xaver Johannes Oberhumer
##
##---------------------------------------------------------------------------##

$x = ' ' x 65536;
$i = 0;
while ($i < 65536) {
    substr($x,$i,1) = pack('C',rand(256));
    $i++;
}

for $i (1,2,4,8,16,32,64) {
    $name = sprintf("u%04d.dat",$i);
    open(OUTFILE,">$name") || die "$0: cannot open '$name': $!";
    binmode(OUTFILE);
    print OUTFILE substr($x,0,$i*1024);
    close(OUTFILE);
}

exit(0);