ref: 02fc81c3d68b45a6901de9032e61cb91f33b033c
dir: /main.c/
#include <u.h> #include <libc.h> #include <thread.h> #include <bio.h> #include <flate.h> #include "pdf.h" int mainstacksize = 32768; static void usage(void) { fprint(2, "usage: %s FILE\n", argv0); threadexitsall("usage"); } void threadmain(int argc, char **argv) { Pdf *pdf; Biobuf *b; Object *v; quotefmtinstall(); inflateinit(); ARGBEGIN{ default: usage(); }ARGEND #ifdef TEST #define T(x) \ void x(void); \ x(); if(argc != 1){ T(test_pdfstring); T(test_pdfname); threadexitsall(nil); } #endif if(argc != 1) usage(); if((b = Bopen(argv[0], OREAD)) == nil) sysfatal("%r"); if((pdf = pdfopen(b)) == nil) sysfatal("%s: %r", argv[0]); if((v = dictget(pdf->info, "Creator")) != nil) fprint(2, "creator: %s\n", v->str); if((v = dictget(pdf->info, "Producer")) != nil) fprint(2, "producer: %s\n", v->str); pdfclose(pdf); threadexitsall(nil); }