X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fhelpfile.c;h=a08c7b7316f0a7abcbb3d8bb1014deb61fa25e91;hb=f8dd4fc662c0a192f777bc426b37336300670b9b;hp=466ec33c5d09a0ffb98df0b1a9b84613fe205526;hpb=2181f88dc0f1c6ecebecc8457909601f3b4ee6aa;p=srvx.git diff --git a/src/helpfile.c b/src/helpfile.c index 466ec33..a08c7b7 100644 --- a/src/helpfile.c +++ b/src/helpfile.c @@ -24,7 +24,13 @@ #include "modcmd.h" #include "nickserv.h" +#if defined(HAVE_DIRENT_H) #include +#endif + +#if defined(HAVE_SYS_STAT_H) +#include +#endif 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; +#ifdef HAVE_DIRENT_D_TYPE 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);