1 /*
2 $Id: headers.c 2 2007-09-18 17:49:41Z vol $
3 */
4
5 #include <stdio.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
9 #include <eps.h>
10
main(int argc,char * argv[])11 int main(int argc, char *argv[])
12 {
13 int ret = 0, fd = 0;
14 eps_t *eps = NULL;
15 header_t *h = NULL;
16 atom_t *a = NULL;
17
18 fd = 0;
19
20 if (argc > 1) {
21 fd = open(argv[1], O_RDONLY);
22 if (fd == -1)
23 return 1;
24 }
25
26 eps = eps_begin(INTERFACE_STREAM, &fd);
27 if (!eps) {
28 printf("EPS failed to initialize.\n");
29 return 1;
30 }
31
32 for (h = eps_next_header(eps); h; h = eps_next_header(eps)) {
33 if ((h->name) && (h->data)) {
34 printf("%s: (%s) ", h->name, h->orig);
35
36 if (h->atoms) {
37 for (a = h->atoms; a->next; a = a->next) {
38 if (a->next->name)
39 printf("%s = ", a->next->name);
40
41 printf("%s", a->next->data);
42
43 if (a->next->next)
44 printf("; ");
45 }
46 }
47
48 else
49 printf("%s", h->data);
50
51 printf("\n");
52 }
53 }
54
55 eps_end(eps);
56
57 return 0;
58 }
59