]> git.pond.sub.org Git - empserver/blobdiff - src/client/termio.c
(main): Don't bother to close socket before exit().
[empserver] / src / client / termio.c
index 8025406d090eb18e29a7f5cb5175b29db415a54d..9819bde0af840f32654ec118677f15eeddcf9fd2 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-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 
 #include <config.h>
 
+#include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <unistd.h>
-#else
+#ifdef _WIN32
 #include <io.h>
-#endif /* _WIN32 */
+#else
+#include <unistd.h>
+#endif
 #include "misc.h"
 #include "tags.h"
 
+static int sendeof(int sock);
+
 int
 termio(int fd, int sock, FILE *auxfi)
 {
@@ -164,7 +166,7 @@ termio(int fd, int sock, FILE *auxfi)
        if (*p == '\n') {
            if (tagging) {
                tag = malloc(sizeof(struct tagstruct));
-               tag->item = malloc((1 + p - s) * sizeof(char));
+               tag->item = malloc(1 + p - s);
                tag->next = taglist;
                taglist = tag;
                t = tag->item;
@@ -243,7 +245,7 @@ termio(int fd, int sock, FILE *auxfi)
     return 1;
 }
 
-int
+static int
 sendeof(int sock)
 {
 #ifndef _WIN32
@@ -252,7 +254,11 @@ sendeof(int sock)
     if (send(sock, "ctld\n", 5, 0) < 5) {
 #endif
        fprintf(stderr, "sendeof: EOF send failed\n");
+#ifdef _WIN32
+       closesocket(sock);
+#else
        close(sock);
+#endif
        return 0;
     }
     return 1;