ref: 3c27f041321b91dbf2bfd0ab9e4865e03854cd68
dir: /main.c/
#include <u.h> #include <libc.h> #include <thread.h> #include "pdf.h" static void usage(void) { fprint(2, "usage: %s FILE\n", argv0); threadexitsall("usage"); } void threadmain(int argc, char **argv) { int fd; Pdf *pdf; quotefmtinstall(); 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((fd = open(argv[0], OREAD)) < 0) sysfatal("%r"); if((pdf = pdfopen(fd)) == nil) sysfatal("pdfopen: %r"); pdfclose(pdf); threadexitsall(nil); }