24 #if defined (HAVE_SYS_PARAM_H) 25 # include <sys/param.h> 27 #include <posixstat.h> 29 #if defined (HAVE_UNISTD_H) 41 #if !defined (MAXSYMLINKS) 42 # define MAXSYMLINKS 32 58 return readlink (path, buf, bufsiz);
67 #define DOUBLE_SLASH(p) ((p[0] == '/') && (p[1] == '/') && p[2] != '/') 80 char *result, *
p, *q, *qsave, *qbase, *workpath;
81 int double_slash_path, linklen, nlink;
83 linklen = strlen (path);
108 #if defined (__CYGWIN__) 109 qbase = (
ISALPHA((
unsigned char)workpath[0]) && workpath[1] ==
':') ? workpath + 3 : workpath + 1;
111 qbase = workpath + 1;
114 qbase += double_slash_path;
116 for (p = workpath; p < qbase; )
133 else if(p[0] ==
'.' &&
PATHSEP(p[1]))
135 else if (p[0] ==
'.' && p[1] ==
'.' &&
PATHSEP(p[2]))
140 while (--q > qbase &&
ISDIRSEP(*q) == 0)
155 errno = ENAMETOOLONG;
187 return ((
char *)
NULL);
190 linkbuf[linklen] =
'\0';
193 if ((strlen (p) + linklen + 2) >=
PATH_MAX)
196 errno = ENAMETOOLONG;
210 strcpy (tbuf + linklen, p);
217 #if defined (__CYGWIN__) 218 qbase = (
ISALPHA((
unsigned char)workpath[0]) && workpath[1] ==
':') ? workpath + 3 : workpath + 1;
220 qbase = workpath + 1;
223 qbase += double_slash_path;
225 for (p = workpath; p < qbase; )
245 if (result[2] ==
'\0')
248 memmove (result, result + 1, strlen (result + 1) + 1);
256 const char *pathname;
261 if (pathname == 0 || *pathname ==
'\0')
263 errno = (pathname == 0) ? EINVAL : ENOENT;
264 return ((
char *)
NULL);
271 return ((
char *)
NULL);
286 strncpy (resolved, wd,
PATH_MAX - 1);
char *get_working_directory __P((char *))
char * sh_makepath(char *path, char *dir, int flags) const
static char tdir[PATH_MAX]
char * savestring(const char *s)
char * sh_realpath(char *pathname, char *resolved) const
char * get_working_directory(char *for_whom)
char * sh_physpath(char *path, int flags)
static int _path_readlink(char *path, char *buf, int bufsiz)