void printRecord(TNF_LeafNode* leaf, int indent) { TNF_RecordAddrMap* map; size_t i; for (i = 0; i < leaf->cursor; i++) { INDENT_TO(indent); map = *(TNF_RecordAddrMap**)leafdata(leaf, i); fprintf(stderr, "[%lu]: %lu\n", map->id, map->addr); } }
void zt_opts_usage(char *argv[], struct zt_opt_args *opts, char *option_string, int max_opts, int show_defaults) { int i = 0; fprintf(stderr, "usage: %s %s" NL, basename(argv[0]), option_string); if (max_opts > 0) { fprintf(stderr, NL "Options:" NL); } for (i = 0; i < max_opts; i++) { int offt = 0; if (opts[i].description != NULL) { if (isoptchar(opts[i].opt)) { offt = fprintf(stderr, BLANK "-%c", INDENT(1), opts[i].opt); } #ifdef HAVE_GETOPT_LONG if (opts[i].long_opt) { if (isoptchar(opts[i].opt)) { offt += fprintf(stderr, ", --%s", opts[i].long_opt); } else { offt += fprintf(stderr, BLANK " --%s", INDENT(1), opts[i].long_opt); } } #endif /* ifdef HAVE_GETOPT_LONG */ offt += fprintf(stderr, BLANK "%s", INDENT_TO(30, 5, offt), opts[i].description ? opts[i].description : ""); if (show_defaults) { print_default(opts[i].type, opts[i].val); } if (opts[i].usage) { fprintf(stderr, BLANK ": %s" NL, INDENT(1), opts[i].usage); } else if (zt_opts_usage_t[opts[i].type].desc) { if (isoptchar(opts[i].opt)) { fprintf(stderr, BLANK ": eg. -%c %s" NL, INDENT(1), opts[i].opt, zt_opts_usage_t[opts[i].type].desc ? zt_opts_usage_t[opts[i].type].desc : ""); } else { fprintf(stderr, BLANK ": eg. --%s %s" NL, INDENT(1), opts[i].long_opt, zt_opts_usage_t[opts[i].type].desc ? zt_opts_usage_t[opts[i].type].desc : ""); } } else { fprintf(stderr, NL); } } } } /* zt_opts_usage */