spewG.c 1.7 KB

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