/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2014, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
#include <sys/stat.h>
#include <stdio.h>
#if !defined(_WIN32)
+#include <strings.h>
#include <dirent.h>
#endif
#include "commands.h"
snprintf(filename, sizeof(filename), "%s/%s", infodir, name);
fp = fopen(filename, "r");
if (fp == NULL) {
- /* may be a "partial" request. */
+ /* may be a "partial" request. */
info_dp = opendir(infodir);
if (!info_dp) {
pr("Can't open info dir\n");
fclose(fp);
return RET_FAIL;
}
- if ((statb.st_mode & S_IFREG) == 0) {
+ if (!S_ISREG(statb.st_mode)) {
pr("Error reading info file for %s\n", name);
logerror("The info file \"%s\" is not regular file\n", filename);
fclose(fp);
info_dp = opendir(infodir);
if (info_dp == NULL) {
- pr("Can't open info dir \n");
+ pr("Can't open info dir\n");
logerror("Can't open info dir \"%s\"", infodir);
return RET_FAIL;
}
fclose(fp);
continue;
}
- if ((statb.st_mode & S_IFREG) == 0) {
+ if (!S_ISREG(statb.st_mode)) {
logerror("The info file \"%s\" is not regular file\n",
filename);
fclose(fp);
snprintf(filename, sizeof(filename) - 1, "%s\\%s", infodir, name);
fp = fopen(filename, "rb");
if (fp == NULL) {
- /* may be a "partial" request. */
+ /* may be a "partial" request. */
HANDLE hDir;
WIN32_FIND_DATA fData;
strcat(filename, "*");