FreeBSD/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
/*
 * Display a single line of output, according to the settings in the callback
 * structure.
 */
Display a single line of output, according to the settings in the callback
structure.
Display a single line of output according to the settings in the callback structure .
void
zprop_print_one_property(const char *name, zprop_get_cbdata_t *cbp,
    const char *propname, const char *value, zprop_source_t sourcetype,
    const char *source, const char *recvd_value)
{
	int i;
	const char *str;
	char buf[128];
	if ((sourcetype & cbp->cb_sources) == 0)
		return;
	if (cbp->cb_first)
		zprop_print_headers(cbp, cbp->cb_type);
	for (i = 0; i < ZFS_GET_NCOLS; i++) {
		switch (cbp->cb_columns[i]) {
		case GET_COL_NAME:
			str = name;
			break;
		case GET_COL_PROPERTY:
			str = propname;
			break;
		case GET_COL_VALUE:
			str = value;
			break;
		case GET_COL_SOURCE:
			switch (sourcetype) {
			case ZPROP_SRC_NONE:
				str = "-";
				break;
			case ZPROP_SRC_DEFAULT:
				str = "default";
				break;
			case ZPROP_SRC_LOCAL:
				str = "local";
				break;
			case ZPROP_SRC_TEMPORARY:
				str = "temporary";
				break;
			case ZPROP_SRC_INHERITED:
				(void) snprintf(buf, sizeof (buf),
				    "inherited from %s", source);
				str = buf;
				break;
			case ZPROP_SRC_RECEIVED:
				str = "received";
				break;
			}
			break;
		case GET_COL_RECVD:
			str = (recvd_value == NULL ? "-" : recvd_value);
			break;
		default:
			continue;
		}
		if (cbp->cb_columns[i + 1] == GET_COL_NONE)
			(void) printf("%s", str);
		else if (cbp->cb_scripted)
			(void) printf("%s\t", str);
		else
			(void) printf("%-*s  ",
			    cbp->cb_colwidths[cbp->cb_columns[i]],
			    str);
	}
	(void) printf("\n");
}
void zprop_print_one_property ( const char * name , zprop_get_cbdata_t * cbp , const char * propname , const char * value , zprop_source_t sourcetype , const char * source , const char * recvd_value ) { int i ; const char * str ; char buf [ 128 ] ; if ( ( sourcetype & cbp -> cb_sources ) == 0 ) return ; if ( cbp -> cb_first ) zprop_print_headers ( cbp , cbp -> cb_type ) ; for ( i = 0 ; i < ZFS_GET_NCOLS ; i ++ ) { switch ( cbp -> cb_columns [ i ] ) { case GET_COL_NAME : str = name ; break ; case GET_COL_PROPERTY : str = propname ; break ; case GET_COL_VALUE : str = value ; break ; case GET_COL_SOURCE : switch ( sourcetype ) { case ZPROP_SRC_NONE : str = " " ; break ; case ZPROP_SRC_DEFAULT : str = " " ; break ; case ZPROP_SRC_LOCAL : str = " " ; break ; case ZPROP_SRC_TEMPORARY : str = " " ; break ; case ZPROP_SRC_INHERITED : ( void ) snprintf ( buf , sizeof ( buf ) , " " , source ) ; str = buf ; break ; case ZPROP_SRC_RECEIVED : str = " " ; break ; } break ; case GET_COL_RECVD : str = ( recvd_value == NULL ? " " : recvd_value ) ; break ; default : continue ; } if ( cbp -> cb_columns [ i + 1 ] == GET_COL_NONE ) ( void ) printf ( " " , str ) ; else if ( cbp -> cb_scripted ) ( void ) printf ( " \t " , str ) ; else ( void ) printf ( " " , cbp -> cb_colwidths [ cbp -> cb_columns [ i ] ] , str ) ; } ( void ) printf ( " \n " ) ; }
Display a single line of output, according to the settings in the callback
 structure.
Display a single line of output according to the settings in the callback structure .
/*
	 * Ignore those source types that the user has chosen to ignore.
	 */