All pastes #959537 Raw Edit

alesan

public c v1 · immutable
#959537 ·published 2008-03-27 14:51 UTC
rendered paste body
#include <stdio.h>#include <string.h>#include <uci/uci.h>int main(){        struct uci_context *ctx;        struct uci_package *p = NULL;        struct uci_element *e = NULL;        char *package = NULL;        char* section = NULL;        char* option = NULL;        char* value = NULL;        char** ptr = NULL;        char comando[64];        ctx = uci_alloc_context();        if(!ctx)                return 1;        strncpy(comando, "programmino.A.zoom", 64);        if(uci_parse_tuple(ctx, comando, &package, &section, &option, ptr) != UCI_OK)                return 1;        if(uci_load(ctx, package, &p) != UCI_OK)                return 1;        if(uci_lookup(ctx, &e, p, section, option) != UCI_OK)                return 1;        value = uci_to_option(e)->value;        printf("%s\n", value);        uci_free_context(ctx);        return 0;}