comparison src/realpath.c @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 697ef44129c6
children
comparison
equal deleted inserted replaced
423:28d9c139be4c 424:11054d720c21
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */ 21 Boston, MA 02111-1307, USA. */
22 22
23 /* Synched up with: Not in FSF. */ 23 /* Synched up with: Not in FSF. */
24 24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h> 25 #include <config.h>
27 #endif
28 26
29 #include <sys/types.h> 27 #include <sys/types.h>
30 #if defined(HAVE_UNISTD_H) || defined(STDC_HEADERS)
31 #include <unistd.h>
32 #endif
33 #include <stdio.h> 28 #include <stdio.h>
34 #include <string.h> 29 #include <string.h>
30 #include <errno.h>
31 #ifdef HAVE_UNISTD_H
32 #include <unistd.h>
33 #endif
35 #ifdef _POSIX_VERSION 34 #ifdef _POSIX_VERSION
36 #include <limits.h> /* for PATH_MAX */ 35 #include <limits.h> /* for PATH_MAX */
37 #else 36 #else
38 #include <sys/param.h> /* for MAXPATHLEN */ 37 #include <sys/param.h> /* for MAXPATHLEN */
39 #endif
40 #include <errno.h>
41 #ifndef STDC_HEADERS
42 extern int errno;
43 #endif 38 #endif
44 39
45 #ifdef WINDOWSNT 40 #ifdef WINDOWSNT
46 #include <direct.h> 41 #include <direct.h>
47 #endif 42 #endif
60 #endif 55 #endif
61 #endif 56 #endif
62 57
63 #define MAX_READLINKS 32 58 #define MAX_READLINKS 32
64 59
65 #ifdef __STDC__ 60 char *
66 char *xrealpath(const char *path, char resolved_path []) 61 xrealpath (const char *path, char resolved_path [])
67 #else
68 char *xrealpath(path, resolved_path)
69 const char *path;
70 char resolved_path [];
71 #endif
72 { 62 {
73 char copy_path[PATH_MAX]; 63 char copy_path[PATH_MAX];
74 char *new_path = resolved_path; 64 char *new_path = resolved_path;
75 char *max_path; 65 char *max_path;
76 #ifdef S_IFLNK 66 #ifdef S_IFLNK