2 * "$Id: filename.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 * Filename header file for the Fast Light Tool Kit (FLTK).
6 * Copyright 1998-2002 by Bill Spitzak and others.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * Please report all bugs and problems to "fltk-bugs@fltk.org".
27 # define FL_FILENAME_H
29 # include "Fl_Export.H"
31 # define FL_PATH_MAX 256 /* all buffers are this length */
33 FL_EXPORT const char *fl_filename_name(const char *);
34 FL_EXPORT const char *fl_filename_ext(const char *);
35 FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
36 FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
37 FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
38 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
39 FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
40 FL_EXPORT int fl_filename_isdir(const char *name);
44 * Under WIN32, we include filename.H from numericsort.c; this should probably change...
47 inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
48 inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
49 inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
50 inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
51 # endif /* __cplusplus */
54 # if defined(WIN32) && !defined(__CYGWIN__)
56 struct dirent {char d_name[1];};
60 * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.
61 * The correct information is in one of these files:
63 * #include <sys/ndir.h>
64 * #include <sys/dir.h>
67 * plus you must do the following #define:
69 * #define dirent direct
71 * It would be best to create a <dirent.h> file that does this...
73 # include <sys/types.h>
79 # endif /* __cplusplus */
81 FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
82 FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
83 FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
84 FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
86 typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **);
92 * Portable "scandir" function. Ugly but necessary...
95 FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
96 Fl_File_Sort_F *s = fl_numericsort);
97 # endif /* __cplusplus */
100 * FLTK 1.0.x compatibility definitions...
103 # ifdef FLTK_1_0_COMPAT
104 # define filename_absolute fl_filename_absolute
105 # define filename_expand fl_filename_expand
106 # define filename_ext fl_filename_ext
107 # define filename_isdir fl_filename_isdir
108 # define filename_list fl_filename_list
109 # define filename_match fl_filename_match
110 # define filename_name fl_filename_name
111 # define filename_relative fl_filename_relative
112 # define numericsort fl_numericsort
113 # endif /* FLTK_1_0_COMPAT */
116 #endif /* FL_FILENAME_H */
119 * End of "$Id: filename.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".