main.c 733 B

12345678910111213141516171819202122232425262728
  1. #include <bzlib.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. int main(void)
  6. {
  7. int chunksize = 1024;
  8. FILE* file = fopen("test.bzip2", "wb");
  9. char* buf = malloc(sizeof(char) * chunksize);
  10. int error, rsize;
  11. unsigned int in, out;
  12. BZFILE* bzfile = BZ2_bzWriteOpen(&error, file, 64, 1, 10);
  13. /* Don't actually write anything for the purposes of the test */
  14. BZ2_bzWriteClose(&error, bzfile, 1, &in, &out);
  15. free(buf);
  16. fclose(file);
  17. remove("test.bzip2");
  18. printf("Found BZip2 version %s, expected version %s\n", BZ2_bzlibVersion(),
  19. CMAKE_EXPECTED_BZip2_VERSION);
  20. return strncmp(BZ2_bzlibVersion(), CMAKE_EXPECTED_BZip2_VERSION,
  21. strlen(CMAKE_EXPECTED_BZip2_VERSION));
  22. }