usr/src/cmd/zpool/zpool_main.c
/*
 * Given a list of columns to display, output appropriate headers for each one.
 */
Given a list of columns to display, output appropriate headers for each one.
Given a list of columns to display output appropriate headers for each one .
static void
print_header(list_cbdata_t *cb)
{
	zprop_list_t *pl = cb->cb_proplist;
	char headerbuf[ZPOOL_MAXPROPLEN];
	const char *header;
	boolean_t first = B_TRUE;
	boolean_t right_justify;
	size_t width = 0;
	for (; pl != NULL; pl = pl->pl_next) {
		width = pl->pl_width;
		if (first && cb->cb_verbose) {
			width = cb->cb_namewidth;
		}
		if (!first)
			(void) printf("  ");
		else
			first = B_FALSE;
		right_justify = B_FALSE;
		if (pl->pl_prop != ZPROP_INVAL) {
			header = zpool_prop_column_name(pl->pl_prop);
			right_justify = zpool_prop_align_right(pl->pl_prop);
		} else {
			int i;
			for (i = 0; pl->pl_user_prop[i] != '\0'; i++)
				headerbuf[i] = toupper(pl->pl_user_prop[i]);
			headerbuf[i] = '\0';
			header = headerbuf;
		}
		if (pl->pl_next == NULL && !right_justify)
			(void) printf("%s", header);
		else if (right_justify)
			(void) printf("%*s", width, header);
		else
			(void) printf("%-*s", width, header);
	}
	(void) printf("\n");
}
static void print_header ( list_cbdata_t * cb ) { zprop_list_t * pl = cb -> cb_proplist ; char headerbuf [ ZPOOL_MAXPROPLEN ] ; const char * header ; boolean_t first = B_TRUE ; boolean_t right_justify ; size_t width = 0 ; for ( ; pl != NULL ; pl = pl -> pl_next ) { width = pl -> pl_width ; if ( first && cb -> cb_verbose ) { width = cb -> cb_namewidth ; } if ( ! first ) ( void ) printf ( " " ) ; else first = B_FALSE ; right_justify = B_FALSE ; if ( pl -> pl_prop != ZPROP_INVAL ) { header = zpool_prop_column_name ( pl -> pl_prop ) ; right_justify = zpool_prop_align_right ( pl -> pl_prop ) ; } else { int i ; for ( i = 0 ; pl -> pl_user_prop [ i ] != ' \0 ' ; i ++ ) headerbuf [ i ] = toupper ( pl -> pl_user_prop [ i ] ) ; headerbuf [ i ] = ' \0 ' ; header = headerbuf ; } if ( pl -> pl_next == NULL && ! right_justify ) ( void ) printf ( " " , header ) ; else if ( right_justify ) ( void ) printf ( " " , width , header ) ; else ( void ) printf ( " " , width , header ) ; } ( void ) printf ( " \n " ) ; }
Given a list of columns to display, output appropriate headers for each one.
Given a list of columns to display output appropriate headers for each one .
/*
			 * Reset the width to accommodate the verbose listing
			 * of devices.
			 */