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