Path: blob/main/crypto/krb5/src/util/profile/test_parse.c
34879 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1#include "prof_int.h"23#include <stdio.h>4#include <string.h>5#ifdef HAVE_STDLIB_H6#include <stdlib.h>7#endif8#include <errno.h>9#include <ctype.h>1011void dump_profile (struct profile_node *root, int level);1213int14main(int argc, char **argv)15{16struct profile_node *root;17unsigned long retval;18FILE *f;1920initialize_prof_error_table();21if (argc != 2) {22fprintf(stderr, "%s: Usage <filename>\n", argv[0]);23exit(1);24}2526f = fopen(argv[1], "r");27if (!f) {28perror(argv[1]);29exit(1);30}3132retval = profile_parse_file(f, &root, NULL);33if (retval) {34printf("profile_parse_file error %s\n",35error_message((errcode_t) retval));36exit(1);37}38fclose(f);3940printf("\n\nDebugging dump.\n");41profile_write_tree_file(root, stdout);4243retval = profile_verify_node(root);44if (retval) {45printf("profile_verify_node reported an error: %s\n",46error_message((errcode_t) retval));47exit(1);48}4950profile_free_node(root);5152return 0;53}545556