+
+/*
+ * client_getln() ... Get a LF-terminated line of text from the client.
+ * (This is implemented in terms of client_read() and could be
+ * justifiably moved out of sysdep.c)
+ */
+int sock_getln_err(int *sock, char *buf, int bufsize, int *rc)
+{
+ int i, retval;
+ CitContext *CCC = MyContext();
+ const char *pCh;
+
+ FlushStrBuf(CCC->sMigrateBuf);
+ *rc = retval = CtdlSockGetLine(sock, CCC->sMigrateBuf);
+
+ i = StrLength(CCC->sMigrateBuf);
+ pCh = ChrPtr(CCC->sMigrateBuf);
+
+ memcpy(buf, pCh, i + 1);
+
+ FlushStrBuf(CCC->sMigrateBuf);
+ if (retval < 0) {
+ safestrncpy(&buf[i], "000", bufsize - i);
+ i += 3;
+ }
+ return i;
+}
+