postdmd.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /*
  2. *
  3. * postdmd - PostScript translator for DMD bitmap files.
  4. *
  5. * A simple program that can be used to print DMD bitmaps on PostScript printers.
  6. * Much of the code was borrowed from abm, which was written by Guy Riddle.
  7. *
  8. * Although the program supports two different input bitmap formats, by far the
  9. * most important is the Eighth (and Ninth) Edition bitfile format. A bitmap in
  10. * the bitfile format begins with a 10 byte header with the first two bytes set to
  11. * zero. The next 8 bytes set the x and y coordinates of the bitmap's origin and
  12. * corner (ie. the upper left and lower right corners). The compressed raster data
  13. * follows the header and consists of control bytes followed an appropriate number
  14. * of data bytes. Control bytes (ie. n) less than 127 means read the next 2*n bytes
  15. * of raster data directly from the input file, while if n is larger than 128 we
  16. * read two bytes from the input file and replicate the bytes n-128 times. After
  17. * each scan line is recovered it's exclusive-or'd with the preceeding line to
  18. * generate the real raster data.
  19. *
  20. * After each raster line is recovered postdmd encodes it in a slightly different
  21. * format that's designed to be unpacked by a PostScript procedure that's defined
  22. * in the prologue. By default no exclusive-or'ing is done and packing of pattern
  23. * data can be based on any number of bytes rather than just the next two bytes.
  24. * By default 6 byte patterns are used, but any number can be selected with the -b
  25. * option. A non-positive argument (eg. -b0) disables all pattern encoding. Larger
  26. * patterns increase the size of the output file, but reduce the work load that's
  27. * forced on the PostScript interpreter. The default choices I've made (ie. 6 byte
  28. * patterns and no exclusive-or'ing) do a decent balancing job across currently
  29. * available PostScript printers. Larger patterns (eg. -b16) increase the output
  30. * file size, but may be appropriate if you're running at a high baud rate (eg.
  31. * 19.2KB), while smaller patter size (eg. -b4) may help if you've got a printer
  32. * with a fast processor (eg. a PS-810).
  33. *
  34. * The encoding produced by the program (and decoded on the printer) looks like,
  35. *
  36. * bytes patterns count
  37. *
  38. * where bytes and count are decimal integers and patterns is a hex string. Bytes
  39. * is the number of bytes represented by the hex patterns and count is the number
  40. * of additional times the patterns should be repeated. For example,
  41. *
  42. * 2 FFFF 4
  43. * 5 FFFFFFFFFF 1
  44. * 10 FFFFFFFFFFFFFFFFFFFF 0
  45. *
  46. * all represent 10 consecutive bytes of ones. Scanlines are terminated by a 0 on
  47. * a line by itself.
  48. *
  49. * The PostScript prologue is copied from *prologue before any of the input files
  50. * are translated. The program expects that the following PostScript procedures
  51. * are defined in that file:
  52. *
  53. * setup
  54. *
  55. * mark ... setup -
  56. *
  57. * Handles special initialization stuff that depends on how this program
  58. * was called. Expects to find a mark followed by key/value pairs on the
  59. * stack. The def operator is applied to each pair up to the mark, then
  60. * the default state is set up.
  61. *
  62. * pagesetup
  63. *
  64. * page pagesetup -
  65. *
  66. * Does whatever is needed to set things up for the next page. Expects
  67. * to find the current page number on the stack.
  68. *
  69. * bitmap
  70. *
  71. * v8format flip scanlength scanlines bitmap -
  72. *
  73. * Prints the bitmap that's read from standard input. The bitmap consists
  74. * of scanlines lines, each of which includes scanlength pixels. If
  75. * v8format is true the picture is assumed to be an Eighth Edition bitmap,
  76. * and the exclusive-or'ing will be done on the printer.
  77. *
  78. * done
  79. *
  80. * done
  81. *
  82. * Makes sure the last page is printed. Only needed when we're printing
  83. * more than one page on each sheet of paper.
  84. *
  85. * Many default values, like the magnification and orientation, are defined in
  86. * the prologue, which is where they belong. If they're changed (by options), an
  87. * appropriate definition is made after the prologue is added to the output file.
  88. * The -P option passes arbitrary PostScript through to the output file. Among
  89. * other things it can be used to set (or change) values that can't be accessed by
  90. * other options.
  91. *
  92. */
  93. #include <stdio.h>
  94. #include <signal.h>
  95. #include <ctype.h>
  96. #ifdef plan9
  97. #define isascii(c) ((unsigned char)(c)<=0177)
  98. #endif
  99. #include <sys/types.h>
  100. #include <fcntl.h>
  101. #include "comments.h" /* PostScript file structuring comments */
  102. #include "gen.h" /* general purpose definitions */
  103. #include "path.h" /* for the prologue */
  104. #include "ext.h" /* external variable declarations */
  105. char *optnames = "a:b:c:fm:n:o:p:ux:y:A:C:E:J:L:P:DI";
  106. char *prologue = POSTDMD; /* default PostScript prologue */
  107. char *formfile = FORMFILE; /* stuff for multiple pages per sheet */
  108. int bbox[2] = {0, 0}; /* upper right coordinates only */
  109. int formsperpage = 1; /* page images on each piece of paper */
  110. int copies = 1; /* and this many copies of each sheet */
  111. int bytespp = 6; /* bytes per pattern - on output */
  112. int flip = FALSE; /* ones complement the bitmap */
  113. int v8undo = TRUE; /* xor'ing done on host if TRUE */
  114. int v8format = FALSE; /* for Eighth Edition bitmaps */
  115. int page = 0; /* last page we worked on */
  116. int printed = 0; /* and the number of pages printed */
  117. int patterns; /* 16 bit patterns per scan line */
  118. int scanlines; /* lines in the bitmap */
  119. int patcount = 0; /* should be patterns * scanlines */
  120. char *raster = NULL; /* next raster line */
  121. char *prevrast = NULL; /* and the previous one - v8format */
  122. char *rptr; /* next free byte in raster */
  123. char *eptr; /* one past the last byte in raster */
  124. FILE *fp_in = NULL; /* read from this file */
  125. FILE *fp_out = stdout; /* and write stuff here */
  126. FILE *fp_acct = NULL; /* for accounting data */
  127. /*****************************************************************************/
  128. main(agc, agv)
  129. int agc;
  130. char *agv[];
  131. {
  132. /*
  133. *
  134. * A simple program that translates DMD bitmap files into PostScript. There can
  135. * be more than one bitmap per file, but none can be split across input files.
  136. * Each bitmap goes on a page by itself.
  137. *
  138. */
  139. argc = agc; /* other routines may want them */
  140. argv = agv;
  141. prog_name = argv[0]; /* really just for error messages */
  142. init_signals(); /* sets up interrupt handling */
  143. header(); /* PostScript header comments */
  144. options(); /* handle the command line options */
  145. setup(); /* for PostScript */
  146. arguments(); /* followed by each input file */
  147. done(); /* print the last page etc. */
  148. account(); /* job accounting data */
  149. exit(x_stat); /* not much could be wrong */
  150. } /* End of main */
  151. /*****************************************************************************/
  152. init_signals()
  153. {
  154. /*
  155. *
  156. * Make sure we handle interrupts.
  157. *
  158. */
  159. if ( signal(SIGINT, interrupt) == SIG_IGN ) {
  160. signal(SIGINT, SIG_IGN);
  161. signal(SIGQUIT, SIG_IGN);
  162. signal(SIGHUP, SIG_IGN);
  163. } else {
  164. signal(SIGHUP, interrupt);
  165. signal(SIGQUIT, interrupt);
  166. } /* End else */
  167. signal(SIGTERM, interrupt);
  168. } /* End of init_signals */
  169. /*****************************************************************************/
  170. header()
  171. {
  172. int ch; /* return value from getopt() */
  173. int old_optind = optind; /* for restoring optind - should be 1 */
  174. /*
  175. *
  176. * Scans the option list looking for things, like the prologue file, that we need
  177. * right away but could be changed from the default. Doing things this way is an
  178. * attempt to conform to Adobe's latest file structuring conventions. In particular
  179. * they now say there should be nothing executed in the prologue, and they have
  180. * added two new comments that delimit global initialization calls. Once we know
  181. * where things really are we write out the job header, follow it by the prologue,
  182. * and then add the ENDPROLOG and BEGINSETUP comments.
  183. *
  184. */
  185. while ( (ch = getopt(argc, argv, optnames)) != EOF )
  186. if ( ch == 'L' )
  187. prologue = optarg;
  188. else if ( ch == '?' )
  189. error(FATAL, "");
  190. optind = old_optind; /* get ready for option scanning */
  191. fprintf(stdout, "%s", CONFORMING);
  192. fprintf(stdout, "%s %s\n", VERSION, PROGRAMVERSION);
  193. fprintf(stdout, "%s %s\n", DOCUMENTFONTS, ATEND);
  194. fprintf(stdout, "%s %s\n", PAGES, ATEND);
  195. fprintf(stdout, "%s", ENDCOMMENTS);
  196. if ( cat(prologue) == FALSE )
  197. error(FATAL, "can't read %s", prologue);
  198. fprintf(stdout, "%s", ENDPROLOG);
  199. fprintf(stdout, "%s", BEGINSETUP);
  200. fprintf(stdout, "mark\n");
  201. } /* End of header */
  202. /*****************************************************************************/
  203. options()
  204. {
  205. int ch; /* return value from getopt() */
  206. /*
  207. *
  208. * Reads and processes the command line options. Added the -P option so arbitrary
  209. * PostScript code can be passed through. Expect it could be useful for changing
  210. * definitions in the prologue for which options have not been defined.
  211. *
  212. */
  213. while ( (ch = getopt(argc, argv, optnames)) != EOF ) {
  214. switch ( ch ) {
  215. case 'a': /* aspect ratio */
  216. fprintf(stdout, "/aspectratio %s def\n", optarg);
  217. break;
  218. case 'b': /* bytes per pattern */
  219. bytespp = atoi(optarg);
  220. break;
  221. case 'c': /* copies */
  222. copies = atoi(optarg);
  223. fprintf(stdout, "/#copies %s store\n", optarg);
  224. break;
  225. case 'f': /* ones complement - sort of */
  226. flip = TRUE;
  227. break;
  228. case 'm': /* magnification */
  229. fprintf(stdout, "/magnification %s def\n", optarg);
  230. break;
  231. case 'n': /* forms per page */
  232. formsperpage = atoi(optarg);
  233. fprintf(stdout, "%s %s\n", FORMSPERPAGE, optarg);
  234. fprintf(stdout, "/formsperpage %s def\n", optarg);
  235. break;
  236. case 'o': /* output page list */
  237. out_list(optarg);
  238. break;
  239. case 'p': /* landscape or portrait mode */
  240. if ( *optarg == 'l' )
  241. fprintf(stdout, "/landscape true def\n");
  242. else fprintf(stdout, "/landscape false def\n");
  243. break;
  244. case 'u': /* don't undo Eighth Edition bitmaps */
  245. v8undo = FALSE;
  246. break;
  247. case 'x': /* shift things horizontally */
  248. fprintf(stdout, "/xoffset %s def\n", optarg);
  249. break;
  250. case 'y': /* and vertically on the page */
  251. fprintf(stdout, "/yoffset %s def\n", optarg);
  252. break;
  253. case 'A': /* force job accounting */
  254. case 'J':
  255. if ( (fp_acct = fopen(optarg, "a")) == NULL )
  256. error(FATAL, "can't open accounting file %s", optarg);
  257. break;
  258. case 'C': /* copy file straight to output */
  259. if ( cat(optarg) == FALSE )
  260. error(FATAL, "can't read %s", optarg);
  261. break;
  262. case 'E': /* text font encoding - unnecessary */
  263. fontencoding = optarg;
  264. break;
  265. case 'L': /* PostScript prologue file */
  266. prologue = optarg;
  267. break;
  268. case 'P': /* PostScript pass through */
  269. fprintf(stdout, "%s\n", optarg);
  270. break;
  271. case 'R': /* special global or page level request */
  272. saverequest(optarg);
  273. break;
  274. case 'D': /* debug flag */
  275. debug = ON;
  276. break;
  277. case 'I': /* ignore FATAL errors */
  278. ignore = ON;
  279. break;
  280. case '?': /* don't understand the option */
  281. error(FATAL, "");
  282. break;
  283. default: /* don't know what to do for ch */
  284. error(FATAL, "missing case for option %c\n", ch);
  285. break;
  286. } /* End switch */
  287. } /* End while */
  288. argc -= optind; /* get ready for non-option args */
  289. argv += optind;
  290. } /* End of options */
  291. /*****************************************************************************/
  292. setup()
  293. {
  294. /*
  295. *
  296. * Handles things that must be done after the options are read but before the
  297. * input files are processed.
  298. *
  299. */
  300. writerequest(0, stdout); /* global requests eg. manual feed */
  301. setencoding(fontencoding); /* unnecessary */
  302. fprintf(stdout, "setup\n");
  303. if ( formsperpage > 1 ) { /* followed by stuff for multiple pages */
  304. if ( cat(formfile) == FALSE )
  305. error(FATAL, "can't read %s", formfile);
  306. fprintf(stdout, "%d setupforms\n", formsperpage);
  307. } /* End if */
  308. fprintf(stdout, "%s", ENDSETUP);
  309. } /* End of setup */
  310. /*****************************************************************************/
  311. arguments()
  312. {
  313. FILE *fp; /* next input file */
  314. /*
  315. *
  316. * Makes sure all the non-option command line arguments are processed. If we get
  317. * here and there aren't any arguments left, or if '-' is one of the input files
  318. * we'll process stdin.
  319. *
  320. */
  321. if ( argc < 1 )
  322. bitmap(stdin);
  323. else { /* at least one argument is left */
  324. while ( argc > 0 ) {
  325. if ( strcmp(*argv, "-") == 0 )
  326. fp = stdin;
  327. else if ( (fp = fopen(*argv, "r")) == NULL )
  328. error(FATAL, "can't open %s", *argv);
  329. bitmap(fp);
  330. if ( fp != stdin )
  331. fclose(fp);
  332. argc--;
  333. argv++;
  334. } /* End while */
  335. } /* End else */
  336. } /* End of arguments */
  337. /*****************************************************************************/
  338. done()
  339. {
  340. /*
  341. *
  342. * Finished with all the input files, so mark the end of the pages with a TRAILER
  343. * comment, make sure the last page prints, and add things like the PAGES comment
  344. * that can only be determined after all the input files have been read.
  345. *
  346. */
  347. fprintf(stdout, "%s", TRAILER);
  348. fprintf(stdout, "done\n");
  349. fprintf(stdout, "%s 0 0 %d %d\n", BOUNDINGBOX, (bbox[0]*72+100)/100, (bbox[1]*72+100)/100);
  350. fprintf(stdout, "%s %d\n", PAGES, printed);
  351. } /* End of done */
  352. /*****************************************************************************/
  353. account()
  354. {
  355. /*
  356. *
  357. * Writes an accounting record to *fp_acct provided it's not NULL. Accounting is
  358. * requested using the -A or -J options.
  359. *
  360. */
  361. if ( fp_acct != NULL )
  362. fprintf(fp_acct, " print %d\n copies %d\n", printed, copies);
  363. } /* End of account */
  364. /*****************************************************************************/
  365. bitmap(fp)
  366. FILE *fp; /* next input file */
  367. {
  368. int count; /* pattern repeats this many times */
  369. long total; /* expect this many patterns */
  370. /*
  371. *
  372. * Reads all the bitmaps from the next input file, translates each one into
  373. * PostScript, and arranges to have one bitmap printed on each page. Multiple
  374. * bitmaps per input file work.
  375. *
  376. */
  377. fp_in = fp; /* everyone reads from this file */
  378. while ( dimensions() == TRUE ) {
  379. patcount = 0;
  380. total = scanlines * patterns;
  381. bbox[0] = MAX(bbox[0], patterns*16); /* for BoundingBox comment */
  382. bbox[1] = MAX(bbox[1], scanlines);
  383. redirect(++page);
  384. fprintf(fp_out, "%s %d %d\n", PAGE, page, printed+1);
  385. fprintf(fp_out, "/saveobj save def\n");
  386. writerequest(printed+1, fp_out);
  387. fprintf(fp_out, "%s ", (v8format == TRUE && v8undo == FALSE) ? "true" : "false");
  388. fprintf(fp_out, "%s ", (flip == TRUE) ? "true" : "false");
  389. fprintf(fp_out, "%d %d bitmap\n", patterns * 16, scanlines);
  390. while ( patcount != total && (count = getc(fp)) != EOF ) {
  391. addrast(count);
  392. patcount += (count & 0177);
  393. if ( patcount % patterns == 0 )
  394. putrast();
  395. } /* End while */
  396. if ( debug == ON )
  397. fprintf(stderr, "patterns = %d, scanlines = %d, patcount = %d\n", patterns, scanlines, patcount);
  398. if ( total != patcount )
  399. error(FATAL, "bitmap format error");
  400. if ( fp_out == stdout ) printed++;
  401. fprintf(fp_out, "showpage\n");
  402. fprintf(fp_out, "saveobj restore\n");
  403. fprintf(fp_out, "%s %d %d\n", ENDPAGE, page, printed);
  404. } /* End while */
  405. } /* End of bitmap */
  406. /*****************************************************************************/
  407. dimensions()
  408. {
  409. int ox, oy; /* coordinates of the origin */
  410. int cx, cy; /* and right corner of the bitmap */
  411. int i; /* loop index */
  412. /*
  413. *
  414. * Determines the dimensions and type of the next bitmap. Eighth edition bitmaps
  415. * have a zero in the first 16 bits. If valid dimensions are read TRUE is returned
  416. * to the caller. Changed so the check of whether we're done (by testing scanlines
  417. * or patterns) comes before the malloc().
  418. *
  419. */
  420. if ( (scanlines = getint()) == 0 ) {
  421. ox = getint();
  422. oy = getint();
  423. cx = getint();
  424. cy = getint();
  425. scanlines = cy - oy;
  426. patterns = (cx - ox + 15) / 16;
  427. v8format = TRUE;
  428. } else patterns = getint();
  429. if ( scanlines <= 0 || patterns <= 0 ) /* done - don't do the malloc() */
  430. return(FALSE);
  431. if ( raster != NULL ) free(raster);
  432. if ( prevrast != NULL ) free(prevrast);
  433. if ( (rptr = raster = (char *) malloc(patterns * 2)) == NULL )
  434. error(FATAL, "no memory");
  435. if ( (prevrast = (char *) malloc(patterns * 2)) == NULL )
  436. error(FATAL, "no memory");
  437. for ( i = 0; i < patterns * 2; i++ )
  438. *(prevrast+i) = 0377;
  439. eptr = rptr + patterns * 2;
  440. return(TRUE);
  441. } /* End of dimensions */
  442. /*****************************************************************************/
  443. addrast(count)
  444. int count; /* repeat count for next pattern */
  445. {
  446. int size; /* number of bytes in next pattern */
  447. int l, h; /* high and low bytes */
  448. int i, j; /* loop indices */
  449. /*
  450. *
  451. * Reads the input file and adds the appropriate number of bytes to the output
  452. * raster line. If count has bit 7 on, one 16 bit pattern is read and repeated
  453. * count & 0177 times. If bit 7 is off, count is the number of patterns read from
  454. * fp_in - each one repeated once.
  455. *
  456. */
  457. if ( count & 0200 ) {
  458. size = 1;
  459. count &= 0177;
  460. } else {
  461. size = count;
  462. count = 1;
  463. } /* End else */
  464. for ( i = size; i > 0; i-- ) {
  465. if ( (l = getc(fp_in)) == EOF || (h = getc(fp_in)) == EOF )
  466. return;
  467. for ( j = count; j > 0; j-- ) {
  468. *rptr++ = l;
  469. *rptr++ = h;
  470. } /* End for */
  471. } /* End for */
  472. } /* End of addrast */
  473. /*****************************************************************************/
  474. putrast()
  475. {
  476. char *p1, *p2; /* starting and ending patterns */
  477. int n; /* set to bytes per pattern */
  478. int i; /* loop index */
  479. /*
  480. *
  481. * Takes the scanline that's been saved in *raster, encodes it according to the
  482. * value that's been assigned to bytespp, and writes the result to *fp_out. Each
  483. * line in the output bitmap is terminated by a 0 on a line by itself.
  484. *
  485. */
  486. n = (bytespp <= 0) ? 2 * patterns : bytespp;
  487. if ( v8format == TRUE && v8undo == TRUE )
  488. for ( i = 0; i < patterns * 2; i++ )
  489. *(raster+i) = (*(prevrast+i) ^= *(raster+i));
  490. for ( p1 = raster, p2 = raster + n; p1 < eptr; p1 = p2 )
  491. if ( patncmp(p1, n) == TRUE ) {
  492. while ( patncmp(p2, n) == TRUE ) p2 += n;
  493. p2 += n;
  494. fprintf(fp_out, "%d ", n);
  495. for ( i = 0; i < n; i++, p1++ )
  496. fprintf(fp_out, "%.2X", ((int) *p1) & 0377);
  497. fprintf(fp_out, " %d\n", (p2 - p1) / n);
  498. } else {
  499. while ( p2 < eptr && patncmp(p2, n) == FALSE ) p2 += n;
  500. if ( p2 > eptr ) p2 = eptr;
  501. fprintf(fp_out, "%d ", p2 - p1);
  502. while ( p1 < p2 )
  503. fprintf(fp_out, "%.2X", ((int) *p1++) & 0377);
  504. fprintf(fp_out, " 0\n");
  505. } /* End else */
  506. fprintf(fp_out, "0\n");
  507. rptr = raster;
  508. } /* End of putrast */
  509. /*****************************************************************************/
  510. patncmp(p1, n)
  511. char *p1; /* first patterns starts here */
  512. int n; /* and extends this many bytes */
  513. {
  514. char *p2; /* address of the second pattern */
  515. /*
  516. *
  517. * Compares the two n byte patterns *p1 and *(p1+n). FALSE is returned if they're
  518. * different or extend past the end of the current raster line.
  519. *
  520. */
  521. p2 = p1 + n;
  522. for ( ; n > 0; n--, p1++, p2++ )
  523. if ( p2 >= eptr || *p1 != *p2 )
  524. return(FALSE);
  525. return(TRUE);
  526. } /* End of patncmp */
  527. /*****************************************************************************/
  528. getint()
  529. {
  530. int h, l; /* high and low bytes */
  531. /*
  532. *
  533. * Reads the next two bytes from *fp_in and returns the resulting integer.
  534. *
  535. */
  536. if ( (l = getc(fp_in)) == EOF || (h = getc(fp_in)) == EOF )
  537. return(-1);
  538. return((h & 0377) << 8 | (l & 0377));
  539. } /* End of getint */
  540. /*****************************************************************************/
  541. redirect(pg)
  542. int pg; /* next page we're printing */
  543. {
  544. static FILE *fp_null = NULL; /* if output is turned off */
  545. /*
  546. *
  547. * If we're not supposed to print page pg, fp_out will be directed to /dev/null,
  548. * otherwise output goes to stdout.
  549. *
  550. */
  551. if ( pg >= 0 && in_olist(pg) == ON )
  552. fp_out = stdout;
  553. else if ( (fp_out = fp_null) == NULL )
  554. fp_out = fp_null = fopen("/dev/null", "w");
  555. } /* End of redirect */
  556. /*****************************************************************************/