FreeBSD/contrib/openbsm/libbsm/bsm_control.c
/*
 * Convert a policy to a string.  Return -1 on failure, or >= 0 representing
 * the actual size of the string placed in the buffer (excluding terminating
 * nul).
 */
Convert a policy to a string.  Return -1 on failure, or >= 0 representing
the actual size of the string placed in the buffer (excluding terminating
nul).
Convert a policy to a string . Return - 1 on failure or > = 0 representing the actual size of the string placed in the buffer ( excluding terminating nul ) .
ssize_t
au_poltostr(int policy, size_t maxsize, char *buf)
{
	int first = 1;
	int i = 0;
	if (maxsize < 1)
		return (-1);
	buf[0] = '\0';
	do {
		if (policy & au_polstr[i].ap_policy) {
			if (!first && strlcat(buf, ",", maxsize) >= maxsize)
				return (-1);
			if (strlcat(buf, au_polstr[i].ap_str, maxsize) >=
			    maxsize)
				return (-1);
			first = 0;
		}
	} while (NULL != au_polstr[++i].ap_str);
	return (strlen(buf));
}
ssize_t au_poltostr ( int policy , size_t maxsize , char * buf ) { int first = 1 ; int i = 0 ; if ( maxsize < 1 ) return ( -1 ) ; buf [ 0 ] = ' \0 ' ; do { if ( policy & au_polstr [ i ] . ap_policy ) { if ( ! first && strlcat ( buf , " " , maxsize ) >= maxsize ) return ( -1 ) ; if ( strlcat ( buf , au_polstr [ i ] . ap_str , maxsize ) >= maxsize ) return ( -1 ) ; first = 0 ; } } while ( NULL != au_polstr [ ++ i ] . ap_str ) ; return ( strlen ( buf ) ) ; }
Convert a policy to a string.
Convert a policy to a string .