diff options
| author | Richard M. Stallman | 1994-01-21 06:34:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-01-21 06:34:16 +0000 |
| commit | 0f2cd61fa58db97ef2f75156722466508b3cc983 (patch) | |
| tree | 650932a590e919824c8837dba197b880553015ba /src | |
| parent | f5f6a944dca089fef3039c410ba77def602c3742 (diff) | |
| download | emacs-0f2cd61fa58db97ef2f75156722466508b3cc983.tar.gz emacs-0f2cd61fa58db97ef2f75156722466508b3cc983.zip | |
(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')
| -rw-r--r-- | src/xrdb.c | 25 |
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. */ | |||
| 55 | #define MAXPATHLEN 256 | 55 | #define MAXPATHLEN 256 |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #if !defined(S_ISDIR) && defined(S_IFDIR) | ||
| 59 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | ||
| 60 | #endif | ||
| 61 | |||
| 58 | extern char *getenv (); | 62 | extern char *getenv (); |
| 59 | 63 | ||
| 60 | /* This does cause trouble on AIX. I'm going to take the comment at | 64 | /* This does cause trouble on AIX. I'm going to take the comment at |
| @@ -320,7 +324,7 @@ file_p (path) | |||
| 320 | 324 | ||
| 321 | return (access (path, 4) == 0 /* exists and is readable */ | 325 | return (access (path, 4) == 0 /* exists and is readable */ |
| 322 | && stat (path, &status) == 0 /* get the status */ | 326 | && stat (path, &status) == 0 /* get the status */ |
| 323 | && (status.st_mode & S_IFDIR) == 0); /* not a directory */ | 327 | && (S_ISDIR (status.st_mode)) == 0); /* not a directory */ |
| 324 | } | 328 | } |
| 325 | 329 | ||
| 326 | 330 | ||
| @@ -339,23 +343,18 @@ search_magic_path (search_path, class, escaped_suffix, suffix) | |||
| 339 | for (p = s; *p && *p != ':'; p++) | 343 | for (p = s; *p && *p != ':'; p++) |
| 340 | ; | 344 | ; |
| 341 | 345 | ||
| 342 | if (*p == ':' && *(p + 1) == ':') | 346 | if (p > s) |
| 343 | { | 347 | { |
| 344 | char *path; | 348 | char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix); |
| 345 | |||
| 346 | s = "%N%S"; | ||
| 347 | path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix); | ||
| 348 | if (path) | 349 | if (path) |
| 349 | return path; | 350 | return path; |
| 350 | |||
| 351 | /* Skip the first colon. */ | ||
| 352 | p++; | ||
| 353 | continue; | ||
| 354 | } | 351 | } |
| 355 | 352 | else if (*p == ':') | |
| 356 | if (p > s) | ||
| 357 | { | 353 | { |
| 358 | char *path = magic_file_p (s, p - s, class, escaped_suffix, suffix); | 354 | char *path; |
| 355 | |||
| 356 | s = "%N%S"; | ||
| 357 | path = magic_file_p (s, strlen (s), class, escaped_suffix, suffix); | ||
| 359 | if (path) | 358 | if (path) |
| 360 | return path; | 359 | return path; |
| 361 | } | 360 | } |