platform/unix.c
changeset 351 bc4fa7896225
parent 347 56ce50a62241
child 381 b65d27fdc8a9
equal deleted inserted replaced
350:ec1e75681b4b 351:bc4fa7896225
    10 #  include <config.h>
    10 #  include <config.h>
    11 #endif
    11 #endif
    12 
    12 
    13 /* BeOS uses beos.cpp and posix.c ... Cygwin and such use win32.c ... */
    13 /* BeOS uses beos.cpp and posix.c ... Cygwin and such use win32.c ... */
    14 #if ((!defined __BEOS__) && (!defined WIN32))
    14 #if ((!defined __BEOS__) && (!defined WIN32))
    15 
       
    16 #ifdef __FreeBSD__
       
    17 #  if (!defined __BSD__)
       
    18 #    define __BSD__
       
    19 #  endif
       
    20 #endif
       
    21 
       
    22 #if ((defined __APPLE__) && (defined __MACH__))
       
    23 #  if (!defined __BSD__)
       
    24 #    define __BSD__
       
    25 #  endif
       
    26 #endif
       
    27 
    15 
    28 #include <stdio.h>
    16 #include <stdio.h>
    29 #include <stdlib.h>
    17 #include <stdlib.h>
    30 #include <string.h>
    18 #include <string.h>
    31 #include <ctype.h>
    19 #include <ctype.h>
    36 #include <sys/stat.h>
    24 #include <sys/stat.h>
    37 #include <sys/param.h>
    25 #include <sys/param.h>
    38 #include <dirent.h>
    26 #include <dirent.h>
    39 #include <time.h>
    27 #include <time.h>
    40 #include <errno.h>
    28 #include <errno.h>
    41 
    29 #include <sys/mount.h>
    42 #if (defined __BSD__)
    30 
    43 #include <sys/ucred.h>
    31 #ifdef PHYSFS_HAVE_SYS_UCRED_H
    44 #else
    32 #  ifdef PHYSFS_HAVE_MNTENT_H
       
    33 #    undef PHYSFS_HAVE_MNTENT_H /* don't do both... */
       
    34 #  endif
       
    35 #  include <sys/ucred.h>
       
    36 #endif
       
    37 
       
    38 #ifdef PHYSFS_HAVE_MNTENT_H
    45 #include <mntent.h>
    39 #include <mntent.h>
    46 #endif
    40 #endif
    47 
       
    48 #include <sys/mount.h>
       
    49 
       
    50 
    41 
    51 #define __PHYSICSFS_INTERNAL__
    42 #define __PHYSICSFS_INTERNAL__
    52 #include "physfs_internal.h"
    43 #include "physfs_internal.h"
    53 
    44 
    54 
    45 
    66     return(1);  /* always succeed. */
    57     return(1);  /* always succeed. */
    67 } /* __PHYSFS_platformDeinit */
    58 } /* __PHYSFS_platformDeinit */
    68 
    59 
    69 
    60 
    70 
    61 
    71 #if (defined __BSD__)
    62 #ifdef PHYSFS_HAVE_SYS_UCRED_H
    72 
    63 
    73 char **__PHYSFS_platformDetectAvailableCDs(void)
    64 char **__PHYSFS_platformDetectAvailableCDs(void)
    74 {
    65 {
    75     char **retval = (char **) malloc(sizeof (char *));
    66     char **retval = (char **) malloc(sizeof (char *));
    76     int cd_count = 1;  /* We count the NULL entry. */
    67     int cd_count = 1;  /* We count the NULL entry. */
   111 
   102 
   112     retval[cd_count - 1] = NULL;
   103     retval[cd_count - 1] = NULL;
   113     return(retval);
   104     return(retval);
   114 } /* __PHYSFS_platformDetectAvailableCDs */
   105 } /* __PHYSFS_platformDetectAvailableCDs */
   115 
   106 
   116 
   107 #endif
   117 #else  /* non-Darwin implementation... */
   108 
   118 
   109 
       
   110 #ifdef PHYSFS_HAVE_MNTENT_H
   119 
   111 
   120 char **__PHYSFS_platformDetectAvailableCDs(void)
   112 char **__PHYSFS_platformDetectAvailableCDs(void)
   121 {
   113 {
   122     char **retval = (char **) malloc(sizeof (char *));
   114     char **retval = (char **) malloc(sizeof (char *));
   123     int cd_count = 1;  /* We count the NULL entry. */
   115     int cd_count = 1;  /* We count the NULL entry. */