archivers/hog.c
changeset 553 4338d9c0bbcd
child 564 ce114ffdf485
equal deleted inserted replaced
552:24e99a1cbb98 553:4338d9c0bbcd
       
     1 /*
       
     2  * HOG support routines for PhysicsFS.
       
     3  *
       
     4  * This driver handles Descent I/II HOG archives.
       
     5  *
       
     6  * The format is very simple:
       
     7  *
       
     8  *   The file always starts with the 3-byte signature "DHF" (Descent
       
     9  *   HOG file). After that the files of a HOG are just attached after
       
    10  *   another, divided by a 17 bytes header, which specifies the name
       
    11  *   and length (in bytes) of the forthcoming file! So you just read
       
    12  *   the header with its information of how big the following file is,
       
    13  *   and then skip exact that number of bytes to get to the next file
       
    14  *   in that HOG.
       
    15  *
       
    16  *    char sig[3] = {'D', 'H', 'F'}; // "DHF"=Descent HOG File
       
    17  *
       
    18  *    struct {
       
    19  *     char file_name[13]; // Filename, padded to 13 bytes with 0s
       
    20  *     int file_size; // filesize in bytes
       
    21  *     char data[file_size]; // The file data
       
    22  *    } FILE_STRUCT; // Repeated until the end of the file.
       
    23  *
       
    24  * (That info is from http://www.descent2.com/ddn/specs/hog/)
       
    25  *
       
    26  * Please see the file LICENSE in the source's root directory.
       
    27  *
       
    28  *  This file written by Bradley Bell.
       
    29  *  Based on grp.c by Ryan C. Gordon.
       
    30  */
       
    31 
       
    32 #if HAVE_CONFIG_H
       
    33 #  include <config.h>
       
    34 #endif
       
    35 
       
    36 #if (defined PHYSFS_SUPPORTS_HOG)
       
    37 
       
    38 #include <stdio.h>
       
    39 #include <stdlib.h>
       
    40 #include <string.h>
       
    41 #include "physfs.h"
       
    42 
       
    43 #define __PHYSICSFS_INTERNAL__
       
    44 #include "physfs_internal.h"
       
    45 
       
    46 /*
       
    47  * One HOGentry is kept for each file in an open HOG archive.
       
    48  */
       
    49 typedef struct
       
    50 {
       
    51     char name[13];
       
    52     PHYSFS_uint32 startPos;
       
    53     PHYSFS_uint32 size;
       
    54 } HOGentry;
       
    55 
       
    56 /*
       
    57  * One HOGinfo is kept for each open HOG archive.
       
    58  */
       
    59 typedef struct
       
    60 {
       
    61     char *filename;
       
    62     PHYSFS_sint64 last_mod_time;
       
    63     PHYSFS_uint32 entryCount;
       
    64     HOGentry *entries;
       
    65 } HOGinfo;
       
    66 
       
    67 /*
       
    68  * One HOGfileinfo is kept for each open file in a HOG archive.
       
    69  */
       
    70 typedef struct
       
    71 {
       
    72     void *handle;
       
    73     HOGentry *entry;
       
    74     PHYSFS_uint32 curPos;
       
    75 } HOGfileinfo;
       
    76 
       
    77 
       
    78 static void HOG_dirClose(DirHandle *h);
       
    79 static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
       
    80                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
       
    81 static PHYSFS_sint64 HOG_write(FileHandle *handle, const void *buffer,
       
    82                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
       
    83 static int HOG_eof(FileHandle *handle);
       
    84 static PHYSFS_sint64 HOG_tell(FileHandle *handle);
       
    85 static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset);
       
    86 static PHYSFS_sint64 HOG_fileLength(FileHandle *handle);
       
    87 static int HOG_fileClose(FileHandle *handle);
       
    88 static int HOG_isArchive(const char *filename, int forWriting);
       
    89 static DirHandle *HOG_openArchive(const char *name, int forWriting);
       
    90 static LinkedStringList *HOG_enumerateFiles(DirHandle *h,
       
    91                                             const char *dirname,
       
    92                                             int omitSymLinks);
       
    93 static int HOG_exists(DirHandle *h, const char *name);
       
    94 static int HOG_isDirectory(DirHandle *h, const char *name, int *fileExists);
       
    95 static int HOG_isSymLink(DirHandle *h, const char *name, int *fileExists);
       
    96 static PHYSFS_sint64 HOG_getLastModTime(DirHandle *h, const char *n, int *e);
       
    97 static FileHandle *HOG_openRead(DirHandle *h, const char *name, int *exist);
       
    98 static FileHandle *HOG_openWrite(DirHandle *h, const char *name);
       
    99 static FileHandle *HOG_openAppend(DirHandle *h, const char *name);
       
   100 static int HOG_remove(DirHandle *h, const char *name);
       
   101 static int HOG_mkdir(DirHandle *h, const char *name);
       
   102 
       
   103 const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG =
       
   104 {
       
   105     "HOG",
       
   106     HOG_ARCHIVE_DESCRIPTION,
       
   107     "Bradley Bell <btb@icculus.org>",
       
   108     "http://icculus.org/physfs/",
       
   109 };
       
   110 
       
   111 
       
   112 static const FileFunctions __PHYSFS_FileFunctions_HOG =
       
   113 {
       
   114     HOG_read,       /* read() method       */
       
   115     HOG_write,      /* write() method      */
       
   116     HOG_eof,        /* eof() method        */
       
   117     HOG_tell,       /* tell() method       */
       
   118     HOG_seek,       /* seek() method       */
       
   119     HOG_fileLength, /* fileLength() method */
       
   120     HOG_fileClose   /* fileClose() method  */
       
   121 };
       
   122 
       
   123 
       
   124 const DirFunctions __PHYSFS_DirFunctions_HOG =
       
   125 {
       
   126     &__PHYSFS_ArchiveInfo_HOG,
       
   127     HOG_isArchive,          /* isArchive() method      */
       
   128     HOG_openArchive,        /* openArchive() method    */
       
   129     HOG_enumerateFiles,     /* enumerateFiles() method */
       
   130     HOG_exists,             /* exists() method         */
       
   131     HOG_isDirectory,        /* isDirectory() method    */
       
   132     HOG_isSymLink,          /* isSymLink() method      */
       
   133     HOG_getLastModTime,     /* getLastModTime() method */
       
   134     HOG_openRead,           /* openRead() method       */
       
   135     HOG_openWrite,          /* openWrite() method      */
       
   136     HOG_openAppend,         /* openAppend() method     */
       
   137     HOG_remove,             /* remove() method         */
       
   138     HOG_mkdir,              /* mkdir() method          */
       
   139     HOG_dirClose            /* dirClose() method       */
       
   140 };
       
   141 
       
   142 
       
   143 
       
   144 static void HOG_dirClose(DirHandle *h)
       
   145 {
       
   146     HOGinfo *info = ((HOGinfo *) h->opaque);
       
   147     free(info->filename);
       
   148     free(info->entries);
       
   149     free(info);
       
   150     free(h);
       
   151 } /* HOG_dirClose */
       
   152 
       
   153 
       
   154 static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
       
   155                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
       
   156 {
       
   157     HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
       
   158     HOGentry *entry = finfo->entry;
       
   159     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
       
   160     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
       
   161     PHYSFS_sint64 rc;
       
   162 
       
   163     if (objsLeft < objCount)
       
   164         objCount = objsLeft;
       
   165 
       
   166     rc = __PHYSFS_platformRead(finfo->handle, buffer, objSize, objCount);
       
   167     if (rc > 0)
       
   168         finfo->curPos += (PHYSFS_uint32) (rc * objSize);
       
   169 
       
   170     return(rc);
       
   171 } /* HOG_read */
       
   172 
       
   173 
       
   174 static PHYSFS_sint64 HOG_write(FileHandle *handle, const void *buffer,
       
   175                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
       
   176 {
       
   177     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
       
   178 } /* HOG_write */
       
   179 
       
   180 
       
   181 static int HOG_eof(FileHandle *handle)
       
   182 {
       
   183     HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
       
   184     HOGentry *entry = finfo->entry;
       
   185     return(finfo->curPos >= entry->size);
       
   186 } /* HOG_eof */
       
   187 
       
   188 
       
   189 static PHYSFS_sint64 HOG_tell(FileHandle *handle)
       
   190 {
       
   191     return(((HOGfileinfo *) (handle->opaque))->curPos);
       
   192 } /* HOG_tell */
       
   193 
       
   194 
       
   195 static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset)
       
   196 {
       
   197     HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
       
   198     HOGentry *entry = finfo->entry;
       
   199     int rc;
       
   200 
       
   201     BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
       
   202     BAIL_IF_MACRO(offset >= entry->size, ERR_PAST_EOF, 0);
       
   203     rc = __PHYSFS_platformSeek(finfo->handle, entry->startPos + offset);
       
   204     if (rc)
       
   205         finfo->curPos = (PHYSFS_uint32) offset;
       
   206 
       
   207     return(rc);
       
   208 } /* HOG_seek */
       
   209 
       
   210 
       
   211 static PHYSFS_sint64 HOG_fileLength(FileHandle *handle)
       
   212 {
       
   213     HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
       
   214     return((PHYSFS_sint64) finfo->entry->size);
       
   215 } /* HOG_fileLength */
       
   216 
       
   217 
       
   218 static int HOG_fileClose(FileHandle *handle)
       
   219 {
       
   220     HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
       
   221     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
       
   222     free(finfo);
       
   223     free(handle);
       
   224     return(1);
       
   225 } /* HOG_fileClose */
       
   226 
       
   227 
       
   228 static int hog_open(const char *filename, int forWriting,
       
   229                     void **fh, PHYSFS_uint32 *count)
       
   230 {
       
   231     PHYSFS_uint8 buf[13];
       
   232     PHYSFS_uint32 size;
       
   233     PHYSFS_sint64 pos;
       
   234 
       
   235     *count = 0;
       
   236 
       
   237     *fh = NULL;
       
   238     BAIL_IF_MACRO(forWriting, ERR_ARC_IS_READ_ONLY, 0);
       
   239 
       
   240     *fh = __PHYSFS_platformOpenRead(filename);
       
   241     BAIL_IF_MACRO(*fh == NULL, NULL, 0);
       
   242 
       
   243     if (__PHYSFS_platformRead(*fh, buf, 3, 1) != 1)
       
   244         goto openHog_failed;
       
   245 
       
   246     if (memcmp(buf, "DHF", 3) != 0)
       
   247     {
       
   248         __PHYSFS_setError(ERR_UNSUPPORTED_ARCHIVE);
       
   249         goto openHog_failed;
       
   250     } /* if */
       
   251 
       
   252     while( 1 )
       
   253     {
       
   254         if (__PHYSFS_platformRead(*fh, buf, 13, 1) != 1)
       
   255             break;             //eof here is ok
       
   256 
       
   257         if (__PHYSFS_platformRead(*fh, &size, 4, 1) != 1)
       
   258             goto openHog_failed;
       
   259 
       
   260         size = PHYSFS_swapULE32(size);
       
   261 
       
   262         (*count)++;
       
   263 
       
   264         // Skip over entry
       
   265         pos = __PHYSFS_platformTell(*fh);
       
   266         if (pos == -1)
       
   267             goto openHog_failed;
       
   268         if (!__PHYSFS_platformSeek(*fh, pos + size))
       
   269             goto openHog_failed;
       
   270     }
       
   271 
       
   272     // Rewind to start of entries
       
   273     if (!__PHYSFS_platformSeek(*fh, 3))
       
   274         goto openHog_failed;
       
   275 
       
   276     return(1);
       
   277 
       
   278 openHog_failed:
       
   279     if (*fh != NULL)
       
   280         __PHYSFS_platformClose(*fh);
       
   281 
       
   282     *count = -1;
       
   283     *fh = NULL;
       
   284     return(0);
       
   285 } /* hog_open */
       
   286 
       
   287 
       
   288 static int HOG_isArchive(const char *filename, int forWriting)
       
   289 {
       
   290     void *fh;
       
   291     PHYSFS_uint32 fileCount;
       
   292     int retval = hog_open(filename, forWriting, &fh, &fileCount);
       
   293 
       
   294     if (fh != NULL)
       
   295         __PHYSFS_platformClose(fh);
       
   296 
       
   297     return(retval);
       
   298 } /* HOG_isArchive */
       
   299 
       
   300 
       
   301 static int hog_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
       
   302 {
       
   303     HOGentry *a = (HOGentry *) _a;
       
   304     return(strcmp(a[one].name, a[two].name));
       
   305 } /* hog_entry_cmp */
       
   306 
       
   307 
       
   308 static void hog_entry_swap(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
       
   309 {
       
   310     HOGentry tmp;
       
   311     HOGentry *first = &(((HOGentry *) _a)[one]);
       
   312     HOGentry *second = &(((HOGentry *) _a)[two]);
       
   313     memcpy(&tmp, first, sizeof (HOGentry));
       
   314     memcpy(first, second, sizeof (HOGentry));
       
   315     memcpy(second, &tmp, sizeof (HOGentry));
       
   316 } /* hog_entry_swap */
       
   317 
       
   318 
       
   319 static int hog_load_entries(const char *name, int forWriting, HOGinfo *info)
       
   320 {
       
   321     void *fh = NULL;
       
   322     PHYSFS_uint32 fileCount;
       
   323     HOGentry *entry;
       
   324     char *ptr;
       
   325 
       
   326     BAIL_IF_MACRO(!hog_open(name, forWriting, &fh, &fileCount), NULL, 0);
       
   327     info->entryCount = fileCount;
       
   328     info->entries = (HOGentry *) malloc(sizeof (HOGentry) * fileCount);
       
   329     if (info->entries == NULL)
       
   330     {
       
   331         __PHYSFS_platformClose(fh);
       
   332         BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
       
   333     } /* if */
       
   334 
       
   335     for (entry = info->entries; fileCount > 0; fileCount--, entry++)
       
   336     {
       
   337         if (__PHYSFS_platformRead(fh, &entry->name, 13, 1) != 1)
       
   338         {
       
   339             __PHYSFS_platformClose(fh);
       
   340             return(0);
       
   341         } /* if */
       
   342 
       
   343         if (__PHYSFS_platformRead(fh, &entry->size, 4, 1) != 1)
       
   344         {
       
   345             __PHYSFS_platformClose(fh);
       
   346             return(0);
       
   347         } /* if */
       
   348 
       
   349         entry->size = PHYSFS_swapULE32(entry->size);
       
   350         entry->startPos = __PHYSFS_platformTell(fh);
       
   351         if (entry->startPos == -1)
       
   352         {
       
   353             __PHYSFS_platformClose(fh);
       
   354             return(0);
       
   355         }
       
   356 
       
   357         // Skip over entry
       
   358         if (!__PHYSFS_platformSeek(fh, entry->startPos + entry->size))
       
   359         {
       
   360             __PHYSFS_platformClose(fh);
       
   361             return(0);
       
   362         }
       
   363     } /* for */
       
   364 
       
   365     __PHYSFS_platformClose(fh);
       
   366 
       
   367     __PHYSFS_sort(info->entries, info->entryCount,
       
   368                   hog_entry_cmp, hog_entry_swap);
       
   369     return(1);
       
   370 } /* hog_load_entries */
       
   371 
       
   372 
       
   373 static DirHandle *HOG_openArchive(const char *name, int forWriting)
       
   374 {
       
   375     HOGinfo *info;
       
   376     DirHandle *retval = malloc(sizeof (DirHandle));
       
   377     PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
       
   378 
       
   379     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
       
   380     info = retval->opaque = malloc(sizeof (HOGinfo));
       
   381     if (info == NULL)
       
   382     {
       
   383         __PHYSFS_setError(ERR_OUT_OF_MEMORY);
       
   384         goto HOG_openArchive_failed;
       
   385     } /* if */
       
   386 
       
   387     memset(info, '\0', sizeof (HOGinfo));
       
   388 
       
   389     info->filename = (char *) malloc(strlen(name) + 1);
       
   390     if (info->filename == NULL)
       
   391     {
       
   392         __PHYSFS_setError(ERR_OUT_OF_MEMORY);
       
   393         goto HOG_openArchive_failed;
       
   394     } /* if */
       
   395 
       
   396     if (!hog_load_entries(name, forWriting, info))
       
   397         goto HOG_openArchive_failed;
       
   398 
       
   399     strcpy(info->filename, name);
       
   400     info->last_mod_time = modtime;
       
   401     retval->funcs = &__PHYSFS_DirFunctions_HOG;
       
   402     return(retval);
       
   403 
       
   404 HOG_openArchive_failed:
       
   405     if (retval != NULL)
       
   406     {
       
   407         if (retval->opaque != NULL)
       
   408         {
       
   409             if (info->filename != NULL)
       
   410                 free(info->filename);
       
   411             if (info->entries != NULL)
       
   412                 free(info->entries);
       
   413             free(info);
       
   414         } /* if */
       
   415         free(retval);
       
   416     } /* if */
       
   417 
       
   418     return(NULL);
       
   419 } /* HOG_openArchive */
       
   420 
       
   421 
       
   422 static LinkedStringList *HOG_enumerateFiles(DirHandle *h,
       
   423                                             const char *dirname,
       
   424                                             int omitSymLinks)
       
   425 {
       
   426     HOGinfo *info = ((HOGinfo *) h->opaque);
       
   427     HOGentry *entry = info->entries;
       
   428     LinkedStringList *retval = NULL, *p = NULL;
       
   429     PHYSFS_uint32 max = info->entryCount;
       
   430     PHYSFS_uint32 i;
       
   431 
       
   432     /* no directories in HOG files. */
       
   433     BAIL_IF_MACRO(*dirname != '\0', ERR_NOT_A_DIR, NULL);
       
   434 
       
   435     for (i = 0; i < max; i++, entry++)
       
   436         retval = __PHYSFS_addToLinkedStringList(retval, &p, entry->name, -1);
       
   437 
       
   438     return(retval);
       
   439 } /* HOG_enumerateFiles */
       
   440 
       
   441 
       
   442 static HOGentry *hog_find_entry(HOGinfo *info, const char *name)
       
   443 {
       
   444     char *ptr = strchr(name, '.');
       
   445     HOGentry *a = info->entries;
       
   446     PHYSFS_sint32 lo = 0;
       
   447     PHYSFS_sint32 hi = (PHYSFS_sint32) (info->entryCount - 1);
       
   448     PHYSFS_sint32 middle;
       
   449     int rc;
       
   450 
       
   451     /*
       
   452      * Rule out filenames to avoid unneeded processing...no dirs,
       
   453      *   big filenames, or extensions > 3 chars.
       
   454      */
       
   455     BAIL_IF_MACRO((ptr) && (strlen(ptr) > 4), ERR_NO_SUCH_FILE, NULL);
       
   456     BAIL_IF_MACRO(strlen(name) > 12, ERR_NO_SUCH_FILE, NULL);
       
   457     BAIL_IF_MACRO(strchr(name, '/') != NULL, ERR_NO_SUCH_FILE, NULL);
       
   458 
       
   459     while (lo <= hi)
       
   460     {
       
   461         middle = lo + ((hi - lo) / 2);
       
   462         rc = __PHYSFS_platformStricmp(name, a[middle].name);
       
   463         if (rc == 0)  /* found it! */
       
   464             return(&a[middle]);
       
   465         else if (rc > 0)
       
   466             lo = middle + 1;
       
   467         else
       
   468             hi = middle - 1;
       
   469     } /* while */
       
   470 
       
   471     BAIL_MACRO(ERR_NO_SUCH_FILE, NULL);
       
   472 } /* hog_find_entry */
       
   473 
       
   474 
       
   475 static int HOG_exists(DirHandle *h, const char *name)
       
   476 {
       
   477     return(hog_find_entry(((HOGinfo *) h->opaque), name) != NULL);
       
   478 } /* HOG_exists */
       
   479 
       
   480 
       
   481 static int HOG_isDirectory(DirHandle *h, const char *name, int *fileExists)
       
   482 {
       
   483     *fileExists = HOG_exists(h, name);
       
   484     return(0);  /* never directories in a groupfile. */
       
   485 } /* HOG_isDirectory */
       
   486 
       
   487 
       
   488 static int HOG_isSymLink(DirHandle *h, const char *name, int *fileExists)
       
   489 {
       
   490     *fileExists = HOG_exists(h, name);
       
   491     return(0);  /* never symlinks in a groupfile. */
       
   492 } /* HOG_isSymLink */
       
   493 
       
   494 
       
   495 static PHYSFS_sint64 HOG_getLastModTime(DirHandle *h,
       
   496                                         const char *name,
       
   497                                         int *fileExists)
       
   498 {
       
   499     HOGinfo *info = ((HOGinfo *) h->opaque);
       
   500     PHYSFS_sint64 retval = -1;
       
   501 
       
   502     *fileExists = (hog_find_entry(info, name) != NULL);
       
   503     if (*fileExists)  /* use time of HOG itself in the physical filesystem. */
       
   504         retval = ((HOGinfo *) h->opaque)->last_mod_time;
       
   505 
       
   506     return(retval);
       
   507 } /* HOG_getLastModTime */
       
   508 
       
   509 
       
   510 static FileHandle *HOG_openRead(DirHandle *h, const char *fnm, int *fileExists)
       
   511 {
       
   512     HOGinfo *info = ((HOGinfo *) h->opaque);
       
   513     FileHandle *retval;
       
   514     HOGfileinfo *finfo;
       
   515     HOGentry *entry;
       
   516 
       
   517     entry = hog_find_entry(info, fnm);
       
   518     *fileExists = (entry != NULL);
       
   519     BAIL_IF_MACRO(entry == NULL, NULL, NULL);
       
   520 
       
   521     retval = (FileHandle *) malloc(sizeof (FileHandle));
       
   522     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
       
   523     finfo = (HOGfileinfo *) malloc(sizeof (HOGfileinfo));
       
   524     if (finfo == NULL)
       
   525     {
       
   526         free(retval);
       
   527         BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
       
   528     } /* if */
       
   529 
       
   530     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
       
   531     if ( (finfo->handle == NULL) ||
       
   532          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
       
   533     {
       
   534         free(finfo);
       
   535         free(retval);
       
   536         return(NULL);
       
   537     } /* if */
       
   538 
       
   539     finfo->curPos = 0;
       
   540     finfo->entry = entry;
       
   541     retval->opaque = (void *) finfo;
       
   542     retval->funcs = &__PHYSFS_FileFunctions_HOG;
       
   543     retval->dirHandle = h;
       
   544     return(retval);
       
   545 } /* HOG_openRead */
       
   546 
       
   547 
       
   548 static FileHandle *HOG_openWrite(DirHandle *h, const char *name)
       
   549 {
       
   550     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
       
   551 } /* HOG_openWrite */
       
   552 
       
   553 
       
   554 static FileHandle *HOG_openAppend(DirHandle *h, const char *name)
       
   555 {
       
   556     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
       
   557 } /* HOG_openAppend */
       
   558 
       
   559 
       
   560 static int HOG_remove(DirHandle *h, const char *name)
       
   561 {
       
   562     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
       
   563 } /* HOG_remove */
       
   564 
       
   565 
       
   566 static int HOG_mkdir(DirHandle *h, const char *name)
       
   567 {
       
   568     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
       
   569 } /* HOG_mkdir */
       
   570 
       
   571 #endif  /* defined PHYSFS_SUPPORTS_HOG */
       
   572 
       
   573 /* end of hog.c ... */
       
   574