6 main (int argc, char *argv[])
18 fprintf (stderr, "Syntax: %s PROGRAM\n", argv[0]);
22 if ((ctf = ctf_open (argv[1], NULL, &err)) == NULL)
25 /* Make sure we can look up a_t * by name in all non-parent dicts, even though
26 the a_t * and the type it points to are in distinct dicts; make sure we
27 cannot look up b_t *. */
29 while ((fp = ctf_archive_next (ctf, &i, &arcname, 1, &err)) != NULL)
31 if ((type = ctf_lookup_by_name (fp, "a_t *")) == CTF_ERR)
34 if ((ctf_lookup_by_name (fp, "b_t *")) != CTF_ERR ||
35 ctf_errno (fp) != ECTF_NOTYPE)
38 if (ctf_type_reference (fp, type) == CTF_ERR)
41 printf ("%s: a_t * points to a type of kind %i\n", arcname,
42 ctf_type_kind (fp, ctf_type_reference (fp, type)));
46 if (err != ECTF_NEXT_END)
54 fprintf (stderr, "%s: cannot open: %s\n", argv[0], ctf_errmsg (err));
57 fprintf (stderr, "Lookup failed in %s: %s\n", arcname, ctf_errmsg (ctf_errno (fp)));
60 fprintf (stderr, "Lookup unexpectedly succeeded in %s\n", arcname);