/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2007, 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
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <sys/socket.h>
#include <sys/types.h>
-#if !defined(_WIN32)
#include <sys/uio.h>
-#include <sys/file.h>
-#endif
-#include <sys/socket.h>
#include <unistd.h>
-#include <time.h>
-
#include "empio.h"
+#include "empthread.h"
#include "ioqueue.h"
#include "misc.h"
#include "queue.h"
#include "server.h"
-#include "empthread.h"
-
struct iop {
int fd;
struct ioqueue *input;
int
io_output(struct iop *iop, int waitforoutput)
{
-#if !defined(_WIN32)
struct iovec iov[16];
-#else
- char buf[IO_BUFSIZE];
-#endif
int cc;
int n;
int remain;
if (iop->flags & IO_ERROR)
return -1;
-#if !defined(_WIN32)
/* make the iov point to the data in the queue. */
/* I.E., each of the elements in the queue. */
/* returns the number of elements in the iov. */
n = ioq_makeiov(iop->output, iov, IO_BUFSIZE);
-#else
- /* Make a buffer containing the output to write. */
- n = ioq_makebuf(iop->output, buf, sizeof(buf));
-#endif
if (n <= 0) {
return 0;
}
/* Do the actual write. */
-#if !defined(_WIN32)
cc = writev(iop->fd, iov, n);
-#else
- cc = write(iop->fd, buf, n);
-#endif
/* if it failed.... */
if (cc < 0) {