projects
/
srvx.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix compile errors on readdir()-deficient platforms
[srvx.git]
/
src
/
helpfile.c
diff --git
a/src/helpfile.c
b/src/helpfile.c
index 466ec33c5d09a0ffb98df0b1a9b84613fe205526..a08c7b7316f0a7abcbb3d8bb1014deb61fa25e91 100644
(file)
--- a/
src/helpfile.c
+++ b/
src/helpfile.c
@@
-24,7
+24,13
@@
#include "modcmd.h"
#include "nickserv.h"
#include "modcmd.h"
#include "nickserv.h"
+#if defined(HAVE_DIRENT_H)
#include <dirent.h>
#include <dirent.h>
+#endif
+
+#if defined(HAVE_SYS_STAT_H)
+#include <sys/stat.h>
+#endif
static const struct message_entry msgtab[] = {
{ "HFMSG_MISSING_HELPFILE", "The help file could not be found. Sorry!" },
static const struct message_entry msgtab[] = {
{ "HFMSG_MISSING_HELPFILE", "The help file could not be found. Sorry!" },
@@
-224,8
+230,20
@@
static void language_read_list(void)
while ((dirent = readdir(dir))) {
if (dirent->d_name[0] == '.')
continue;
while ((dirent = readdir(dir))) {
if (dirent->d_name[0] == '.')
continue;
+#ifdef HAVE_DIRENT_D_TYPE
if (dirent->d_type != DT_DIR)
continue;
if (dirent->d_type != DT_DIR)
continue;
+#else
+ {
+ char namebuf[MAXLEN];
+ struct stat sbuf;
+ snprintf(namebuf, sizeof(namebuf), "languages/%s", dirent->d_name);
+ if (stat(namebuf, &sbuf) < 0)
+ continue;
+ if (!S_ISDIR(sbuf.st_mode))
+ continue;
+ }
+#endif
language_alloc(dirent->d_name);
}
closedir(dir);
language_alloc(dirent->d_name);
}
closedir(dir);