]> git.pond.sub.org Git - empserver/blobdiff - src/client/serverio.c
Indented with src/scripts/indent-emp.
[empserver] / src / client / serverio.c
index 919950e24178a05e3abbb1b8ae07b2d9ad6f6196..e08e183b2f4b2cf0452d4d030392abd57a2e190b 100644 (file)
@@ -51,42 +51,41 @@ void ioq_write();
 
 int
 serverio(s, ioq)
-       int     s;
-       struct  ioqueue *ioq;
+int s;
+struct ioqueue *ioq;
 {
 #ifndef _WIN32
-       extern  s_char *realloc();
+    extern s_char *realloc();
 #else
-       extern void *realloc();
+    extern void *realloc();
 #endif
-       s_char  *buf;
-       int     n;
+    s_char *buf;
+    int n;
 
-       if ((buf = malloc(ioq->bsize)) == 0) {
-               fprintf(stderr, "malloc server i/o failed\n");
-               return 0;
-       }
+    if ((buf = malloc(ioq->bsize)) == 0) {
+       fprintf(stderr, "malloc server i/o failed\n");
+       return 0;
+    }
 #ifdef _WIN32
-       n = recv(s, buf, ioq->bsize, 0);
+    n = recv(s, buf, ioq->bsize, 0);
 #else
-       n = read(s, buf, ioq->bsize);
+    n = read(s, buf, ioq->bsize);
 #endif
-       if (n < 0) {
+    if (n < 0) {
 #ifdef _WIN32
-               errno = WSAGetLastError();
+       errno = WSAGetLastError();
 #endif
-               perror("server i/o read");
-               free(buf);
-               return 0;
-       }
-       if (n == 0) {
-               fprintf(stderr, "Server EOF\n");
-               (void) close(s);
-               return 0;
-       }
-       if (n != ioq->bsize)
-               buf = (s_char *)realloc(buf, n);
-       ioq_write(ioq, buf, n);
-       return 1;
+       perror("server i/o read");
+       free(buf);
+       return 0;
+    }
+    if (n == 0) {
+       fprintf(stderr, "Server EOF\n");
+       (void)close(s);
+       return 0;
+    }
+    if (n != ioq->bsize)
+       buf = (s_char *)realloc(buf, n);
+    ioq_write(ioq, buf, n);
+    return 1;
 }
-