tcp_wsk.c   tcp_wsk.c 
/* ========================================================================
* Copyright 1988-2006 University of Washington
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* ========================================================================
*/
/* /*
* Program: Winsock TCP/IP routines * Program: Winsock TCP/IP routines
* *
* Author: Mark Crispin from Mike Seibel's Winsock code * Author: Mark Crispin from Mike Seibel's Winsock code
* Networks and Distributed Computing * Networks and Distributed Computing
* Computing & Communications * Computing & Communications
* University of Washington * University of Washington
* Administration Building, AG-44 * Administration Building, AG-44
* Seattle, WA 98195 * Seattle, WA 98195
* Internet: MRC@CAC.Washington.EDU * Internet: MRC@CAC.Washington.EDU
* *
* Date: 11 April 1989 * Date: 11 April 1989
* Last Edited: 3 September 2004 * Last Edited: 30 August 2006
*
* The IMAP toolkit provided in this Distribution is
* Copyright 2004 University of Washington.
* The full text of our legal notices is contained in the file called
* CPYRIGHT, included with this Distribution.
*/ */
#define TCPMAXSEND 32768 #define TCPMAXSEND 32768
/* Private functions */ /* Private functions */
int tcp_socket_open (struct sockaddr_in *sin,char *tmp,char *hst, int tcp_socket_open (struct sockaddr_in *sin,char *tmp,char *hst,
unsigned long port); unsigned long port);
long tcp_abort (SOCKET *sock); long tcp_abort (SOCKET *sock);
char *tcp_name (struct sockaddr_in *sin,long flag); char *tcp_name (struct sockaddr_in *sin,long flag);
skipping to change at line 264 skipping to change at line 272
ret = (char *) fs_get (n--); ret = (char *) fs_get (n--);
memcpy (ret,st,n); /* copy into a free storage string */ memcpy (ret,st,n); /* copy into a free storage string */
ret[n] = '\0'; /* tie off string with null */ ret[n] = '\0'; /* tie off string with null */
return ret; return ret;
} }
n++; /* count another character searched */ n++; /* count another character searched */
c = d; /* remember previous character */ c = d; /* remember previous character */
} }
/* copy partial string from buffer */ /* copy partial string from buffer */
memcpy ((ret = stp = (char *) fs_get (n)),st,n); memcpy ((ret = stp = (char *) fs_get (n)),st,n);
/* get more data from the net */ if (tcp_getdata (stream)) { /* get more data from the net */
if (!tcp_getdata (stream)) fs_give ((void **) &ret);
/* special case of newline broken by buffer */ /* special case of newline broken by buffer */
else if ((c == '\015') && (*stream->iptr == '\012')) { if ((c == '\015') && (*stream->iptr == '\012')) {
stream->iptr++; /* eat the line feed */ stream->iptr++; /* eat the line feed */
stream->ictr--; stream->ictr--;
ret[n - 1] = '\0'; /* tie off string with null */ ret[n - 1] = '\0'; /* tie off string with null */
} }
/* else recurse to get remainder */ /* else recurse to get remainder */
else if (st = tcp_getline (stream)) { else if (st = tcp_getline (stream)) {
ret = (char *) fs_get (n + 1 + (m = strlen (st))); ret = (char *) fs_get (n + 1 + (m = strlen (st)));
memcpy (ret,stp,n); /* copy first part */ memcpy (ret,stp,n); /* copy first part */
memcpy (ret + n,st,m); /* and second part */ memcpy (ret + n,st,m); /* and second part */
fs_give ((void **) &stp); /* flush first part */ fs_give ((void **) &stp); /* flush first part */
fs_give ((void **) &st); /* flush second part */ fs_give ((void **) &st); /* flush second part */
ret[n + m] = '\0'; /* tie off string with null */ ret[n + m] = '\0'; /* tie off string with null */
}
} }
return ret; return ret;
} }
/* TCP/IP receive buffer /* TCP/IP receive buffer
* Accepts: TCP/IP stream * Accepts: TCP/IP stream
* size in bytes * size in bytes
* buffer to read into * buffer to read into
* Returns: T if success, NIL otherwise * Returns: T if success, NIL otherwise
*/ */
 End of changes. 5 change blocks. 
20 lines changed or deleted 28 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/