2999
|
1 /* xstat.c: stat and (maybe) lstat with error checking. |
|
2 |
|
3 Copyright (C) 1992, 93 Free Software Foundation, Inc. |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public |
|
16 License along with this library; if not, write to the Free Software |
|
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
18 |
|
19 #include <kpathsea/config.h> |
|
20 |
|
21 #include <kpathsea/xstat.h> |
|
22 |
|
23 |
|
24 struct stat |
|
25 xstat P1C(const_string, path) |
|
26 { |
|
27 struct stat s; |
|
28 |
|
29 if (stat (path, &s) != 0) |
|
30 FATAL_PERROR (path); |
|
31 |
|
32 return s; |
|
33 } |
|
34 |
|
35 |
|
36 /* If we don't have symbolic links, lstat is the same as stat, and |
|
37 a #define is made in the include file. We declare lstat to avoid an |
|
38 implicit declaration warning for development; sigh. */ |
|
39 |
|
40 #ifdef S_ISLNK |
|
41 extern int lstat (); |
|
42 struct stat |
|
43 xlstat P1C(const_string, path) |
|
44 { |
|
45 struct stat s; |
|
46 |
|
47 if (lstat (path, &s) != 0) |
|
48 FATAL_PERROR (path); |
|
49 |
|
50 return s; |
|
51 } |
|
52 #endif |