summaryrefslogtreecommitdiffstats
path: root/src/util/profile/test_profile.c
blob: 83768f30a6a09c3014ce3a47d83dffb2476a8992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * test_profile.c --- testing program for the profile routine
 */

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

#include "profile.h"
#include "com_err.h"

int main(argc, argv)
    int		argc;
    char	**argv;
{
    profile_t	profile;
    long	retval;
    const char	*filenames[2];
    char	**values, **cpp;
    
    filenames[0] = argv[1];
    filenames[1] = 0;

    initialize_prof_error_table();
    
    retval = profile_init(filenames, &profile);
    if (retval) {
	com_err(argv[0], retval, "while initializing profile");
	exit(1);
    }
    retval = profile_get_values(profile, argv+2, &values);
    if (retval) {
	com_err(argv[0], retval, "while getting values");
	exit(1);
    }
    for (cpp = values; *cpp; cpp++) {
	printf("%s\n", *cpp);
	free(*cpp);
    }
    free(values);
    profile_release(profile);
    exit(0);
}