| version 1.8, 2003/08/03 21:34:18 |
version 1.9, 2003/08/12 20:50:59 |
|
|
| * 19/05/2003 - created |
* 19/05/2003 - created |
| * 27/06/2003 - added Win32 support |
* 27/06/2003 - added Win32 support |
| * 15/07/2003 - smart memory allocation for files and directories data |
* 15/07/2003 - smart memory allocation for files and directories data |
| |
* 12/08/2003 - X11 adaptations |
| */ |
*/ |
| |
|
| /* $Platon: games/3do-view/dir.c,v 1.7 2003/07/15 15:45:34 nepto Exp $ */ |
/* $Platon: games/3do-view/dir.c,v 1.8 2003/08/03 21:34:18 nepto Exp $ */ |
| |
|
| #include <string.h> |
#include <string.h> |
| #include <stdlib.h> |
#include <stdlib.h> |
|
|
| # define DIR_REALLOC_DATA_STEP (255) |
# define DIR_REALLOC_DATA_STEP (255) |
| #endif |
#endif |
| |
|
| #if PLATON_SYSTEM_SVGALIB |
#if PLATON_SYSTEM_SVGALIB || PLATON_SYSTEM_X11 |
| # include <unistd.h> |
# include <unistd.h> |
| # include <dirent.h> |
# include <dirent.h> |
| # include <sys/types.h> |
# include <sys/types.h> |
| Line 73 void get_directories_and_files(char ***d |
|
| Line 74 void get_directories_and_files(char ***d |
|
| int files_alloc_bytes = 0; |
int files_alloc_bytes = 0; |
| int files_free_bytes = 0; |
int files_free_bytes = 0; |
| #endif |
#endif |
| #if PLATON_SYSTEM_SVGALIB |
#if PLATON_SYSTEM_SVGALIB || PLATON_SYSTEM_X11 |
| DIR *dirp; |
DIR *dirp; |
| struct dirent *dp; |
struct dirent *dp; |
| struct stat st; |
struct stat st; |
| Line 97 void get_directories_and_files(char ***d |
|
| Line 98 void get_directories_and_files(char ***d |
|
| directories_size = 0; |
directories_size = 0; |
| files_size = 0; |
files_size = 0; |
| |
|
| #if PLATON_SYSTEM_SVGALIB |
#if PLATON_SYSTEM_SVGALIB || PLATON_SYSTEM_X11 |
| for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { |
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { |
| if (stat(DIR_FILENAME, &st)) |
if (stat(DIR_FILENAME, &st)) |
| continue; |
continue; |
| Line 161 void get_directories_and_files(char ***d |
|
| Line 162 void get_directories_and_files(char ***d |
|
| #endif |
#endif |
| (*size)++; |
(*size)++; |
| (*ptr)[*size] = NULL; |
(*ptr)[*size] = NULL; |
| #if PLATON_SYSTEM_SVGALIB |
#if PLATON_SYSTEM_SVGALIB || PLATON_SYSTEM_X11 |
| } |
} |
| closedir(dirp); |
closedir(dirp); |
| #endif |
#endif |