#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <eps.h>
int main(int argc, char *argv[])
{
int ret = 0, fd = 0;
eps_t *eps = NULL;
header_t *h = NULL;
atom_t *a = NULL;
fd = 0;
if (argc > 1) {
fd = open(argv[1], O_RDONLY);
if (fd == -1)
return 1;
}
eps = eps_begin(INTERFACE_STREAM, &fd);
if (!eps) {
printf("EPS failed to initialize.\n");
return 1;
}
for (h = eps_next_header(eps); h; h = eps_next_header(eps)) {
if ((h->name) && (h->data)) {
printf("%s: (%s) ", h->name, h->orig);
if (h->atoms) {
for (a = h->atoms; a->next; a = a->next) {
if (a->next->name)
printf("%s = ", a->next->name);
printf("%s", a->next->data);
if (a->next->next)
printf("; ");
}
}
else
printf("%s", h->data);
printf("\n");
}
}
eps_end(eps);
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1