a0956dbb69560a8b294aa8f31234372587c69879
[obnox/wireshark/wip.git] / epan / filesystem.h
1 /* filesystem.h
2  * Filesystem utility definitions
3  *
4  * $Id: filesystem.h,v 1.7 2001/10/22 23:16:01 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  * 
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  * 
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef FILESYSTEM_H
26 #define FILESYSTEM_H
27
28 /*
29  * Given a pathname, return a pointer to the last pathname separator
30  * character in the pathname, or NULL if the pathname contains no
31  * separators.
32  */
33 char *find_last_pathname_separator(char *);
34
35 /*
36  * Given a pathname, return the last component.
37  */
38 char *get_basename(char *);
39
40 /*
41  * Given a pathname, return a string containing everything but the
42  * last component.  NOTE: this overwrites the pathname handed into
43  * it....
44  */
45 char *get_dirname(char *);
46
47 /*
48  * Given a pathname, return:
49  *
50  *      the errno, if an attempt to "stat()" the file fails;
51  *
52  *      EISDIR, if the attempt succeeded and the file turned out
53  *      to be a directory;
54  *
55  *      0, if the attempt succeeded and the file turned out not
56  *      to be a directory.
57  */
58 int test_for_directory(const char *);
59
60 /*
61  * Get the directory in which global configuration and data files are
62  * stored.
63  */
64 const char *get_datafile_dir(void);
65
66 /*
67  * Get the directory in which files that, at least on UNIX, are
68  * system files (such as "/etc/ethers") are stored; on Windows,
69  * there's no "/etc" directory, so we get them from the Ethereal
70  * global configuration and data file directory.
71  */
72 const char *get_systemfile_dir(void);
73
74 /*
75  * Get the directory in which personal configuration files are stored.
76  */
77 const char *get_persconffile_dir(void);
78
79 #endif /* FILESYSTEM_H */