OSDN Git Service

7b3bdec7753814cced003610f8b0c4f246a4b0a3
[putex/putex.git] / src / texsourc / dirio.h
1 /* dirio.h: checked directory operations.
2
3    Copyright 1992 Karl Berry
4    Copyright 2007 TeX Users Group
5    Copyright 2014 Clerk Ma
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301 USA.  */
21
22 #ifndef MSDOS
23
24 #ifndef DIRIO_H
25 #define DIRIO_H
26
27 /* #if DIRENT || _POSIX_VERSION */
28 #if defined(DIRENT) || defined(_POSIX_VERSION)                  /* 93/Dec/8 */
29   #include <dirent.h>
30   #define NLENGTH(dirent) strlen ((dirent)->d_name)
31 #else /* not (DIRENT or _POSIX_VERSION) */
32   #define dirent direct
33   #define NLENGTH(dirent) ((dirent)->d_namlen)
34
35 #ifdef SYSNDIR
36 #include <sys/ndir.h>
37 #endif /* not SYSNDIR */
38
39 #ifdef NDIR
40 #include <ndir.h>
41 #endif /* not NDIR */
42
43 #ifdef SYSDIR
44 #include <sys/dir.h>
45 #endif /* not SYSDIR */
46
47 #endif /* not (DIRENT or _POSIX_VERSION) */
48
49 /* Like opendir, closedir, and chdir, but abort if DIRNAME can't be opened.  */
50 extern DIR *xopendir P1H(string);
51 extern void xclosedir P1H(DIR *);
52 #endif /* not DIRIO_H */
53
54 #endif /* not DOS */ /* was: not DIRIO_H, which is wrong - bkph */
55
56 /* #if !defined(DOS) || defined(PHARLAP) */ /* 1999/Jan/9 */
57
58 /* Returns true if FN is a directory (or a symlink to a directory).  */
59 extern bool dir_p P1H(string fn);
60
61 /* Returns true if FN is directory with no subdirectories.  */
62 extern bool leaf_dir_p P1H(string fn);
63
64 /* #endif */ /* not DOS, or DOS with PHARLAP */
65