/*
* 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
/*
* 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