X-Git-Url: http://git.pond.sub.org/?p=empserver;a=blobdiff_plain;f=src%2Flib%2Fcommands%2Finfo.c;h=961ad606b4c93c330d5783f15bd1effd644ca36e;hp=ad6148047f305f90b36e3f403b33982959de31aa;hb=7b9e579408306be4f37ac26fd6c349841dcf11dd;hpb=1118f1c0ca13ca25b662fa600c5101ff1d38b67d diff --git a/src/lib/commands/info.c b/src/lib/commands/info.c index ad6148047..961ad606b 100644 --- a/src/lib/commands/info.c +++ b/src/lib/commands/info.c @@ -1,6 +1,6 @@ /* * Empire - A multi-player, client/server Internet based war game. - * Copyright (C) 1986-2012, 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 @@ -41,6 +41,7 @@ #include #include #if !defined(_WIN32) +#include #include #endif #include "commands.h" @@ -91,7 +92,7 @@ info(void) 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"); @@ -144,7 +145,7 @@ info(void) 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); @@ -186,7 +187,7 @@ apro(void) 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; } @@ -219,7 +220,7 @@ apro(void) 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); @@ -300,7 +301,7 @@ info(void) 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, "*");