/*
* 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)
{
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
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;