FreeBSD/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
/*
 * Display usage message.  If we're inside a command, display only the usage for
 * that command.  Otherwise, iterate over the entire command table and display
 * a complete usage message.
 */
Display usage message.  If we're inside a command, display only the usage for
that command.  Otherwise, iterate over the entire command table and display
a complete usage message.
Display usage message . If we ' re inside a command display only the usage for that command . Otherwise iterate over the entire command table and display a complete usage message .
void
usage(boolean_t requested)
{
	FILE *fp = requested ? stdout : stderr;
	if (current_command == NULL) {
		int i;
		(void) fprintf(fp, gettext("usage: zpool command args ...\n"));
		(void) fprintf(fp,
		    gettext("where 'command' is one of the following:\n\n"));
		for (i = 0; i < NCOMMAND; i++) {
			if (command_table[i].name == NULL)
				(void) fprintf(fp, "\n");
			else
				(void) fprintf(fp, "%s",
				    get_usage(command_table[i].usage));
		}
	} else {
		(void) fprintf(fp, gettext("usage:\n"));
		(void) fprintf(fp, "%s", get_usage(current_command->usage));
	}
	if (current_command != NULL &&
	    ((strcmp(current_command->name, "set") == 0) ||
	    (strcmp(current_command->name, "get") == 0) ||
	    (strcmp(current_command->name, "list") == 0))) {
		(void) fprintf(fp,
		    gettext("\nthe following properties are supported:\n"));
		(void) fprintf(fp, "\n\t%-15s  %s   %s\n\n",
		    "PROPERTY", "EDIT", "VALUES");
		(void) zprop_iter(print_prop_cb, fp, B_FALSE, B_TRUE,
		    ZFS_TYPE_POOL);
		(void) fprintf(fp, "\t%-15s   ", "feature@...");
		(void) fprintf(fp, "YES   disabled | enabled | active\n");
		(void) fprintf(fp, gettext("\nThe feature@ properties must be "
		    "appended with a feature name.\nSee zpool-features(7).\n"));
	}
	if (getenv("ZFS_ABORT") != NULL) {
		(void) printf("dumping core by request\n");
		abort();
	}
	exit(requested ? 0 : 2);
}
void usage ( boolean_t requested ) { FILE * fp = requested ? stdout : stderr ; if ( current_command == NULL ) { int i ; ( void ) fprintf ( fp , gettext ( " \n " ) ) ; ( void ) fprintf ( fp , gettext ( " \n \n " ) ) ; for ( i = 0 ; i < NCOMMAND ; i ++ ) { if ( command_table [ i ] . name == NULL ) ( void ) fprintf ( fp , " \n " ) ; else ( void ) fprintf ( fp , " " , get_usage ( command_table [ i ] . usage ) ) ; } } else { ( void ) fprintf ( fp , gettext ( " \n " ) ) ; ( void ) fprintf ( fp , " " , get_usage ( current_command -> usage ) ) ; } if ( current_command != NULL && ( ( strcmp ( current_command -> name , " " ) == 0 ) || ( strcmp ( current_command -> name , " " ) == 0 ) || ( strcmp ( current_command -> name , " " ) == 0 ) ) ) { ( void ) fprintf ( fp , gettext ( " \n \n " ) ) ; ( void ) fprintf ( fp , " \n \t \n \n " , " " , " " , " " ) ; ( void ) zprop_iter ( print_prop_cb , fp , B_FALSE , B_TRUE , ZFS_TYPE_POOL ) ; ( void ) fprintf ( fp , " \t " , " " ) ; ( void ) fprintf ( fp , " \n " ) ; ( void ) fprintf ( fp , gettext ( " \n " " \n \n " ) ) ; } if ( getenv ( " " ) != NULL ) { ( void ) printf ( " \n " ) ; abort ( ) ; } exit ( requested ? 0 : 2 ) ; }
Display usage message.
Display usage message .
/* Iterate over all properties */ /*
	 * See comments at end of main().
	 */