annotate kpathsea/xstat.c @ 3468:a2dc6de198f9

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