about summary refs log tree commit diff
path: root/Src/system.h
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-08-04 07:09:12 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-08-04 07:09:12 +0000
commit22cbf1b2719c99c2f17a34859520dbead03e5799 (patch)
treeab0c326c9a8a69c3acab21f9b880b6d3b59dfce4 /Src/system.h
parent55b07cb525388bca7c0dbaf057483c493ff0b053 (diff)
downloadzsh-22cbf1b2719c99c2f17a34859520dbead03e5799.tar.gz
zsh-22cbf1b2719c99c2f17a34859520dbead03e5799.tar.xz
zsh-22cbf1b2719c99c2f17a34859520dbead03e5799.zip
15216: Rewrite pathconf() support.
Diffstat (limited to 'Src/system.h')
-rw-r--r--Src/system.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/system.h b/Src/system.h
index cba80a5f6..ba83e005e 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -194,8 +194,8 @@ struct timezone {
 # define VARARR(X,Y,Z)	X *(Y) = (X *) alloca(sizeof(X) * (Z))
 #endif
 
-/* we should be getting this value from pathconf(_PC_PATH_MAX) */
-/* but this is too much trouble                                */
+/* we should handle unlimited sizes from pathconf(_PC_PATH_MAX) */
+/* but this is too much trouble                                 */
 #ifndef PATH_MAX
 # ifdef MAXPATHLEN
 #  define PATH_MAX MAXPATHLEN
@@ -204,6 +204,11 @@ struct timezone {
 #  define PATH_MAX 1024
 # endif
 #endif
+#ifndef HAVE_PATHCONF
+# define zpathmax(X) ((long)((strlen(X) >= PATH_MAX) ? \
+			     ((errno = ENAMETOOLONG), -1) : \
+			     ((errno = 0), PATH_MAX))
+#endif
 
 /* we should be getting this value from sysconf(_SC_OPEN_MAX) */
 /* but this is too much trouble                               */