]> git.pond.sub.org Git - empserver/blobdiff - src/client/termio.c
Update copyright notice.
[empserver] / src / client / termio.c
index 6586f200b0175ce536347ed7539f44ba707ed599..fa710c37a7c04d3810c5ea07e717811e50356eed 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
-#include <winsock.h>
+#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)
 {
@@ -108,7 +109,7 @@ termio(int fd, int sock, FILE *auxfi)
 
        if (c == 13)
            c = 10;
-       n = 1;
+       records = 1;
        p[0] = c;
        p[1] = '\0';
        if (c != 10) {
@@ -121,11 +122,11 @@ termio(int fd, int sock, FILE *auxfi)
        } else
            putchar(c);
 /* Strip off the CRLF to just LF */
-       if (n > 1) {
-           if (p[n - 2] == 13 && p[n - 1] == 10) {
-               p[n - 2] = 10;
-               p[n - 1] = 0;
-               n--;
+       if (records > 1) {
+           if (p[records - 2] == 13 && p[records - 1] == 10) {
+               p[records - 2] = 10;
+               p[records - 1] = 0;
+               records--;
            }
        }
        FlushConsoleInputBuffer(hStdIn);
@@ -165,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;
@@ -244,7 +245,7 @@ termio(int fd, int sock, FILE *auxfi)
     return 1;
 }
 
-int
+static int
 sendeof(int sock)
 {
 #ifndef _WIN32