spewG.c revision 259065
1139826Simp 253541Sshin/* spew out a thoroughly gigantic file designed so that bzip2 353541Sshin can compress it reasonably rapidly. This is to help test 453541Sshin support for large files (> 2GB) in a reasonable amount of time. 553541Sshin I suggest you use the undocumented --exponential option to 653541Sshin bzip2 when compressing the resulting file; this saves a bit of 753541Sshin time. Note: *don't* bother with --exponential when compressing 853541Sshin Real Files; it'll just waste a lot of CPU time :-) 953541Sshin (but is otherwise harmless). 1053541Sshin*/ 1153541Sshin 1253541Sshin/* ------------------------------------------------------------------ 1353541Sshin This file is part of bzip2/libbzip2, a program and library for 1453541Sshin lossless, block-sorting data compression. 1553541Sshin 1653541Sshin bzip2/libbzip2 version 1.0.6 of 6 September 2010 1753541Sshin Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> 1853541Sshin 1953541Sshin Please read the WARNING, DISCLAIMER and PATENTS sections in the 2053541Sshin README file. 2153541Sshin 2253541Sshin This program is released under the terms of the license contained 2353541Sshin in the file LICENSE. 2453541Sshin ------------------------------------------------------------------ */ 2553541Sshin 2653541Sshin 2753541Sshin#define _FILE_OFFSET_BITS 64 28174510Sobrien 29174510Sobrien#include <stdio.h> 3053541Sshin#include <stdlib.h> 3153541Sshin 32174510Sobrien/* The number of megabytes of junk to spew out (roughly) */ 33174510Sobrien#define MEGABYTES 5000 34174510Sobrien 3562587Sitojun#define N_BUF 1000000 3662587Sitojunchar buf[N_BUF]; 37225044Sbz 3855009Sshinint main ( int argc, char** argv ) 39148921Ssuz{ 4053541Sshin int ii, kk, p; 4153541Sshin srandom(1); 4253541Sshin setbuffer ( stdout, buf, N_BUF ); 4378064Sume for (kk = 0; kk < MEGABYTES * 515; kk+=3) { 4453541Sshin p = 25+random()%50; 4553541Sshin for (ii = 0; ii < p; ii++) 4653541Sshin printf ( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); 4753541Sshin for (ii = 0; ii < p-1; ii++) 4853541Sshin printf ( "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ); 4953541Sshin for (ii = 0; ii < p+1; ii++) 5078064Sume printf ( "ccccccccccccccccccccccccccccccccccccc" ); 5153541Sshin } 5253541Sshin fflush(stdout); 5353541Sshin return 0; 54225044Sbz} 5553541Sshin