int lc_handle_type(lc_var_type_t type, const char *value, void *data);
#include <libconfig.h>
#include <stdlib.h>
#include <stdio.h>
int callback_size(const char *shortvar, const char *var,
                  const char *arguments, const char *value,
                  lc_flags_t flags, void *extra) {
        size_t size;
        int lc_ht_ret;
        if (value == NULL) {
                lc_seterrstr("You must specify an argument to \
                              Size.");
                return(LC_CBRET_ERROR);
        }
        lc_ht_ret = lc_handle_type(LC_VAR_SIZE_SIZE_T, value, &size);
        if (lc_ht_ret != 0) {
                lc_seterrstr("Invalid size specified.");
                return(LC_CBRET_ERROR);
        }
        printf("Size: %lu\n", (unsigned long) size);
        return(LC_CBRET_OKAY);
}
int main(int argc, char **argv) {
        int lc_rc_ret, lc_p_ret;
        lc_rc_ret = lc_register_callback("Size", 0, LC_VAR_SIZE_SIZE_T,
                                         callback_size, NULL);
        if (lc_rc_ret != 0) {
                fprintf(stderr, "Error registering callback.\n");
                return(EXIT_FAILURE);
        }
        lc_p_ret = lc_process(argc, argv, "example", LC_CONF_APACHE,
                              NULL);
        lc_cleanup();
        if (lc_p_ret != 0) {
                fprintf(stderr, "Error processing configuration: \
                        %s\n", lc_geterrstr());
                return(EXIT_FAILURE);
        }
        return(EXIT_SUCCESS);
}