6 main (int argc, char *argv[])
17 fprintf (stderr, "Syntax: %s PROGRAM\n", argv[0]);
21 if ((ctf = ctf_open (argv[1], NULL, &err)) == NULL)
24 /* Make sure we can look up a_t * by name in all non-parent dicts, even though
25 the a_t * and the type it points to are in distinct dicts; make sure we
26 cannot look up b_t *. */
28 while ((fp = ctf_archive_next (ctf, &i, &arcname, 1, &err)) != NULL)
30 if ((type = ctf_lookup_by_name (fp, "a_t *")) == CTF_ERR)
33 if ((ctf_lookup_by_name (fp, "b_t *")) != CTF_ERR ||
34 ctf_errno (fp) != ECTF_NOTYPE)
37 if (ctf_type_reference (fp, type) == CTF_ERR)
40 printf ("%s: a_t * points to a type of kind %i\n", arcname,
41 ctf_type_kind (fp, ctf_type_reference (fp, type)));
45 if (err != ECTF_NEXT_END)
53 fprintf (stderr, "%s: cannot open: %s\n", argv[0], ctf_errmsg (err));
56 fprintf (stderr, "Lookup failed in %s: %s\n", arcname, ctf_errmsg (ctf_errno (fp)));
59 fprintf (stderr, "Lookup unexpectedly succeeded in %s\n", arcname);