]> git.pond.sub.org Git - empserver/blobdiff - src/lib/gen/io.c
Get rid of src/lib/gen/copy.c
[empserver] / src / lib / gen / io.c
index 61c21d91d2df36ba9a0d616171e6855e197e534e..4c42a55efedb0c6137dff4b4709cc8b53823f75b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  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;
@@ -166,11 +160,7 @@ io_outputwaiting(struct iop *iop)
 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;
@@ -187,15 +177,10 @@ io_output(struct iop *iop, int waitforoutput)
     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;
@@ -209,11 +194,7 @@ io_output(struct iop *iop, int waitforoutput)
     }
 
     /* 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) {