|
|
These functions are in OS-dependent code, and are rewritten each time a C client is ported to a new operating system.
void rfc822_date(char *date);
This function is called to get the current date and time in an RFC 822 format string into the given buffer.
void *fs_get(size_t size);
This function allocates and returns a block of free storage of the specified size. Unlike malloc, there is no failure return; this function must return with the requested storage.
void fs_resize(void **block, size_t size);
This function resizes the free storage block, updating the pointer if necessary. Unlike realloc, there is no failure return; this function must return with the requested storage.
void fs_give(void **block);
This function releases a block of free storage allocated by fs_get. It also erases the block pointer, so it is not necessary to do this in the application.
void fatal(char *string);
This function is called when an ``impossible'' error is detected and the client wishes to crash. The string should contain a reason.
char *strcrlfcpy(char **dst, long *dstl, char *src, long srcl);
This function is called to copy into a destination string dst of size dstl (resized if necessary), a CR-LF newline form string from local format string src of size srcl.
TCPSTREAM *tcp_open(char *host, long port);These functions are TCP-specific versions of the more general net_xxx functions. hese should not be called directly by applications.TCPSTREAM *tcp_aopen(char *host, char *service);
char *tcp_getline(TCPSTREAM *stream);
long tcp_getbuffer(TCPSTREAM *stream, long size, char *buffer);
long tcp_soutr(TCPSTREAM *stream, char *string);
void tcp_close(TCPSTREAM *stream);
char *tcp_host(TCPSTREAM *stream);
unsigned long tcp_port(TCPSTREAM *stream);
char *tcp_localhost(TCPSTREAM *stream);
char *tcp_clienthost(char *dst);
This function should be called only by a server called by inetd or similar mechanism which maps standard input to a network socket. It returns the host name of the other end (for example, the client of a server) using the given string buffer, or NIL if it cannot get this information.