summaryrefslogtreecommitdiff
path: root/src/xrdb.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-01-21 06:34:16 +0000
committerRichard M. Stallman <rms@gnu.org>1994-01-21 06:34:16 +0000
commit294147700dc48338667d36dd94e1be865f00aa9c (patch)
tree672fbefb2ad6c5ea672bb06926dc1087128ee5c6 /src/xrdb.c
parent99e5283f4f5ef7da920f31dca0007095947057fd (diff)
downloademacs-294147700dc48338667d36dd94e1be865f00aa9c.tar.gz
(S_ISDIR): Define if not defined.
(file_p): Use S_ISDIR. (search_magic_path): Fix logic testing for empty path element.
Diffstat (limited to 'src/xrdb.c')
-rw-r--r--src/xrdb.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/xrdb.c b/src/xrdb.c
index 4c80d055536..d3f22c91610 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -55,6 +55,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#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 @@ file_p (path)
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,23 +343,18 @@ search_magic_path (search_path, class, escaped_suffix, suffix)
for (p = s; *p && *p != ':'; p++)
;
- if (*p == ':' && *(p + 1) == ':')
+ if (p > s)
{
- char *path;
-
- s = "%N%S";
- path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix);
+ char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
if (path)
return path;
-
- /* Skip the first colon. */
- p++;
- continue;
}
-
- if (p > s)
+ else if (*p == ':')
{
- char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix);
+ char *path;
+
+ s = "%N%S";
+ path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix);
if (path)
return path;
}