From xemacs-m  Wed Mar  5 16:29:50 1997
Received: from corona.pixar.com (corona.pixar.com [138.72.20.84])
	by xemacs.org (8.8.5/8.8.5) with SMTP id QAA14942
	for <xemacs-beta@xemacs.org>; Wed, 5 Mar 1997 16:29:49 -0600 (CST)
Received: by corona.pixar.com (Smail3.1.29.1 #2)
	id m0w2PAG-00016WC; Wed, 5 Mar 97 14:28 PST
Sender: retnuh@pixar.com (Hunter Kelly)
Sender: retnuh@corona
To: xemacs-beta@xemacs.org
Subject: gnuattach think-o
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Mar__5_14:28:00_1997-1"
Content-Transfer-Encoding: 7bit
From: Hunter Kelly <retnuh@corona.pixar.com>
Date: 05 Mar 1997 14:28:00 -0800
Message-ID: <yvtu3mqq8i7.fsf@corona.pixar.com>
Lines: 56
X-Mailer: Gnus v5.4.17/XEmacs 19.15

--Multipart_Wed_Mar__5_14:28:00_1997-1
Content-Type: text/plain; charset=US-ASCII

I forgot a test in my previous patch.

Apply this instead.

I can supply people with a patch to go on top of the previous one, if
that is preferred.  It is just a one line change.

(Thanks to David Moore for pointing this out!)

Hunter


--Multipart_Wed_Mar__5_14:28:00_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="gpatch3"
Content-Transfer-Encoding: 8bit

--- gnuslib.c	Wed Mar  5 14:23:20 1997
+++ gnuslib.c.patch1	Wed Mar  5 10:17:58 1997
@@ -226,17 +226,22 @@
      char *dest;
 {
   char *index = NULL;
-  int length;
-  int offset=0;
+  int length = 0;
+  int difference;
   char buffer[GSERV_BUFSZ+1];
 
-  while ((length=read(s,buffer+offset,1)>0) && buffer[offset]!='\n'
-	 && buffer[offset] != EOT_CHR) {
-    offset += length;
-    if (offset >= GSERV_BUFSZ) 
-      break;
-  }
-  buffer[offset] = '\0';
+  do {
+    if ((length = recv(s,buffer,GSERV_BUFSZ, MSG_PEEK)) > 0)
+      buffer[length] = '\0';
+    else
+      return 0;
+  } while ((index = strchr(buffer, '\n')) == NULL);
+
+  difference = (int)(index - buffer);
+  length = read(s,buffer,difference);
+  if (length == 0)
+    return 0;
+  buffer[length] = '\0';
   strcpy(dest,buffer);
   return 1;
 } /* read_line */

--Multipart_Wed_Mar__5_14:28:00_1997-1--

