FreeBSD/usr.sbin/uhsoctl/uhsoctl.c
/* Read a \n-terminated line from buffer */
Read a \n-terminated line from buffer
Read a \ n - terminated line from buffer
static int
readline_buf(const char *s, const char *e, char *buf, size_t bufsz)
{
	int pos = 0;
	char *p = buf;
	for (; s < e; s++) {
		*p = *s;
		pos++;
		if (pos >= (bufsz - 1))
			break;
		if (*p++ == '\n')
			break;
	}
	*p = '\0';
	return (pos);
}
static int readline_buf ( const char * s , const char * e , char * buf , size_t bufsz ) { int pos = 0 ; char * p = buf ; for ( ; s < e ; s ++ ) { * p = * s ; pos ++ ; if ( pos >= ( bufsz - 1 ) ) break ; if ( * p ++ == ' \n ' ) break ; } * p = ' \0 ' ; return ( pos ) ; }
Read a \n-terminated line from buffer
Read a \ n - terminated line from buffer