>>>> "Dan" == Dan Holmsand
<dan(a)eyebee.com> writes:
Dan> Terribly sorry. Mea culpa. Etc.
Dan> I must admit that I don't know anything about Mule, and that I didn't
Dan> even come close to realize that including sysfile.h and lisp.h meant a
Dan> fundamental redesign. Sorry again.
Dan> A feeble attempt to fix this mess:
Dan> I assume that the real problem is the inclusion of sysfile.h, and my
Dan> stupid, conflicting naming "sys_realpath" for an internal macro. I
Dan> really can't do without lisp.h, however (I need DIRECTORY_SEP, etc.),
Dan> so I just pray that's ok...
Dan> So, I've restored most of the original includes and the definition of
Dan> PATH_MAX, removed the inclusion of sysfile.h, and renamed my macro
Dan> sys_readlink to system_readlink.
(The proper thing to do with PATH_MAX is to stop using it globally,
but that is a future project)
Dan> This works well on native windows and cygwin, but I'm not able to test
Dan> under Linux and, therefore, not under Mule.
Thanks, Dan. Works for me.
I'm committing Dan's latest patch with this ChangeLog:
2000-12-05 Dan Holmsand <dan(a)eyebee.com>
* realpath.c:
Don't #include sysfile.h. Revert to duplicating PATH_MAX
initialization.
(sys_readlink): renamed to system_readlink to avoid conflict with
the other sys_readlink.
Index: realpath.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/realpath.c,v
retrieving revision 1.6.2.8
diff -u -w -r1.6.2.8 realpath.c
--- realpath.c 2000/12/01 12:44:53 1.6.2.8
+++ realpath.c 2000/12/05 02:37:13
@@ -24,12 +24,22 @@
#include <config.h>
#include "lisp.h"
-#include "sysfile.h"
+#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if defined (HAVE_SYS_PARAM_H) && !defined (WIN32_NATIVE)
+#include <sys/param.h>
+#endif
+
+#ifdef WIN32_NATIVE
+#include <direct.h>
+#endif
+#include <sys/stat.h> /* for S_IFLNK */
+
/* First char after start of absolute filename. */
#define ABS_START(name) (name + ABS_LENGTH (name))
@@ -38,15 +48,15 @@
# define ABS_LENGTH(name) (win32_abs_start (name))
static int win32_abs_start (const char * name);
/* System dependent version of readlink. */
-# define sys_readlink(name, buf, size) win32_readlink (name, buf, size)
+# define system_readlink win32_readlink
#else
# ifdef CYGWIN
# define ABS_LENGTH(name) (IS_DIRECTORY_SEP (*name) ? \
(IS_DIRECTORY_SEP (name[1]) ? 2 : 1) : 0)
-# define sys_readlink(name, buf, size) cygwin_readlink (name, buf, size)
+# define system_readlink cygwin_readlink
# else
# define ABS_LENGTH(name) (IS_DIRECTORY_SEP (*name) ? 1 : 0)
-# define sys_readlink(name, buf, size) readlink (name, buf, size)
+# define system_readlink readlink
# endif /* CYGWIN */
#endif /* WIN32_NATIVE */
@@ -162,6 +172,16 @@
#define getcwd(buffer, len) getwd (buffer)
#endif
+#ifndef PATH_MAX
+# if defined (_POSIX_PATH_MAX)
+# define PATH_MAX _POSIX_PATH_MAX
+# elif defined (MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+# else
+# define PATH_MAX 1024
+# endif
+#endif
+
#define MAX_READLINKS 32
char * xrealpath (const char *path, char resolved_path []);
@@ -274,7 +294,7 @@
#if defined (S_IFLNK) || defined (WIN32_NATIVE)
/* See if latest pathname component is a symlink. */
*new_path = '\0';
- n = sys_readlink (resolved_path, link_path, PATH_MAX - 1);
+ n = system_readlink (resolved_path, link_path, PATH_MAX - 1);
if (n < 0)
{