]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/info.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / info.c
index c12c27ccf3e06c022b6a52460ff1978e28db4888..e2bc48222d46d4eedaafbe34679ce13f76112253 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *     Steve McClure, 1998-2000
  */
 
-#include "misc.h"
-#include "player.h"
+#include <config.h>
+
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <time.h>
 #if !defined(_WIN32)
 #include <dirent.h>
 #else
 #include <windows.h>
 #endif
+#include "misc.h"
+#include "player.h"
 #include "commands.h"
 #include "optlist.h"
 
@@ -96,7 +99,6 @@ info(void)
     snprintf(filename, sizeof(filename), "%s/%s", infodir, name);
     fp = fopen(filename, "r");
     if (fp == NULL) {
-       int len = strlen(name);
        /* may be a "partial" request.  */
        info_dp = opendir(infodir);
        if (info_dp == 0) {
@@ -310,7 +312,6 @@ info(void)
        /* may be a "partial" request.  */
        HANDLE hDir;
        WIN32_FIND_DATA fData;
-       int len = strlen(name);
        strcat(filename, "*");
        hDir = FindFirstFile(filename, &fData);
        if (hDir == INVALID_HANDLE_VALUE) {
@@ -325,8 +326,8 @@ info(void)
                break;
            default:
                pr("Error reading info dir\n");
-               logerror("Error (%d) reading info dir(%s)\\file(%s)",
-                   infodir, filename, GetLastError());
+               logerror("Error (%lu) reading info dir(%s)\\file(%s)",
+                   GetLastError(), infodir, filename);
            }
            return RET_SYS;
        }
@@ -376,9 +377,9 @@ info(void)
     else {
        DWORD fAttrib = GetFileAttributes(filename);
        if ((fAttrib == (DWORD)-1) || /* INVALID_FILE_ATTRIBUTES */
-           (fAttrib != FILE_ATTRIBUTE_NORMAL) &&
-           (fAttrib != FILE_ATTRIBUTE_ARCHIVE) &&
-           (fAttrib != FILE_ATTRIBUTE_READONLY)) {
+           ((fAttrib != FILE_ATTRIBUTE_NORMAL) &&
+            (fAttrib != FILE_ATTRIBUTE_ARCHIVE) &&
+            (fAttrib != FILE_ATTRIBUTE_READONLY))) {
            pr("Error reading info file for %s\n", name);
            logerror("The info file \"%s\" is not regular file\n",
                     filename);
@@ -428,8 +429,8 @@ apro(void)
            logerror("Can't open info dir \"%s\"", infodir);
        } else {
            pr("Error reading info dir\n");
-           logerror("Error (%d) reading info dir(%s)\\file(%s)",
-               infodir, filename, GetLastError());
+           logerror("Error (%lu) reading info dir(%s)\\file(%s)",
+               GetLastError(), infodir, filename);
        }
        return RET_SYS;
     }
@@ -495,7 +496,7 @@ apro(void)
     free(lbp);
 
     if ((nhl) > lhitlim) {
-       pr("Limit of %ld lines exceeded\n", lhitlim);
+       pr("Limit of %d lines exceeded\n", lhitlim);
     }
     pr("Found %s in %ld of %ld files and in %ld of %ld lines\n",
        name, nhf, nf, nhl, nl);