annotate src/bzip2-1.0.6/spewG.c @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents e13257ea84a4
children
rev   line source
Chris@4 1
Chris@4 2 /* spew out a thoroughly gigantic file designed so that bzip2
Chris@4 3 can compress it reasonably rapidly. This is to help test
Chris@4 4 support for large files (> 2GB) in a reasonable amount of time.
Chris@4 5 I suggest you use the undocumented --exponential option to
Chris@4 6 bzip2 when compressing the resulting file; this saves a bit of
Chris@4 7 time. Note: *don't* bother with --exponential when compressing
Chris@4 8 Real Files; it'll just waste a lot of CPU time :-)
Chris@4 9 (but is otherwise harmless).
Chris@4 10 */
Chris@4 11
Chris@4 12 /* ------------------------------------------------------------------
Chris@4 13 This file is part of bzip2/libbzip2, a program and library for
Chris@4 14 lossless, block-sorting data compression.
Chris@4 15
Chris@4 16 bzip2/libbzip2 version 1.0.6 of 6 September 2010
Chris@4 17 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
Chris@4 18
Chris@4 19 Please read the WARNING, DISCLAIMER and PATENTS sections in the
Chris@4 20 README file.
Chris@4 21
Chris@4 22 This program is released under the terms of the license contained
Chris@4 23 in the file LICENSE.
Chris@4 24 ------------------------------------------------------------------ */
Chris@4 25
Chris@4 26
Chris@4 27 #define _FILE_OFFSET_BITS 64
Chris@4 28
Chris@4 29 #include <stdio.h>
Chris@4 30 #include <stdlib.h>
Chris@4 31
Chris@4 32 /* The number of megabytes of junk to spew out (roughly) */
Chris@4 33 #define MEGABYTES 5000
Chris@4 34
Chris@4 35 #define N_BUF 1000000
Chris@4 36 char buf[N_BUF];
Chris@4 37
Chris@4 38 int main ( int argc, char** argv )
Chris@4 39 {
Chris@4 40 int ii, kk, p;
Chris@4 41 srandom(1);
Chris@4 42 setbuffer ( stdout, buf, N_BUF );
Chris@4 43 for (kk = 0; kk < MEGABYTES * 515; kk+=3) {
Chris@4 44 p = 25+random()%50;
Chris@4 45 for (ii = 0; ii < p; ii++)
Chris@4 46 printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" );
Chris@4 47 for (ii = 0; ii < p-1; ii++)
Chris@4 48 printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" );
Chris@4 49 for (ii = 0; ii < p+1; ii++)
Chris@4 50 printf ( "ccccccccccccccccccccccccccccccccccccc" );
Chris@4 51 }
Chris@4 52 fflush(stdout);
Chris@4 53 return 0;
Chris@4 54 }