]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/rea.c
Fix trailing whitespace
[empserver] / src / lib / commands / rea.c
index 8dcb61b81ffe64edd6e34591aee0bfa3b59d594b..5de2bb2b9849227589d5975bcab98bd0056f7c0a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *  ---
  *
  *  rea.c: Read telegrams
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare
  *     Doug Hay, 1998
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
-#include "nat.h"
-#include "file.h"
-#include "tel.h"
+#include <ctype.h>
+#include <stdio.h>
 #include "commands.h"
-#include "optlist.h"
 #include "match.h"
-
-#include <stdio.h>
-#include <fcntl.h>
-#if !defined(_WIN32)
-#include <sys/file.h>
-#endif
+#include "misc.h"
+#include "optlist.h"
+#include "tel.h"
 
 int
 rea(void)
 {
-    static s_char *telnames[] = {
+    static char *telnames[] = {
        /* must follow TEL_ defines in tel.h */
        "Telegram", "Announcement", "BULLETIN", "Production Report"
     };
-    register s_char *p;
-    register s_char *mbox;
-    s_char mbox_buf[256];      /* Maximum path length */
+    char *p;
+    char *mbox;
+    char mbox_buf[256];                /* Maximum path length */
     struct telstr tgm;
     FILE *telfp;
     int teles;
     int size;
-    unsigned int nbytes;
+    unsigned nbytes;
     char buf[1024];
     char msgbuf[4096];         /* UTF-8 */
     int lasttype;
@@ -72,7 +65,7 @@ rea(void)
     time_t lastdate;
     int header;
     int filelen;
-    s_char kind[80];
+    char *kind;
     int n;
     int num = player->cnum;
     struct natstr *np = getnatp(player->cnum);
@@ -83,11 +76,10 @@ rea(void)
     int readit;
     int may_delete = 1; /* may messages be deleted? */
 
-    memset(kind, 0, sizeof(kind));
     now = time(NULL);
 
     if (*player->argp[0] == 'w') {
-       strcpy(kind, "announcement");
+       kind = "announcement";
        if (player->argp[1] && isdigit(*player->argp[1])) {
            delta = days(atoi(player->argp[1]));
            then = now - delta;
@@ -96,7 +88,7 @@ rea(void)
            then = np->nat_annotim;
        mbox = annfil;
     } else {
-       strcpy(kind, "telegram");
+       kind = "telegram";
        if (player->god && player->argp[1] &&
            (mineq(player->argp[1], "yes") == ME_MISMATCH) &&
            (mineq(player->argp[1], "no") == ME_MISMATCH)) {
@@ -175,7 +167,6 @@ rea(void)
            tgm.tel_length -= nbytes;
        }
     }
-    p = NULL;
     if (teles > 0 && player->cnum == num && may_delete) {
        pr("\n");
        if (teles == 1) {
@@ -207,7 +198,7 @@ rea(void)
                /* Here, we just re-open the file for "w" only,
                   and that will wipe the file clean automatically */
                (void)fclose(telfp);
-               telfp = fopen((char *)mbox, "wb");
+               telfp = fopen(mbox, "wb");
            }
        }
     }