00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00022
00023
00024
00025 #ifdef fl_dirent_h_cyclic_include
00026 # include "/usr/include/dirent.h"
00027 #endif
00028
00029 #ifndef FL_FILENAME_H
00030 # define FL_FILENAME_H
00031
00032 # include "Fl_Export.H"
00033
00038 # define FL_PATH_MAX 2048
00054 FL_EXPORT const char *fl_filename_name(const char * filename);
00055 FL_EXPORT const char *fl_filename_ext(const char *buf);
00056 FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
00057 FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
00058 FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
00059 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
00060 FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
00061 FL_EXPORT int fl_filename_isdir(const char *name);
00062
00063 # if defined(__cplusplus) && !defined(FL_DOXYGEN)
00064
00065
00066
00067
00068 inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
00069 inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
00070 inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
00071 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd);
00072 inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
00073 # endif
00074
00075
00076 # if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
00077
00078 struct dirent {char d_name[1];};
00079
00080 # elif defined(__WATCOMC__)
00081 # include <sys/types.h>
00082 # include <direct.h>
00083
00084 # else
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 # include <sys/types.h>
00100 # define fl_dirent_h_cyclic_include
00101 # include <dirent.h>
00102 # undef fl_dirent_h_cyclic_include
00103 # endif
00104
00105 # if defined (__cplusplus)
00106 extern "C" {
00107 # endif
00108
00109 # if !defined(FL_DOXYGEN)
00110 FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
00111 FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
00112 FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
00113 FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
00114 # endif
00115
00116 typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **);
00118 # if defined(__cplusplus)
00119 }
00120
00121
00122
00123
00124
00125 FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
00126 Fl_File_Sort_F *s = fl_numericsort);
00127 FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
00128
00129
00130
00131
00132
00133
00134 FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
00135 int msglen = 0);
00136
00137 FL_EXPORT void fl_decode_uri(char *uri);
00138
00139 # ifndef FL_DOXYGEN
00140
00141
00142
00143
00144
00145
00146
00147 int _fl_filename_isdir_quick(const char *name);
00148 # endif
00149
00150 # endif
00151
00152
00153
00154
00155
00156 # ifdef FLTK_1_0_COMPAT
00157 # define filename_absolute fl_filename_absolute
00158 # define filename_expand fl_filename_expand
00159 # define filename_ext fl_filename_ext
00160 # define filename_isdir fl_filename_isdir
00161 # define filename_list fl_filename_list
00162 # define filename_match fl_filename_match
00163 # define filename_name fl_filename_name
00164 # define filename_relative fl_filename_relative
00165 # define filename_setext fl_filename_setext
00166 # define numericsort fl_numericsort
00167 # endif
00168
00169
00170 #endif
00171
00174
00175
00176