home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2090 / troff2.c next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  15.4 KB  |  715 lines

  1. /*    Copyright 1985, 1986, 1987, 1988 Chris Lewis
  2.         All Rights Reserved
  3.  
  4.     Permission to copy and further distribute is freely given provided
  5.     this copyright notice remains intact and that this software is not
  6.     sold for profit.
  7.  
  8.     Project:    Generic Troff drivers
  9.     Module:        troff2.c
  10.     Author:     Chris Lewis
  11.     Specs:        Troff interpreter, needs a driver to work.
  12.  */
  13.  
  14. #include "defs.h"
  15.  
  16. #ifndef    lint
  17. static char SCCSid[] =
  18.     "@(#)troff2.c: 2.2 Copyright 90/08/10 15:15:35 Chris Lewis";
  19. #endif
  20.  
  21. #define    ESC    0x80
  22. #define    FLASH    0x00
  23. #define    CONTROL    0x40
  24. #define    LEAD    0x60
  25. #define    SIZE    0x50
  26.  
  27. #define    DOWN    0
  28. #define    UP    1
  29. #define    LOWER    2
  30. #define    UPPER    3
  31. #define    FORWARD    4
  32. #define    BACKWARD 5
  33.  
  34. #ifdef    BSDHACK
  35. int    magnify_lead = 0;
  36. #endif
  37.  
  38. char ptab[15] = { 7, 8, 10, 11, 12, 14, 18, 9, 6, 16, 20, 22, 24, 28, 36};
  39. int    points;
  40.  
  41. int    xpos, ypos;
  42.  
  43. #ifdef    VDEBUG
  44. char *words[] = {
  45.     "down", "up", "lower", "upper", "forward", "backwards"
  46.     };
  47. #endif
  48.  
  49.  
  50. #define    CTOINT(val,sig)    ((~c)&sig)
  51.  
  52. int pagelength;
  53. int pageoffset;
  54. int pageyoffset;
  55.  
  56. char *version, *shortversion;
  57.  
  58. int dumpflag = 0;
  59.  
  60. #define    CFONT (((mag == UPPER)<<2)|((rail == UPPER)<<1)|(tilt==DOWN))
  61. #ifdef    FONT4
  62. #define    calcfont    font = (CFONT >> 1)
  63. #else
  64. #define    calcfont    font = CFONT
  65. #endif
  66.  
  67. char *progname;
  68. char *printer;
  69. char *device = {"alw"};
  70. char **prologs = (char **) NULL;
  71. #define    PROCHUNK    20
  72. int procount;
  73.  
  74. #ifdef    L_cuserid
  75. #define    nmMAX    L_cuserid
  76. #else
  77. #define    nmMAX    16
  78. #endif
  79.  
  80. char username[nmMAX];
  81.  
  82. double calc();
  83.  
  84. char *driver = "ps";
  85. #ifdef    OPT
  86. char *widthtables = (char *)NULL;
  87. char *widthptr;
  88. int optimize = 0;
  89. #endif
  90.  
  91. extern char *realloc();
  92.  
  93. #define    OPTLIST    "d:O:Y:T:VD:l:MR:P::zp:W:Z"
  94.  
  95. /*    On 386/ix 1.0.6 profiling has a bug in it that leaves
  96.     two extra longs on the stack between the stack frame and
  97.     arguments on entry to main */
  98. #ifdef    PROFBUG
  99.  
  100. main(j1, j2, argc, argv)
  101. long j1, j2;
  102. int argc;
  103. char **argv; {
  104.  
  105. #else
  106.  
  107. main(argc, argv)
  108. int    argc;
  109. char    **argv; {
  110.  
  111. #endif
  112.     register int nc, c;
  113.     register int units;
  114.     register int font, rail, mag, tilt, half, escape, lead;
  115.  
  116.     extern int getopt();
  117.     extern char *optarg;
  118.  
  119. #ifdef    L_cuserid
  120.     extern char *cuserid();
  121.  
  122.     (void) cuserid(username);
  123.     if (!username[0])
  124. #else
  125.  
  126.     extern char *getlogin();
  127.  
  128.     progname = getlogin();
  129.     if (progname)
  130.         strcpy(username, progname);
  131.     else
  132.         /* I could read /etc/passwd, but hell, why? */
  133. #endif
  134.         sprintf(username, "uid=%d", getuid());
  135.  
  136.     /* some compilers complain about floating point in initializers... */
  137.     pagelength = DEFPL * TROFFRESOLUTION;
  138.     pageoffset = DEFOFF * TROFFRESOLUTION;
  139.     pageyoffset = DEFYOFF * TROFFRESOLUTION;
  140.  
  141.     progname = strrchr(argv[0], '/');
  142.     if (progname)
  143.         progname++;
  144.     else
  145.         progname = argv[0];
  146.  
  147.     version = T2VERSION + 4;
  148.     shortversion = strchr(version, '-') + 2;
  149.  
  150.     while((c = getopt(argc, argv, OPTLIST)) != EOF)
  151.         switch (c) {
  152. #ifdef    OPT
  153.         case 'Z':
  154.             optimize = 1;
  155.             break;
  156.         case 'W':
  157.             widthtables = mustmalloc(strlen(optarg) + 10, "widthname");
  158.             strcpy(widthtables, optarg);
  159.             strcat(widthtables, "/");
  160.             break;
  161. #else
  162.         case 'Z':
  163.         case 'W':
  164.             fprintf(stderr,
  165.             "%s: optimization disabled; -Z/-W ignored (%s)\n",
  166.             progname, "see OPT in defs.h");
  167.             break;
  168. #endif
  169.         case 'P':
  170.             if (!prologs) {
  171.             prologs = (char **) mustmalloc(PROCHUNK * sizeof(char*),
  172.                 "prologs");
  173.             procount = 0;
  174.             }
  175.             prologs[procount++] = optarg;
  176.             /* insert the null */
  177.             if ((procount % PROCHUNK) == 0) {
  178.             prologs = (char **) realloc((char *) prologs,
  179.                 (procount + PROCHUNK) * sizeof(char *));
  180.             }
  181.             prologs[procount] = (char *) NULL;
  182.             break;
  183.         case 'p':
  184.             printer = optarg;
  185.             break;
  186.         case 'd':
  187.             device = optarg;
  188.             break;
  189.         case 'z':
  190.             dumpflag++;
  191.             break;
  192.         case 'T':
  193.             driver = optarg;
  194.             break;
  195.         case 'R':
  196. #if    defined(DT)
  197.             {
  198.             extern int dtresolution;
  199.             dtresolution = atoi(optarg);
  200.             if (dtresolution == 0) {
  201.                 fprintf(stderr, "%s: Invalid resolution: %s\n",
  202.                 progname, optarg);
  203.                 exit(1);
  204.             }
  205.             }
  206.             break;
  207. #else
  208.             fprintf(stderr, "%s: Resolution not supported\n",
  209.             progname);
  210.             exit(1);
  211. #endif
  212.         case 'M':
  213.             metrics = 1;
  214.             break;
  215.         case 'V':
  216.             printf("%s: %s\n", progname, version);
  217.             exit(0);
  218.         case 'D':
  219. #ifdef    DEBUG
  220.             setdebug(optarg, "diagnostics");
  221.             break;
  222. #else
  223.             fprintf(stderr, "%s: DEBUG disabled - recompile\n",
  224.             progname);
  225.             exit(1);
  226. #endif
  227.         case 'O':
  228.             pageoffset = calc(optarg);
  229.             break;
  230.         case 'Y':
  231.             pageyoffset = calc(optarg);
  232.             break;
  233.         case 'l':
  234.             pagelength = calc(optarg);
  235.             if (pagelength == 0) {
  236.             fprintf(stderr, "%s: Bad pagelength %s\n", progname,
  237.                 optarg);
  238.             exit(1);
  239.             }
  240.             break;
  241.         case '?':
  242.         default:
  243.             usage();
  244.             exit(1);
  245.         }
  246.  
  247.     getdriver(driver);
  248.  
  249.     if (!printer)
  250.         printer = driver;
  251.  
  252. #ifdef    OPT
  253.     if (!widthtables) {
  254.         widthtables = mustmalloc(strlen(driver) + strlen(FONTDIR) + 20,
  255.         "widthname");
  256.         sprintf(widthtables, "%s/%s/", FONTDIR, driver);
  257.     }
  258.     widthptr = widthtables + strlen(widthtables);
  259. #endif
  260.  
  261.     loadfont(be->bestdfont, be->besymfont);
  262. #ifdef    DEBUG
  263.     if (debug & D_SPEC) {
  264.         for (c = 0; c < procount; c++) {
  265.         DBP((D_SPEC, "Prolog %d: %s\n", c, prologs[c]));
  266.         }
  267.     }
  268. #endif
  269.  
  270.     if (dumpflag) {
  271.  
  272.         printf("Font table:\n\n");
  273.         for (c = 0; fonttable[c].tab[0]; c++)
  274.         printf("%-3s %-20s %-20s %-20s\n",
  275.             fonttable[c].tab[0],
  276.             fonttable[c].tab[1],
  277.             fonttable[c].tab[2],
  278.             fonttable[c].tab[3]);
  279.  
  280.         dumptables(be);
  281.         exit(0);
  282.     }
  283.  
  284.     resetState();
  285.     if (be->beprolog)
  286.         (*be->beprolog)();
  287.  
  288.     /* An Initialize sequence *usually* comes in first, but what the
  289.         hey ... */
  290.     xpos = 0;
  291.     ypos = -153;
  292.     escape = FORWARD;
  293.     lead = FORWARD;
  294.     half = LOWER;
  295.     rail = LOWER;
  296.     mag = LOWER;
  297.     tilt = DOWN;
  298.     calcfont;
  299.  
  300.     while ((c = getc(stdin)) != EOF) {
  301.         switch(c) {
  302.         case 0x00:
  303.             DBP((D_CAT,"NOP\n"));
  304.             break;
  305.         /* Flash (print character) codes */
  306.         case 0x01: case 0x02: case 0x03: case 0x04:
  307.         case 0x05: case 0x06: case 0x07: case 0x08:
  308.         case 0x09: case 0x0a: case 0x0b: case 0x0c:
  309.         case 0x0d: case 0x0e: case 0x0f: case 0x10:
  310.         case 0x11: case 0x12: case 0x13: case 0x14:
  311.         case 0x15: case 0x16: case 0x17: case 0x18:
  312.         case 0x19: case 0x1a: case 0x1b: case 0x1c:
  313.         case 0x1d: case 0x1e: case 0x1f: case 0x20:
  314.         case 0x21: case 0x22: case 0x23: case 0x24:
  315.         case 0x25: case 0x26: case 0x27: case 0x28:
  316.         case 0x29: case 0x2a: case 0x2b: case 0x2c:
  317.         case 0x2d: case 0x2e: case 0x2f: case 0x30:
  318.         case 0x31: case 0x32: case 0x33: case 0x34:
  319.         case 0x35: case 0x36: case 0x37: case 0x38:
  320.         case 0x39: case 0x3a: case 0x3b: case 0x3c:
  321.         case 0x3d: case 0x3e: case 0x3f:
  322.             /* This is terribly kludgey:
  323.                 In 432 units per inch, 4752 is 11 inches.
  324.                 When we go beyond this, we subtract 4752
  325.                 continually until we're back in range.
  326.             */
  327.             while (ypos >= pagelength) {
  328.                    ypos -= pagelength;
  329.                 DBP((D_CAT,"Page break\n"));
  330.                 if (be->bepage)
  331.                 (*be->bepage) ();
  332.             }
  333.             /*c = c&0x3f;    Isn't necessary */
  334.             /*    Find the C/A/T code */
  335.             if (half == UPPER) {
  336.                 if (c > 46) {
  337.                 fprintf(stderr, "%s: Illegal upper flash: %d\n",
  338.                     progname, c);
  339.                 exit(1);
  340.                 }
  341.                 nc = c + 62;
  342.             } else
  343.                 nc = c - 1;
  344.  
  345.             DBP((D_CAT,"nc=%d;pnts=%d;x,y=%d,%d;fnt=%d;\n",
  346.                 nc,points,xpos,ypos,font));
  347. #ifdef    VDEBUG
  348.             DBP((D_CAT,"  rail=%s;mag=%s;tilt=%s;half=%s\n",
  349.                 words[rail], words[mag],words[tilt], words[half]));
  350. #endif
  351.  
  352. #ifdef OPT
  353.             canoninsert(xpos, ypos, font, points, nc);
  354. #else
  355.             if (be->beputchar)
  356.                 (*be->beputchar)(xpos, ypos, font, points, nc,
  357.                 (char *) NULL);
  358. #endif
  359.  
  360.             break;
  361.         /* Control codes */
  362.         case 0x40:
  363.             DBP((D_CAT,"Initialize\n"));
  364.             xpos = 0;
  365.             ypos = -153;
  366.             escape = FORWARD;
  367.             lead = FORWARD;
  368.             half = LOWER;
  369.             rail = LOWER;
  370.             mag = LOWER;
  371.             tilt = DOWN;
  372.             calcfont;
  373.             break;
  374.         case 0x41:
  375.             DBP((D_CAT,"Rail lower\n"));
  376.             rail = LOWER;
  377.             calcfont;
  378.             break;
  379.         case 0x42:
  380.             DBP((D_CAT,"Rail upper\n"));
  381.             rail = UPPER;
  382.             calcfont;
  383.             break;
  384.         case 0x43:
  385.             DBP((D_CAT,"Mag upper\n"));
  386.             mag = UPPER;
  387.             calcfont;
  388.             break;
  389.         case 0x44:
  390.             DBP((D_CAT,"Mag lower\n"));
  391.             mag = LOWER;
  392.             calcfont;
  393.             break;
  394.         case 0x45:
  395.             DBP((D_CAT,"half lower\n"));
  396.             half = LOWER;
  397.             break;
  398.         case 0x46:
  399.             DBP((D_CAT,"half upper\n"));
  400.             half = UPPER;
  401.             break;
  402.         case 0x47:
  403.             DBP((D_CAT,"Escape forward\n"));
  404.             escape = FORWARD;
  405.             break;
  406.         case 0x48:
  407.             DBP((D_CAT,"Escape backward\n"));
  408.             escape = BACKWARD;
  409.             break;
  410.         case 0x49:
  411.             DBP((D_CAT,"STOP\n"));
  412.             break;
  413.         case 0x4a:
  414.             DBP((D_CAT,"Lead forward\n"));
  415.             lead = FORWARD;
  416.             break;
  417.         case 0x4b:
  418.             DBP((D_CAT,"Software cut!\n"));
  419.             break;
  420.         case 0x4c:
  421.             DBP((D_CAT,"Lead backward\n"));
  422.             lead = BACKWARD;
  423.             break;
  424.         case 0x4d:
  425. #ifdef    SPECIAL
  426. #define    SPSIZ    256
  427.             {
  428.                 static char specialbuf[SPSIZ], *sbp;
  429.                 sbp = specialbuf;
  430. #ifdef    OPT
  431.                 canonflush();
  432. #endif
  433.                 while((c = getc(stdin)) != EOF && c != '\n') {
  434.                 if (!c)    /* some troff's add NOP's when
  435.                        the internal output buffer is
  436.                        flushed */
  437.                     continue;
  438.                 if (sbp < &specialbuf[SPSIZ]-2)
  439.                 *sbp++ = c;
  440.                 }
  441.                 *sbp = '\0';
  442.  
  443.                 DBP((D_SPEC,"SPECIAL SEQUENCE: %s!\n", specialbuf));
  444.                 dospecial(specialbuf);
  445.                 break;
  446.             }
  447. #else
  448.             fprintf(stderr, "%s: Illegal C/A/T code - %s\n",
  449.                 progname, "special sequences are disabled");
  450.             exit(1);
  451. #endif
  452. #ifdef    BSDHACK
  453.         case 0x4e:
  454.             magnify_lead = 1;
  455.             break;
  456. #endif
  457. #ifdef    FONT8
  458.         case 0x4e:
  459.             DBP((D_CAT,"Tilt up\n"));
  460.             tilt = UP;
  461.             calcfont;
  462.             break;
  463.         case 0x4f:
  464.             DBP((D_CAT,"Tilt down\n"));
  465.             tilt = DOWN;
  466.             calcfont;
  467.             break;
  468. #endif
  469.  
  470.         /* Size changes */
  471.         case 0x50: case 0x51: case 0x52: case 0x53:
  472.         case 0x54: case 0x55: case 0x56: case 0x57:
  473.         case 0x58: case 0x59: case 0x5a: case 0x5b:
  474.         case 0x5c: case 0x5d: case 0x5e: case 0x5f:
  475.             /* basic code is the points = ptab[c] line.
  476.                The rest of the brain-damage is due to the
  477.                fact that switching from some of the fonts
  478.                to some of the others blow the horizontal
  479.                position - see the cat(5) manual page
  480.                about single vs. doubler point sizes. */
  481.             {    static lastc = 0;
  482.             c &= 0xf;
  483.             points = ptab[c];
  484.  
  485.             DBP((D_CAT,"SPoints:%d;lastc:%5d;c:%d;xpos:%d\n",
  486.                 points, lastc, c, xpos));
  487.             if (lastc <= 8 && c > 8) /* single -> doubler */
  488.                 xpos -= 55;
  489.             else if (lastc > 8 && c <= 8) /* doubler -> single */
  490.                 xpos += 55;
  491.  
  492.             DBP((D_CAT,"EPoints:%d;lastc:%5d;c:%d;xpos:%d\n",
  493.                 points, lastc, c, xpos));
  494.             lastc = c;
  495.             break;
  496.             }
  497.         /* Lead (vertical motion) codes */
  498.         case 0x60: case 0x61: case 0x62: case 0x63:
  499.         case 0x64: case 0x65: case 0x66: case 0x67:
  500.         case 0x68: case 0x69: case 0x6a: case 0x6b:
  501.         case 0x6c: case 0x6d: case 0x6e: case 0x6f:
  502.         case 0x70: case 0x71: case 0x72: case 0x73:
  503.         case 0x74: case 0x75: case 0x76: case 0x77:
  504.         case 0x78: case 0x79: case 0x7a: case 0x7b:
  505.         case 0x7c: case 0x7d: case 0x7e: case 0x7f:
  506.  
  507. #ifdef    OPT
  508.             canonflush();
  509. #endif
  510.  
  511.             DBP((D_CAT,"Lead(vertical) %02x\n", c&0x1f));
  512.             units = CTOINT(c,0x1f);
  513. #ifdef    BSDHACK
  514.             if (magnify_lead) {
  515.                 units *= 64;
  516.                 magnify_lead = 0;
  517.             }
  518. #endif
  519.             if (lead == FORWARD)
  520.                 ypos += 3*units;
  521.             else
  522.                 ypos -= 3*units;
  523.             break;
  524.         /* Escape (horizontal motion) codes */
  525.         case 0x80: case 0x81: case 0x82: case 0x83:
  526. #ifndef lint
  527.         case 0x84: case 0x85: case 0x86: case 0x87:
  528.         case 0x88: case 0x89: case 0x8a: case 0x8b:
  529.         case 0x8c: case 0x8d: case 0x8e: case 0x8f:
  530.         case 0x90: case 0x91: case 0x92: case 0x93:
  531.         case 0x94: case 0x95: case 0x96: case 0x97:
  532.         case 0x98: case 0x99: case 0x9a: case 0x9b:
  533.         case 0x9c: case 0x9d: case 0x9e: case 0x9f:
  534.         case 0xa0: case 0xa1: case 0xa2: case 0xa3:
  535.         case 0xa4: case 0xa5: case 0xa6: case 0xa7:
  536.         case 0xa8: case 0xa9: case 0xaa: case 0xab:
  537.         case 0xac: case 0xad: case 0xae: case 0xaf:
  538.         case 0xb0: case 0xb1: case 0xb2: case 0xb3:
  539.         case 0xb4: case 0xb5: case 0xb6: case 0xb7:
  540.         case 0xb8: case 0xb9: case 0xba: case 0xbb:
  541.         case 0xbc: case 0xbd: case 0xbe: case 0xbf:
  542.         case 0xc0: case 0xc1: case 0xc2: case 0xc3:
  543.         case 0xc4: case 0xc5: case 0xc6: case 0xc7:
  544.         case 0xc8: case 0xc9: case 0xca: case 0xcb:
  545.         case 0xcc: case 0xcd: case 0xce: case 0xcf:
  546.         case 0xd0: case 0xd1: case 0xd2: case 0xd3:
  547.         case 0xd4: case 0xd5: case 0xd6: case 0xd7:
  548.         case 0xd8: case 0xd9: case 0xda: case 0xdb:
  549.         case 0xdc: case 0xdd: case 0xde: case 0xdf:
  550.         case 0xe0: case 0xe1: case 0xe2: case 0xe3:
  551.         case 0xe4: case 0xe5: case 0xe6: case 0xe7:
  552.         case 0xe8: case 0xe9: case 0xea: case 0xeb:
  553.         case 0xec: case 0xed: case 0xee: case 0xef:
  554.         case 0xf0: case 0xf1: case 0xf2: case 0xf3:
  555.         case 0xf4: case 0xf5: case 0xf6: case 0xf7:
  556.         case 0xf8: case 0xf9: case 0xfa: case 0xfb:
  557.         case 0xfc: case 0xfd: case 0xfe:
  558. #endif
  559.  
  560.             units = CTOINT(c,0x7f);
  561.             if (escape == FORWARD)
  562.                 xpos += units;
  563.             else
  564.                 xpos -= units;
  565.             DBP((D_CAT,"ESC (hor): %02x\n", c&0x7f));
  566.             break;
  567.  
  568.         case 0xff:
  569.             DBP((D_CAT,"Illegal: %02x\n", c));
  570.             break;
  571.         }
  572.     }
  573. #ifdef    OPT
  574.     canonflush();
  575. #endif
  576.     if (be->bepage)
  577.         (*be->bepage)();
  578.     if (be->beepilog)
  579.         (*be->beepilog) ();
  580.     exit(0);
  581.     /* NOTREACHED */
  582. }
  583.  
  584. usage() {
  585.     fprintf(stderr, "usage: %s [-Ttype][-V]\n", progname);
  586.     fprintf(stderr, "  ... see troff2ps manpage for full description of %s\n",
  587.     OPTLIST);
  588. }
  589.  
  590. double
  591. calc(s)
  592. register char *s; {
  593.     double retval = 0.0;
  594.     char scale;
  595.     switch (sscanf(s, "%lf%c", &retval, &scale)) {
  596.     case 0:
  597.     case EOF:
  598.         retval = 0.0;
  599.     case 1:
  600.         retval *= TROFFRESOLUTION; /* default is inches */
  601.         break;
  602.     case 2:
  603.         switch(scale) {
  604.         default:
  605.             fprintf(stderr, "%s: bad scale %c\n", progname, scale);
  606.             retval = 0.0;
  607.         case 'i':
  608.             retval *= TROFFRESOLUTION;
  609.         case 'u':
  610.             break;
  611.         case 'c':
  612.             retval *= TROFFRESOLUTION * 50. / 127.;
  613.             break;
  614.         case 'P':
  615.             retval *= 72.;
  616.             break;
  617.         }
  618.         break;
  619.     }
  620.     return(retval);
  621. }
  622.  
  623. #ifdef    SPECIAL
  624.  
  625. dospecial(string)
  626. char *string; {
  627.     char buffer[512];
  628.     buffer[0] = '\0';
  629.  
  630.     DBP((D_SPEC,"Dospecial: (%d) %s\n", strlen(string), string));
  631.     while (*string)
  632.     switch(*string) {
  633.         case 'D':
  634.         if (be->bedraw)
  635.             (*be->bedraw)(specXPos, specYPos, string+1);
  636.         *string = '\0';
  637.         return;
  638.         case 'E':
  639.         fprintf(stderr, "%s\n", string+1);
  640.         *string = '\0';
  641.         return;
  642.         case 'P':
  643.         if (be->bepassthru)
  644.             (*be->bepassthru)(string+1);
  645.         else
  646.             printf("%s\n", string+1);
  647.         /* reset driver state! */
  648.         resetState();
  649.         *string = '\0';
  650.         return;
  651.         case 'S': {
  652.  
  653.             register FILE *fin;
  654.             register int rc, n;
  655.             char buf[BUFSIZ];
  656.             DBP((D_SPEC,"SYSTEM: %s\n", string+1));
  657.  
  658.             rc = -1;
  659.             n = 0;
  660.             fin = popen(string+1, "r");
  661.  
  662.             if (fin) {
  663.             while(rc = fread(buf, sizeof(char), BUFSIZ, fin)) {
  664.                 n += rc;
  665.                 fwrite(buf, sizeof(char), rc, stdout);
  666.             }
  667.             DBP((D_SPEC,"System: %d bytes read\n", n));
  668.             rc = pclose(fin);
  669.             }
  670.             if (!fin || rc) {
  671.             fprintf(stderr,
  672.                 "%s: SYSTEM request failed, command:\n  '%s'\n",
  673.                 progname, string+1);
  674.             exit(1);
  675.             }
  676.             /* reset driver state! */
  677.             resetState();
  678.             *string = '\0';
  679.             return;
  680.         }
  681.         case 'F':
  682.         if (be->befontsel)
  683.             (*be->befontsel)(*(string+1), string+2);
  684.         *string ='\0';
  685.         return;
  686. #ifdef    FORM
  687.         case 'L':
  688.         strcpy(buffer+2, string+1);
  689.         buffer[1] = '+';
  690.         *string = '\0';
  691.         string = buffer;
  692.         case 'O':
  693.         if (be->beoverlay)
  694.             (*be->beoverlay)(string+1);
  695.         *string = '\0';
  696.         return;
  697. #endif
  698.         case 'i':
  699.         strcpy(buffer, "b");
  700.  
  701.         case 'I':
  702.         strcat(buffer, "include ");
  703.         strcat(buffer, string+1);
  704.         interp(buffer, (be->bexlat && *string == 'F') ? be->bexlat:
  705.             FNULL, driver);
  706.         return;
  707.  
  708.         default:
  709.         fprintf(stderr, "%s: Illegal special sequence %s\n", progname, string);
  710.         return;
  711.     }
  712. }
  713.  
  714. #endif
  715.