* All OS-level includes are now included from webcit.h instead of from
[citadel.git] / webcit / tcp_sockets.c
index 240e8e4c70f9d1fc5ff15c0043f66524e49ccde0..2b613712afb30f9db771d61a42569ec59e9b1a54 100644 (file)
@@ -7,34 +7,12 @@
 
 /*
  * Uncomment this to log all communications with the Citadel server
- */
 #define SERV_TRACE 1
+ */
 
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/un.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
 #include "webcit.h"
 #include "webserver.h"
 
-
 #ifndef INADDR_NONE
 #define INADDR_NONE 0xffffffff
 #endif
@@ -163,18 +141,18 @@ void serv_read(char *buf, int bytes)
 /*
  * input string from pipe
  */
-void serv_gets(char *strbuf)
+void serv_getln(char *strbuf, int bufsize)
 {
        int ch, len;
        char buf[2];
 
        len = 0;
-       strcpy(strbuf, "");
+       strbuf[0] = 0;
        do {
                serv_read(&buf[0], 1);
                ch = buf[0];
                strbuf[len++] = ch;
-       } while ((ch != 10) && (ch != 0) && (len < (SIZ-1)));
+       } while ((ch != 10) && (ch != 0) && (len < (bufsize-1)));
        if (strbuf[len-1] == 10) strbuf[--len] = 0;
        if (strbuf[len-1] == 13) strbuf[--len] = 0;
 #ifdef SERV_TRACE