]> Pileus Git - ~andy/fetchmail/blob - socket.h
Yes! True stdio buffering at last!.
[~andy/fetchmail] / socket.h
1 /*
2  * socket.h -- declarations for socket library functions
3  *
4  * Design and implementation by Carl Harris <ceharris@mal.com>
5  *
6  * For license terms, see the file COPYING in this directory.
7  */
8
9 #ifndef SOCKET__
10 #define SOCKET__
11
12 /*
13 Create a new client socket 
14 returns (FILE *)NULL on error 
15 */
16 FILE *Socket(char *host, int clientPort);
17
18 /* 
19 Get a string terminated by an '\n', delete any '\r' and the '\n'.
20 Pass it a valid socket, a buffer for the string, and
21 the length of the buffer (including the trailing \0)
22 returns 0 for success. 
23 */
24 int SockGets(char *buf, int len, FILE *sockfp);
25
26 /* Ship a character array to the socket */
27 #define SockWrite(buf, len, sockfp)     fwrite(buf, 1, len, sockfp)
28
29 /* 
30 Send formatted output to the socket, followed
31 by a CR-LF.  Returns 0 for success.
32 */
33 #define SockPrintf      fprintf
34
35 #endif /* SOCKET__ */