/*
* 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)
{
if (c == 13)
c = 10;
- n = 1;
+ records = 1;
p[0] = c;
p[1] = '\0';
if (c != 10) {
} 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);
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;
return 1;
}
-int
+static int
sendeof(int sock)
{
#ifndef _WIN32