Mercurial > hg > xemacs-beta
comparison src/realpath.c @ 288:e11d67e05968 r21-0b42
Import from CVS: tag r21-0b42
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:54 +0200 |
parents | 558f606b08ae |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
287:13a0bd77a29d | 288:e11d67e05968 |
---|---|
40 #include <errno.h> | 40 #include <errno.h> |
41 #ifndef STDC_HEADERS | 41 #ifndef STDC_HEADERS |
42 extern int errno; | 42 extern int errno; |
43 #endif | 43 #endif |
44 | 44 |
45 #ifdef WINDOWSNT | |
46 #include <direct.h> | |
47 #endif | |
48 | |
45 #include <sys/stat.h> /* for S_IFLNK */ | 49 #include <sys/stat.h> /* for S_IFLNK */ |
46 | 50 |
47 #ifndef PATH_MAX | 51 #ifndef PATH_MAX |
48 #ifdef _POSIX_VERSION | 52 #ifdef _POSIX_VERSION |
49 #define PATH_MAX _POSIX_PATH_MAX | 53 #define PATH_MAX _POSIX_PATH_MAX |
65 const char *path; | 69 const char *path; |
66 char resolved_path []; | 70 char resolved_path []; |
67 #endif | 71 #endif |
68 { | 72 { |
69 char copy_path[PATH_MAX]; | 73 char copy_path[PATH_MAX]; |
70 char link_path[PATH_MAX]; | |
71 char *new_path = resolved_path; | 74 char *new_path = resolved_path; |
72 char *max_path; | 75 char *max_path; |
73 int readlinks = 0; | 76 int readlinks = 0; |
77 #ifdef S_IFLNK | |
78 char link_path[PATH_MAX]; | |
74 int n; | 79 int n; |
80 #endif | |
75 | 81 |
76 /* Make a copy of the source path since we may need to modify it. */ | 82 /* Make a copy of the source path since we may need to modify it. */ |
77 strcpy(copy_path, path); | 83 strcpy(copy_path, path); |
78 path = copy_path; | 84 path = copy_path; |
79 max_path = copy_path + PATH_MAX - 2; | 85 max_path = copy_path + PATH_MAX - 2; |