|
Server 0.0.1
HTTP/REST server implementation
|
00001 00023 #include <sys/types.h> 00024 00025 #include <string.h> 00026 00027 #include "cbuf.h" 00028 00029 char * 00030 cbufGetLine(Cbuf this, char ** line_end) 00031 { 00032 char * nl = cbufMemchr(this, '\n'); 00033 char * ret = NULL; 00034 00035 if (NULL != nl) { 00036 size_t len = cbufAddrIndex(this, nl) + 1; 00037 00038 *line_end = nl - 1; 00039 *nl = 0; 00040 *(nl-1) = ('\r' == *(nl-1))? 0 : *(nl-1); 00041 00042 ret = cbufGetRead(this); 00043 cbufIncRead(this, len); 00044 } 00045 00046 return ret; 00047 } 00048 00049 // vim: set ts=4 sw=4: