Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zrealpath



This implements zrealpath.  If there is no realpath() it merely
copies the string.  I think that this is acceptable for now since
nothing depends upon it.

Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.17
diff -u -r1.17 configure.in
--- configure.in	2000/08/02 18:01:51	1.17
+++ configure.in	2000/08/05 01:21:37
@@ -864,7 +864,7 @@
 	       signgam \
 	       putenv getenv \
 	       brk sbrk \
-	       pathconf)
+	       pathconf realpath)
 AC_FUNC_STRCOLL
 
 if test $ac_cv_func_setpgrp = yes; then
Index: Src/compat.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/compat.c,v
retrieving revision 1.2
diff -u -r1.2 compat.c
--- Src/compat.c	2000/08/04 07:09:12	1.2
+++ Src/compat.c	2000/08/05 01:21:39
@@ -141,6 +141,19 @@
 }
 #endif
 
+/**/
+mod_export char *
+zrealpath(const char *path, char *resolved_path)
+{
+#ifdef HAVE_REALPATH
+    return realpath(path, resolved_path);
+#else /* the following block should be replaced with a realpath() equiv. */
+    long pathmax;
+
+    if ((pathmax = zpathmax(path)) > 0)
+	return strncpy(resolved_path, path, pathmax);
+#endif
+}
 
 /**/
 mod_export char *



Messages sorted by: Reverse Date, Date, Thread, Author