src/zectl_get.c
libze_error
ze_get(libze_handle *lzeh, int argc, char **argv) {

    libze_error ret = LIBZE_ERROR_SUCCESS;
    nvlist_t *properties = NULL;
    get_options options = {.tab_delimited = B_FALSE};

    opterr = 0;
    int opt;
    while ((opt = getopt(argc, argv, "H")) != -1) {
        switch (opt) {
            case 'H':
                options.tab_delimited = B_TRUE;
                break;
            default:
                fprintf(stderr, "%s get: unknown option '-%c'\n", ZE_PROGRAM, optopt);
                ze_usage();
                return LIBZE_ERROR_UNKNOWN;
        }
    }

    argc -= optind;
    argv += optind;

    if (argc > 2) {
        fprintf(stderr, "%s: Wrong number of arguments.\n", ZE_PROGRAM);
        return LIBZE_ERROR_UNKNOWN;
    }

    char *prop = argv[0];

    boolean_t dealloc_properties = B_FALSE;
    if ((argc == 0) || (strcmp(prop, "all") == 0)) {
        properties = lzeh->ze_props;
    } else {
        properties = fnvlist_alloc();
        if (properties == NULL) {
            return LIBZE_ERROR_NOMEM;
        }
        dealloc_properties = B_TRUE;
        if ((ret = libze_add_get_property(lzeh, &properties, prop)) != LIBZE_ERROR_SUCCESS) {
            goto err;
        }
    }

    ret = print_properties(lzeh, properties, &options);
err:
    if (dealloc_properties) {
        fnvlist_free(properties);
    }
    return ret;
}
/**
 * get command main function
 * @param lzeh Initialized handle to libze object
 * @param argc As passed to main
 * @param argv As passed to main, contains boot env to create
 * @return LIBZE_ERROR_SUCCESS upon success
 */
get command main function
@param lzeh Initialized handle to libze object
@param argc As passed to main
@param argv As passed to main, contains boot env to create
@return LIBZE_ERROR_SUCCESS upon success
get command main function @param lzeh Initialized handle to libze object @param argc As passed to main @param argv As passed to main contains boot env to create @return LIBZE_ERROR_SUCCESS upon success
libze_error
ze_get(libze_handle *lzeh, int argc, char **argv) {
    libze_error ret = LIBZE_ERROR_SUCCESS;
    nvlist_t *properties = NULL;
    get_options options = {.tab_delimited = B_FALSE};
    opterr = 0;
    int opt;
    while ((opt = getopt(argc, argv, "H")) != -1) {
        switch (opt) {
            case 'H':
                options.tab_delimited = B_TRUE;
                break;
            default:
                fprintf(stderr, "%s get: unknown option '-%c'\n", ZE_PROGRAM, optopt);
                ze_usage();
                return LIBZE_ERROR_UNKNOWN;
        }
    }
    argc -= optind;
    argv += optind;
    if (argc > 2) {
        fprintf(stderr, "%s: Wrong number of arguments.\n", ZE_PROGRAM);
        return LIBZE_ERROR_UNKNOWN;
    }
    char *prop = argv[0];
    boolean_t dealloc_properties = B_FALSE;
    if ((argc == 0) || (strcmp(prop, "all") == 0)) {
        properties = lzeh->ze_props;
    } else {
        properties = fnvlist_alloc();
        if (properties == NULL) {
            return LIBZE_ERROR_NOMEM;
        }
        dealloc_properties = B_TRUE;
        if ((ret = libze_add_get_property(lzeh, &properties, prop)) != LIBZE_ERROR_SUCCESS) {
            goto err;
        }
    }
    ret = print_properties(lzeh, properties, &options);
err:
    if (dealloc_properties) {
        fnvlist_free(properties);
    }
    return ret;
}
libze_error ze_get ( libze_handle * lzeh , int argc , char * * argv ) { libze_error ret = LIBZE_ERROR_SUCCESS ; nvlist_t * properties = NULL ; get_options options = { . tab_delimited = B_FALSE } ; opterr = 0 ; int opt ; while ( ( opt = getopt ( argc , argv , " " ) ) != -1 ) { switch ( opt ) { case ' ' : options . tab_delimited = B_TRUE ; break ; default : fprintf ( stderr , " \n " , ZE_PROGRAM , optopt ) ; ze_usage ( ) ; return LIBZE_ERROR_UNKNOWN ; } } argc -= optind ; argv += optind ; if ( argc > 2 ) { fprintf ( stderr , " \n " , ZE_PROGRAM ) ; return LIBZE_ERROR_UNKNOWN ; } char * prop = argv [ 0 ] ; boolean_t dealloc_properties = B_FALSE ; if ( ( argc == 0 ) || ( strcmp ( prop , " " ) == 0 ) ) { properties = lzeh -> ze_props ; } else { properties = fnvlist_alloc ( ) ; if ( properties == NULL ) { return LIBZE_ERROR_NOMEM ; } dealloc_properties = B_TRUE ; if ( ( ret = libze_add_get_property ( lzeh , & properties , prop ) ) != LIBZE_ERROR_SUCCESS ) { goto err ; } } ret = print_properties ( lzeh , properties , & options ) ; err : if ( dealloc_properties ) { fnvlist_free ( properties ) ; } return ret ; }
get command main function
 @param lzeh Initialized handle to libze object
 @param argc As passed to main
 @param argv As passed to main, contains boot env to create
 @return LIBZE_ERROR_SUCCESS upon success
get command main function @param lzeh Initialized handle to libze object @param argc As passed to main @param argv As passed to main contains boot env to create @return LIBZE_ERROR_SUCCESS upon success