test_physfs.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <stdio.h>
  2. #include "physfs.h"
  3. #define TEST_VERSION_MAJOR 0
  4. #define TEST_VERSION_MINOR 1
  5. #define TEST_VERSION_PATCH 0
  6. void output_versions(void)
  7. {
  8. PHYSFS_Version compiled;
  9. PHYSFS_Version linked;
  10. PHYSFS_VERSION(&compiled);
  11. PHYSFS_getLinkedVersion(&linked);
  12. printf("test_physfs version %d.%d.%d.\n"
  13. " Compiled against PhysicsFS version %d.%d.%d,\n"
  14. " and linked against %d.%d.%d.\n\n",
  15. TEST_VERSION_MAJOR, TEST_VERSION_MINOR, TEST_VERSION_PATCH,
  16. compiled.major, compiled.minor, compiled.patch,
  17. linked.major, linked.minor, linked.patch);
  18. } /* output_versions */
  19. void output_archivers(void)
  20. {
  21. const PHYSFS_ArchiveInfo **rc = PHYSFS_supportedArchiveTypes();
  22. const PHYSFS_ArchiveInfo **i;
  23. printf("Supported archive types:\n");
  24. if (*rc == NULL)
  25. printf(" * Apparently, NONE!\n");
  26. else
  27. {
  28. for (i = rc; *i != NULL; i++)
  29. {
  30. printf(" * %s: %s\n Written by %s.\n %s\n",
  31. (*i)->extension, (*i)->description,
  32. (*i)->author, (*i)->url);
  33. } /* for */
  34. } /* else */
  35. } /* output_archivers */
  36. int main(int argc, char **argv)
  37. {
  38. if (!PHYSFS_init(argv[0]))
  39. {
  40. printf("PHYSFS_init() failed!\n reason: %s\n", PHYSFS_getLastError());
  41. return(1);
  42. } /* if */
  43. output_versions();
  44. output_archivers();
  45. return(0);
  46. } /* main */
  47. /* end of test_physfs.c ... */