123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- #include <stdio.h>
- #include <string.h>
- #include <signal.h>
- #include <ctype.h>
- #ifdef plan9
- #define isascii(c) ((unsigned char)(c)<=0177)
- #endif
- #include <sys/types.h>
- #include <fcntl.h>
- #include "comments.h"
- #include "gen.h"
- #include "path.h"
- #include "ext.h"
- #define dbprt if (debug) fprintf
- char *optnames = "a:c:fglm:n:o:p:x:y:C:E:DG:IL:P:";
- char *prologue = POSTGIF; /* default PostScript prologue */
- char *formfile = FORMFILE; /* stuff for multiple pages per sheet */
- int formsperpage = 1; /* page images on each piece of paper */
- int copies = 1; /* and this many copies of each sheet */
- int page = 0; /* last page we worked on */
- int printed = 0; /* and the number of pages printed */
- extern char *malloc();
- extern void free();
- extern double atof(), pow();
- unsigned char ibuf[BUFSIZ];
- unsigned char *cmap, *gcmap, *lcmap;
- unsigned char *gmap, *ggmap, *lgmap;
- unsigned char *pmap;
- double gamma;
- float cr = 0.3, cg = 0.59, cb = 0.11;
- int maplength, gmaplength, lmaplength;
- int scrwidth, scrheight;
- int gcolormap, lcolormap;
- int bitperpixel, background;
- int imageleft, imagetop;
- int imagewidth, imageheight;
- int interlaced, lbitperpixel;
- int gray = 0;
- int gammaflag = 0;
- int negative = 0;
- int terminate = 0;
- int codesize, clearcode, endcode, curstblsize, pmindex, byteinibuf, bitsleft;
- int prefix[4096], suffix[4096], cstbl[4096];
- int bburx = -32767, bbury = -32767;
- FILE *fp_in = NULL;
- FILE *fp_out = stdout;
- char *
- allocate(size)
- int size;
- {
- char *p;
- if ((p = malloc(size)) == NULL) error(FATAL, "not enough memory");
- return(p);
- }
- void
- puthex(c, fp)
- unsigned char c;
- FILE *fp;
- {
- static char hextbl[16] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
- };
- putc(hextbl[(c >> 4) & 017], fp);
- putc(hextbl[c & 017], fp);
- }
- void
- setcolormap(bp)
- int bp;
- {
- int i, entries = 1, scale = 1;
- unsigned char *p, *q;
- for (i = 0; i < bp; i++) entries *= 2;
- for (i = 0; i < 8 - bp; i++) scale *= 2;
- gcmap = (unsigned char *) allocate(entries*3);
- ggmap = (unsigned char *) allocate(entries);
- gmaplength = entries;
- for (i = 0, p = gcmap, q = ggmap; i < 256; i += scale, p += 3, q++) {
- if (negative) {
- *p = 255 - i; p[1] = *p; p[2] = *p;
- *q = *p;
- }
- else {
- *p = i; p[1] = i; p[2] = i;
- *q = i;
- }
- }
- if (gammaflag)
- for (i = 0, p = gcmap; i < 256; i += scale, p += 3) {
- *p = (unsigned char) (pow((double) *p/256.0, gamma)*256);
- p[1] = *p; p[2] = *p;
- }
- dbprt(stderr,"default color map:\n");
- for (i = 0; i < entries*3; i += 3)
- dbprt(stderr, "%d, %d, %d\n", gcmap[i], gcmap[i+1], gcmap[i+2]);
- }
- void
- readgcolormap(bp)
- int bp;
- {
- int i, entries = 1;
- unsigned char *p, *q;
- for (i = 0; i < bp; i++) entries *= 2;
- gcmap = (unsigned char *) allocate(entries*3);
- ggmap = (unsigned char *) allocate(entries);
- gmaplength = entries;
- fread(gcmap, sizeof(*gcmap), entries*3, fp_in);
- if (negative)
- for (i = 0, p = gcmap; i < entries*3; i++, p++) *p = 255 - *p;
- for (i = 0, p = gcmap, q = ggmap; i < entries; i++, p += 3, q++)
- *q = cr*(int)p[0] + cg*(int)p[1] + cb*(int)p[2] + 0.5;
- if (gammaflag)
- for (i = 0, p = gcmap; i < entries*3; i++, p++)
- *p = (unsigned char) (pow((double) *p/256.0, gamma)*256);
- dbprt(stderr,"global color map:\n");
- for (i = 0; i < entries*3; i += 3)
- dbprt(stderr, "%d, %d, %d\n", gcmap[i], gcmap[i+1], gcmap[i+2]);
- }
- void
- readlcolormap(bp)
- int bp;
- {
- int i, entries = 1;
- unsigned char *p, *q;
- for (i = 0; i < bp; i++) entries *= 2;
- lcmap = (unsigned char *) allocate(entries*3);
- lgmap = (unsigned char *) allocate(entries);
- lmaplength = entries;
- fread(lcmap, sizeof(*lcmap), entries*3, fp_in);
- if (negative)
- for (i = 0, p = lcmap; i < entries*3; i++, p++) *p = 255 - *p;
- for (i = 0, p = lcmap, q = lgmap; i < entries; i++, p += 3, q++)
- *q = cr*(int)p[0] + cg*(int)p[1] + cb*(int)p[2] + 0.5;
- if (gammaflag)
- for (i = 0, p = lcmap; i < entries*3; i++, p++)
- *p = (unsigned char) (pow((double) *p/256.0, gamma)*256);
- dbprt(stderr,"local color map:\n");
- for (i = 0; i < entries*3; i += 3)
- dbprt(stderr, "%d, %d, %d\n", lcmap[i], lcmap[i+1], lcmap[i+2]);
- }
- void
- initstbl()
- {
- int i, entries = 1, *p, *s;
- for (i = 0; i < codesize; i++) entries *= 2;
- clearcode = entries;
- endcode = clearcode + 1;
- for (i = 0, p = prefix, s = suffix; i <= endcode; i++, p++, s++) {
- *p = endcode;
- *s = i;
- }
- curstblsize = endcode + 1;
- pmindex = 0;
- byteinibuf = 0;
- bitsleft = 0;
- }
- int
- nextbyte()
- {
- static ibufindex;
- if (byteinibuf) {
- byteinibuf--;
- ibufindex++;
- }
- else {
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- byteinibuf = ibuf[0];
- dbprt(stderr, "byte count: %d\n", byteinibuf);
- if (byteinibuf) fread(ibuf, sizeof(*ibuf), byteinibuf, fp_in);
- else error(FATAL, "encounter zero byte count block before end code");
- ibufindex = 0;
- byteinibuf--;
- ibufindex++;
- }
- return(ibuf[ibufindex-1]);
- }
- int masktbl[25] = {
- 0, 01, 03, 07, 017, 037, 077, 0177, 0377, 0777, 01777, 03777, 07777,
- 017777, 037777, 077777, 0177777, 0377777, 0777777, 01777777, 03777777,
- 07777777, 017777777, 037777777, 077777777
- };
- int
- getcode()
- {
- int cs, c;
- static int oldc;
- if (curstblsize < 4096) cs = cstbl[curstblsize];
- else cs = 12;
- while (bitsleft < cs) {
- oldc = (oldc & masktbl[bitsleft]) | ((nextbyte() & 0377) << bitsleft);
- bitsleft += 8;
- }
- c = oldc & masktbl[cs];
- oldc = oldc >> cs;
- bitsleft -= cs;
- /* dbprt(stderr, "code: %d %d %d\n", curstblsize, cs, c); */
- return(c);
- }
- void
- putcode(c)
- int c;
- {
- if (prefix[c] != endcode) {
- putcode(prefix[c]);
- pmap[pmindex] = suffix[c];
- pmindex++;
- }
- else {
- pmap[pmindex] = suffix[c];
- pmindex++;
- }
- }
- int
- firstof(c)
- int c;
- {
- while (prefix[c] != endcode) c = prefix[c];
- return(suffix[c]);
- }
- void
- writeimage()
- {
- int i, j, k;
- dbprt(stderr, "pmindex: %d\n", pmindex);
- fputs("save\n", fp_out);
- fprintf(fp_out, "/codestr %d string def\n", imagewidth);
- if (!gray) {
- fprintf(fp_out, "/colortbl currentfile %d string readhexstring\n",
- maplength*3);
- for (i = 0; i < maplength; i++) puthex(cmap[i], fp_out);
- fputs("\n", fp_out);
- for (i = maplength ; i < maplength*2; i++) puthex(cmap[i], fp_out);
- fputs("\n", fp_out);
- for (i = maplength*2 ; i < maplength*3; i++) puthex(cmap[i], fp_out);
- fputs("\npop def\n", fp_out);
- fprintf(fp_out, "/graytbl currentfile %d string readhexstring\n",
- maplength);
- for (i = 0; i < maplength; i++) puthex(gmap[i], fp_out);
- fputs("\npop def\n", fp_out);
- }
- fprintf(fp_out, "%s %d %d %d %d gifimage\n",
- gray ? "true" : "false", imagewidth, imageheight,
- scrwidth - imageleft - imagewidth, scrheight - imagetop - imageheight);
- if (gray) {
- if (interlaced) {
- int *iltbl;
- iltbl = (int *) allocate(imageheight*sizeof(int));
- j = 0;
- for (i = 0; i < imageheight; i += 8) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass1: %d\n", j);
- for (i = 4; i < imageheight; i += 8) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass2: %d\n", j);
- for (i = 2; i < imageheight; i += 4) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass3: %d\n", j);
- for (i = 1; i < imageheight; i += 2) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass4: %d\n", j);
- for (i = 0; i < imageheight; i++) {
- k = iltbl[i];
- for (j = 0; j < imagewidth; j++, k++)
- puthex(gmap[pmap[k]], fp_out);
- fputs("\n", fp_out);
- }
- }
- else {
- for (i = 0, k = 0; i < imageheight; i++) {
- for (j = 0; j < imagewidth; j++, k++)
- puthex(gmap[pmap[k]], fp_out);
- fputs("\n", fp_out);
- }
- }
- }
- else {
- if (interlaced) {
- int *iltbl;
- iltbl = (int *) allocate(imageheight*sizeof(int));
- j = 0;
- for (i = 0; i < imageheight; i += 8) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass1: %d\n", j);
- for (i = 4; i < imageheight; i += 8) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass2: %d\n", j);
- for (i = 2; i < imageheight; i += 4) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass3: %d\n", j);
- for (i = 1; i < imageheight; i += 2) {
- iltbl[i] = j;
- j += imagewidth;
- }
- dbprt(stderr, "pass4: %d\n", j);
- for (i = 0; i < imageheight; i++) {
- k = iltbl[i];
- for (j = 0; j < imagewidth; j++, k++) puthex(pmap[k], fp_out);
- fputs("\n", fp_out);
- }
- }
- else {
- for (i = 0, k = 0; i < imageheight; i++) {
- for (j = 0; j < imagewidth; j++, k++) puthex(pmap[k], fp_out);
- fputs("\n", fp_out);
- }
- }
- }
- fputs("restore\n", fp_out);
- }
- void
- readimage()
- {
- int bytecount, zerobytecount = 0;
- int code, oldcode;
- fread(ibuf, sizeof(*ibuf), 9, fp_in);
- imageleft = ibuf[0] + 256*ibuf[1];
- imagetop = ibuf[2] + 256*ibuf[3];
- imagewidth = ibuf[4] + 256*ibuf[5];
- imageheight = ibuf[6] + 256*ibuf[7];
- lcolormap = ibuf[8] & 0200;
- interlaced = ibuf[8] & 0100;
- lbitperpixel = (ibuf[8] & 07) + 1;
- dbprt(stderr, "imageleft: %d\n", imageleft);
- dbprt(stderr, "imagetop: %d\n", imagetop);
- dbprt(stderr, "imagewidth: %d\n", imagewidth);
- dbprt(stderr, "imgaeheight: %d\n", imageheight);
- dbprt(stderr, "lcolormap: %d\n", lcolormap ? 1 : 0);
- dbprt(stderr, "interlaced: %d\n", interlaced ? 1 : 0);
- dbprt(stderr, "lbitperpixel: %d\n", lbitperpixel);
- if (lcolormap) {
- readlcolormap(lbitperpixel);
- cmap = lcmap;
- gmap = lgmap;
- maplength = lmaplength;
- }
- dbprt(stderr, "start reading raster data\n");
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- codesize = ibuf[0];
- dbprt(stderr, "codesize: %d\n", codesize);
- pmap = (unsigned char *) allocate(imagewidth*imageheight);
- initstbl();
- while ((code = getcode()) != endcode) {
- if (code == clearcode) {
- curstblsize = endcode + 1;
- code = getcode();
- putcode(code);
- oldcode = code;
- }
- else if (code < curstblsize) {
- putcode(code);
- prefix[curstblsize] = oldcode;
- suffix[curstblsize] = firstof(code);
- curstblsize++;
- oldcode = code;
- }
- else {
- if (code != curstblsize) error(FATAL, "code out of order");
- prefix[curstblsize] = oldcode;
- suffix[curstblsize] = firstof(oldcode);
- curstblsize++;
- putcode(curstblsize-1);
- oldcode = code;
- }
- }
- dbprt(stderr, "finish reading raster data\n");
- /* read the rest of the raster data */
- do {
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- bytecount = ibuf[0];
- dbprt(stderr, "byte count: %d\n", bytecount);
- if (bytecount) fread(ibuf, sizeof(*ibuf), bytecount, fp_in);
- else zerobytecount = 1;
- } while (!zerobytecount);
- writeimage();
- if (lcolormap) {
- cmap = gcmap;
- gmap = ggmap;
- maplength = gmaplength;
- free(lcmap);
- free(lgmap);
- }
- }
- void
- readextensionblock()
- {
- int functioncode, bytecount, zerobytecount = 0;
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- functioncode = ibuf[0];
- dbprt(stderr, "function code: %d\n", functioncode);
- do {
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- bytecount = ibuf[0];
- dbprt(stderr, "byte count: %d\n", bytecount);
- if (bytecount) fread(ibuf, sizeof(*ibuf), bytecount, fp_in);
- else zerobytecount = 1;
- } while (!zerobytecount);
- }
- void
- writebgscr()
- {
- fprintf(fp_out, "%s %d %d\n", PAGE, page, printed+1);
- fputs("/saveobj save def\n", fp_out);
- fprintf(fp_out, "%s: %d %d %d %d\n",
- "%%PageBoundingBox", 0, 0, scrwidth, scrheight);
- if (scrwidth > bburx) bburx = scrwidth;
- if (scrheight > bbury) bbury = scrheight;
- fprintf(fp_out, "%d %d gifscreen\n", scrwidth, scrheight);
- }
- void
- writeendscr()
- {
- if ( fp_out == stdout ) printed++;
- fputs("showpage\n", fp_out);
- fputs("saveobj restore\n", fp_out);
- fprintf(fp_out, "%s %d %d\n", ENDPAGE, page, printed);
- }
- void
- redirect(pg)
- int pg; /* next page we're printing */
- {
- static FILE *fp_null = NULL; /* if output is turned off */
- if ( pg >= 0 && in_olist(pg) == ON )
- fp_out = stdout;
- else if ( (fp_out = fp_null) == NULL )
- fp_out = fp_null = fopen("/dev/null", "w");
- }
- void
- readgif()
- {
- int i, j, k;
- for (i = 0, j = 1, k = 0; i < 13; i++) {
- for (; k < j; k++) cstbl[k] = i;
- j *= 2;
- }
- fread(ibuf, sizeof(*ibuf), 6, fp_in);
- dbprt(stderr, "%.6s\n", ibuf);
- if (strncmp((char *)ibuf, "GIF87a", 6) != 0) {
- fread(ibuf, sizeof(*ibuf), 122, fp_in);
- fread(ibuf, sizeof(*ibuf), 6, fp_in);
- dbprt(stderr, "%.6s\n", ibuf);
- if (strncmp((char *)ibuf, "GIF87a", 6) != 0)
- error(FATAL, "wrong GIF signature");
- }
- fread(ibuf, sizeof(*ibuf), 7, fp_in);
- scrwidth = ibuf[0] + 256*ibuf[1];
- scrheight = ibuf[2] + 256*ibuf[3];
- gcolormap = ibuf[4] & 0200;
- bitperpixel = (ibuf[4] & 07) + 1;
- background = ibuf[5];
- dbprt(stderr, "scrwidth: %d\n", scrwidth);
- dbprt(stderr, "scrheight: %d\n", scrheight);
- dbprt(stderr, "gcolormap: %d\n", gcolormap ? 1 : 0);
- dbprt(stderr, "bitperpixel: %d\n", bitperpixel);
- dbprt(stderr, "background: %d\n", background);
- if (ibuf[6] != 0) error(FATAL, "wrong screen descriptor");
- if (gcolormap) readgcolormap(bitperpixel);
- else setcolormap(bitperpixel);
- redirect(++page);
- writebgscr();
- cmap = gcmap;
- gmap = ggmap;
- maplength = gmaplength;
- do {
- fread(ibuf, sizeof(*ibuf), 1, fp_in);
- if (ibuf[0] == ',') readimage();
- else if (ibuf[0] == ';') terminate = 1;
- else if (ibuf[0] == '!') readextensionblock();
- else
- error(FATAL, "wrong image separator character or wrong GIF terminator");
- } while (!terminate);
- writeendscr();
- free(gcmap);
- free(ggmap);
- }
- void
- init_signals()
- {
- if ( signal(SIGINT, interrupt) == SIG_IGN ) {
- signal(SIGINT, SIG_IGN);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- }
- else {
- signal(SIGHUP, interrupt);
- signal(SIGQUIT, interrupt);
- }
- signal(SIGTERM, interrupt);
- }
- void
- header()
- {
- int ch; /* return value from getopt() */
- int old_optind = optind; /* for restoring optind - should be 1 */
- while ( (ch = getopt(argc, argv, optnames)) != EOF )
- if ( ch == 'L' )
- prologue = optarg;
- else if ( ch == '?' )
- error(FATAL, "");
- optind = old_optind; /* get ready for option scanning */
- fprintf(stdout, "%s", CONFORMING);
- fprintf(stdout, "%s %s\n", VERSION, PROGRAMVERSION);
- fprintf(stdout, "%s %s\n", BOUNDINGBOX, ATEND);
- fprintf(stdout, "%s %s\n", PAGES, ATEND);
- fprintf(stdout, "%s", ENDCOMMENTS);
- if ( cat(prologue) == FALSE )
- error(FATAL, "can't read %s", prologue);
- fprintf(stdout, "%s", ENDPROLOG);
- fprintf(stdout, "%s", BEGINSETUP);
- fprintf(stdout, "mark\n");
- }
- void
- options()
- {
- int ch; /* return value from getopt() */
- while ( (ch = getopt(argc, argv, optnames)) != EOF ) {
- switch ( ch ) {
- case 'a': /* aspect ratio */
- fprintf(stdout, "/aspectratio %s def\n", optarg);
- break;
- case 'c': /* copies */
- copies = atoi(optarg);
- fprintf(stdout, "/#copies %s store\n", optarg);
- break;
- case 'f':
- negative = TRUE;
- break;
- case 'g':
- gray = TRUE;
- break;
- case 'l':
- fprintf(stdout, "/alignment true def\n");
- break;
- case 'm': /* magnification */
- fprintf(stdout, "/magnification %s def\n", optarg);
- break;
- case 'n': /* forms per page */
- formsperpage = atoi(optarg);
- fprintf(stdout, "%s %s\n", FORMSPERPAGE, optarg);
- fprintf(stdout, "/formsperpage %s def\n", optarg);
- break;
- case 'o': /* output page list */
- out_list(optarg);
- break;
- case 'p': /* landscape or portrait mode */
- if ( *optarg == 'l' )
- fprintf(stdout, "/landscape true def\n");
- else fprintf(stdout, "/landscape false def\n");
- break;
- case 'x': /* shift things horizontally */
- fprintf(stdout, "/xoffset %s def\n", optarg);
- break;
- case 'y': /* and vertically on the page */
- fprintf(stdout, "/yoffset %s def\n", optarg);
- break;
- case 'C': /* copy file straight to output */
- if ( cat(optarg) == FALSE )
- error(FATAL, "can't read %s", optarg);
- break;
- case 'E': /* text font encoding - unnecessary */
- fontencoding = optarg;
- break;
- case 'D': /* debug flag */
- debug = ON;
- break;
- case 'G':
- gammaflag = ON;
- gamma = atof(optarg);
- break;
- case 'I': /* ignore FATAL errors */
- ignore = ON;
- break;
- case 'L': /* PostScript prologue file */
- prologue = optarg;
- break;
- case 'P': /* PostScript pass through */
- fprintf(stdout, "%s\n", optarg);
- break;
- case '?': /* don't understand the option */
- error(FATAL, "");
- break;
- default: /* don't know what to do for ch */
- error(FATAL, "missing case for option %c\n", ch);
- break;
- }
- }
- argc -= optind; /* get ready for non-option args */
- argv += optind;
- }
- void
- setup()
- {
- /*setencoding(fontencoding);*/
- fprintf(stdout, "setup\n");
- if ( formsperpage > 1 ) { /* followed by stuff for multiple pages
- */
- if ( cat(formfile) == FALSE )
- error(FATAL, "can't read %s", formfile);
- fprintf(stdout, "%d setupforms\n", formsperpage);
- } /* End if */
- fprintf(stdout, "%s", ENDSETUP);
- }
- void
- arguments()
- {
- if ( argc < 1 ) {
- fp_in = stdin;
- readgif();
- }
- else { /* at least one argument is left */
- while ( argc > 0 ) {
- if ( strcmp(*argv, "-") == 0 )
- fp_in = stdin;
- else if ( (fp_in = fopen(*argv, "r")) == NULL )
- error(FATAL, "can't open %s", *argv);
- readgif();
- if ( fp_in != stdin )
- fclose(fp_in);
- argc--;
- argv++;
- }
- }
- }
- void
- done()
- {
- fprintf(stdout, "%s", TRAILER);
- fprintf(stdout, "done\n");
- fprintf(stdout, "%s 0 0 %d %d\n", BOUNDINGBOX, bburx, bbury);
- fprintf(stdout, "%s %d\n", PAGES, printed);
- }
- main(agc, agv)
- int agc;
- char *agv[];
- {
- argc = agc;
- argv = agv;
- prog_name = argv[0];
- init_signals();
- header();
- options();
- setup();
- arguments();
- done();
- exit(0);
- }
|