Index: tester.c =================================================================== --- tester.c (revision 35426) +++ tester.c (revision 35427) @@ -1,3 +1,4 @@ +#include #include "ucdf.h" static void print_dir(ucdf_ctx_t *ctx, ucdf_direntry_t *dir, int level) @@ -11,6 +12,27 @@ print_dir(ctx, d, level+1); } +/* return the direntry for /name/Data */ +static ucdf_direntry_t *de_find(ucdf_ctx_t *ctx, const char *name) +{ + ucdf_direntry_t *d, *n; + for(d = ctx->root->children; d != NULL; d = d->next) { + if (strcmp(d->name, name) == 0) { + for(n = d->children; n != NULL; n = n->next) + if (strcmp(n->name, "Data") == 0) + return n; + return NULL; + } + } + + return NULL; +} + +static void dump_file(ucdf_ctx_t *ctx, ucdf_direntry_t *d) +{ + +} + int main(int argc, char *argv[]) { char *fn = "A.PcbDoc"; @@ -30,6 +52,14 @@ print_dir(&ctx, ctx.root, 0); + printf("--NETS:\n"); + { + ucdf_direntry_t *de = de_find(&ctx, "Nets6"); + print_dir(&ctx, de, 0); + printf("==\n"); + dump_file(&ctx, de); + } + ucdf_close(&ctx); return 0; }