changeset 5650:1476768ef7fc

(S_ISDIR): Define if not defined. (file_p): Use S_ISDIR. (search_magic_path): Fix logic testing for empty path element.
author Richard M. Stallman <rms@gnu.org>
date Fri, 21 Jan 1994 06:34:16 +0000
parents 016c15cf28a7
children 98f1c53b0ce6
files src/xrdb.c
diffstat 1 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/xrdb.c	Fri Jan 21 04:19:19 1994 +0000
+++ b/src/xrdb.c	Fri Jan 21 06:34:16 1994 +0000
@@ -55,6 +55,10 @@
 #define MAXPATHLEN	256
 #endif
 
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
 extern char *getenv ();
 
 /* This does cause trouble on AIX.  I'm going to take the comment at
@@ -320,7 +324,7 @@
 
   return (access (path, 4) == 0			/* exists and is readable */
 	  && stat (path, &status) == 0		/* get the status */
-	  && (status.st_mode & S_IFDIR) == 0);	/* not a directory */
+	  && (S_ISDIR (status.st_mode)) == 0);	/* not a directory */
 }
 
 
@@ -339,7 +343,13 @@
       for (p = s; *p && *p != ':'; p++)
 	;
       
-      if (*p == ':' && *(p + 1) == ':')
+      if (p > s)
+	{
+	  char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
+	  if (path)
+	    return path;
+	}
+      else if (*p == ':')
 	{
 	  char *path;
 
@@ -347,17 +357,6 @@
 	  path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix);
 	  if (path)
 	    return path;
-
-	  /* Skip the first colon.  */
-	  p++;
-	  continue;
-	}
-
-      if (p > s)
-	{
-	  char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
-	  if (path)
-	    return path;
 	}
 
       if (*p == ':')