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