summaryrefslogtreecommitdiffstats
path: root/tests/.svn/text-base/killnast.c.svn-base
blob: 7c06dee0e3e8f9954008b05100d6f90d86e2efb0 (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
#include <nastd.h>

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

int
main(int argc, char *argv[])
{
	nasth *nasthole;
	nast_array *aa;
	int i, rc;

	if (argc != 1) {
		printf("Usage: %s\n", argv[0]);
		return 1;
	}

	nasthole = nast_sphincter_new(NULL);
	if (nasthole == NULL) {
		fprintf(stderr, "ERROR: Couldn't connect to nasthole.\n");
		return 2;
	}

	rc = nast_stats(nasthole);
	if (rc == -1) {
		fprintf(stderr, "ERROR: Couldn't get stats: %s.\n",
			nast_errmsg(nasthole));
		nast_sphincter_close(nasthole);
		return 2;
	}

	aa = nast_get_result(nasthole);
	for (i = 0; i < aa->nitems; i++)
		printf("%s\n", aa->items[i]->strdata);
	nast_free_result(aa);

	nast_sphincter_close(nasthole);
	return 0;
}