aboutsummaryrefslogtreecommitdiff
path: root/spewG.c
diff options
context:
space:
mode:
authorJulian Seward <jseward@acm.org>2000-06-24 22:13:13 +0200
committerJulian Seward <jseward@acm.org>2000-06-24 22:13:13 +0200
commit795b859eee96c700e8f3c3fe68e6a9a39d95797c (patch)
tree48f8a731cd5ec2f5f15c6d99f2207ebf4a1f35f6 /spewG.c
parentf93cd82a9a7094ad90fd19bbc6ccf6f4627f8060 (diff)
downloadbzip2-795b859eee96c700e8f3c3fe68e6a9a39d95797c.tar.gz
bzip2-795b859eee96c700e8f3c3fe68e6a9a39d95797c.tar.bz2
bzip2-795b859eee96c700e8f3c3fe68e6a9a39d95797c.zip
bzip2-1.0.1bzip2-1.0.1
Diffstat (limited to 'spewG.c')
-rw-r--r--spewG.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/spewG.c b/spewG.c
new file mode 100644
index 0000000..7934e76
--- /dev/null
+++ b/spewG.c
@@ -0,0 +1,39 @@
1
2/* spew out a thoroughly gigantic file designed so that bzip2
3 can compress it reasonably rapidly. This is to help test
4 support for large files (> 2GB) in a reasonable amount of time.
5 I suggest you use the undocumented --exponential option to
6 bzip2 when compressing the resulting file; this saves a bit of
7 time. Note: *don't* bother with --exponential when compressing
8 Real Files; it'll just waste a lot of CPU time :-)
9 (but is otherwise harmless).
10*/
11
12#define _FILE_OFFSET_BITS 64
13
14#include <stdio.h>
15#include <stdlib.h>
16
17/* The number of megabytes of junk to spew out (roughly) */
18#define MEGABYTES 5000
19
20#define N_BUF 1000000
21char buf[N_BUF];
22
23int main ( int argc, char** argv )
24{
25 int ii, kk, p;
26 srandom(1);
27 setbuffer ( stdout, buf, N_BUF );
28 for (kk = 0; kk < MEGABYTES * 515; kk+=3) {
29 p = 25+random()%50;
30 for (ii = 0; ii < p; ii++)
31 printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" );
32 for (ii = 0; ii < p-1; ii++)
33 printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" );
34 for (ii = 0; ii < p+1; ii++)
35 printf ( "ccccccccccccccccccccccccccccccccccccc" );
36 }
37 fflush(stdout);
38 return 0;
39}