FreeBSD/contrib/openbsm/libbsm/bsm_control.c
/*
 * Convert a given disk space value with a multiplier (bytes, kilobytes,
 * megabytes, gigabytes) to bytes.  Return 0 on success.
 */
Convert a given disk space value with a multiplier (bytes, kilobytes,
megabytes, gigabytes) to bytes.  Return 0 on success.
Convert a given disk space value with a multiplier ( bytes kilobytes megabytes gigabytes ) to bytes . Return 0 on success .
static int
au_spacetobytes(size_t *bytes, u_long value, char mult)
{
	if (NULL == bytes)
		return (-1);
	switch(mult) {
	case 'B':
	case ' ':
		*bytes = (size_t)value;
		break;
	case 'K':
		*bytes = (size_t)value * 1024;
		break;
	case 'M':
		*bytes = (size_t)value * 1024 * 1024;
		break;
	case 'G':
		*bytes = (size_t)value * 1024 * 1024 * 1024;
		break;
	default:
		return (-1);
	}
	return (0);
}
static int au_spacetobytes ( size_t * bytes , u_long value , char mult ) { if ( NULL == bytes ) return ( -1 ) ; switch ( mult ) { case ' ' : case ' ' : * bytes = ( size_t ) value ; break ; case ' ' : * bytes = ( size_t ) value * 1024 ; break ; case ' ' : * bytes = ( size_t ) value * 1024 * 1024 ; break ; case ' ' : * bytes = ( size_t ) value * 1024 * 1024 * 1024 ; break ; default : return ( -1 ) ; } return ( 0 ) ; }
Convert a given disk space value with a multiplier (bytes, kilobytes,
 megabytes, gigabytes) to bytes.
Convert a given disk space value with a multiplier ( bytes kilobytes megabytes gigabytes ) to bytes .
/* Bytes */ /* Kilobytes */ /* Megabytes */ /* Gigabytes */