*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdarg.h>
#include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
*/
for (i = 0;; i++) {
if (sock_read(sock, &buf[i], 1) < 0) return(-1);
- if (buf[i] == '\n' || i == 255)
+ if (buf[i] == '\n' || i == (SIZ-1))
break;
}
/* If we got a long line, discard characters until the newline.
*/
- if (i == 255)
+ if (i == (SIZ-1))
while (buf[i] != '\n')
if (sock_read(sock, &buf[i], 1) < 0) return(-1);
int g;
g = sock_gets(sock, buf);
- if (g < 0) return(g);
- if ( (g < 4) || (buf[3] != '-')) return(g);
+ if (g < 4) return(g);
+ if (buf[3] != '-') return(g);
do {
g = sock_gets(sock, bigbuf);
if (j<0) return(j);
return(i+j);
}
+
+
+/*
+ * sock_puts_crlf() - same as sock_puts() but ends line with CRLF, not LF
+ * Returns the number of bytes written, or -1 for error.
+ */
+int sock_puts_crlf(int sock, char *buf)
+{
+ int i, j;
+
+ i = sock_write(sock, buf, strlen(buf));
+ if (i<0) return(i);
+ j = sock_write(sock, "\r\n", 2);
+ if (j<0) return(j);
+ return(i+j);
+}