1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 #include "prof_int.h"
3
4 #include <stdio.h>
5 #include <string.h>
6 #ifdef HAVE_STDLIB_H
7 #include <stdlib.h>
8 #endif
9 #include <errno.h>
10 #include <ctype.h>
11
12 void dump_profile (struct profile_node *root, int level);
13
14 int
main(int argc,char ** argv)15 main(int argc, char **argv)
16 {
17 struct profile_node *root;
18 unsigned long retval;
19 FILE *f;
20
21 initialize_prof_error_table();
22 if (argc != 2) {
23 fprintf(stderr, "%s: Usage <filename>\n", argv[0]);
24 exit(1);
25 }
26
27 f = fopen(argv[1], "r");
28 if (!f) {
29 perror(argv[1]);
30 exit(1);
31 }
32
33 retval = profile_parse_file(f, &root, NULL);
34 if (retval) {
35 printf("profile_parse_file error %s\n",
36 error_message((errcode_t) retval));
37 exit(1);
38 }
39 fclose(f);
40
41 printf("\n\nDebugging dump.\n");
42 profile_write_tree_file(root, stdout);
43
44 retval = profile_verify_node(root);
45 if (retval) {
46 printf("profile_verify_node reported an error: %s\n",
47 error_message((errcode_t) retval));
48 exit(1);
49 }
50
51 profile_free_node(root);
52
53 return 0;
54 }
55