00001
00002
00003
00004
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008
00009
00010 #ifndef DIR_HD
00011
00012 #include <sys/types.h>
00013 #include <dirent.h>
00014 #include <stdlib.h>
00015 #include <sys/stat.h>
00016
00017 #ifdef LINUX
00018 #include <string.h>
00019 #endif
00020
00021 #ifdef SUN
00022 #include <strings.h>
00023 #endif
00024
00025
00026
00027
00028 #define FILE_NUMBER 10
00029
00030
00031
00032
00033 struct file_list {
00034
00035 char **list;
00036
00037
00038 int total_alloc;
00039
00040
00041 int num;
00042 };
00043
00044
00045
00046 #define BASE_DIR_NOT_FOUND 0
00047
00048
00049
00050 #define BASE_DIR_NO_MEM 1
00051
00052
00053
00054 #define BASE_DIR_FOUND 2
00055
00056
00057 int read_directory (char *dir_name, struct file_list *flist);
00058 int read_directory_only (char *dir_name, struct file_list *flist_out);
00059 void free_file_list(struct file_list *flist);
00060 int base_dir_name (char *dirname, char **res);
00061
00062 #define DIR_HD
00063 #endif
00064
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068
00069