]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/info.c
info: Use S_ISREG() instead of S_IFREG for readability
[empserver] / src / lib / commands / info.c
index f70a116884693ed98cd56da45e697a30090207e8..961ad606b4c93c330d5783f15bd1effd644ca36e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2017, 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 <sys/stat.h>
 #include <stdio.h>
 #if !defined(_WIN32)
+#include <strings.h>
 #include <dirent.h>
 #endif
 #include "commands.h"
@@ -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);
@@ -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);