home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2100 / t2conf.c < prev   
Encoding:
C/C++ Source or Header  |  1990-12-28  |  1.8 KB  |  94 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:        t2conf.c
  10.     Author:     Chris Lewis
  11.     Specs:        Switch for alternate backends.
  12.  */
  13.  
  14. #include "defs.h"
  15.  
  16. #ifndef    lint
  17. static char SCCSid[] =
  18.     "@(#)t2conf.c: 2.2 Copyright 90/08/10 15:27:22 Chris Lewis";
  19. #endif
  20.  
  21. #ifdef    PS
  22. #include "ps.h"
  23. #endif
  24.  
  25. #ifdef    LJ
  26. #include "lj.h"
  27. #endif
  28.  
  29. #ifdef    DT
  30. #include "dt.h"
  31. #endif
  32.  
  33. #ifndef    INSPECIAL
  34. #define    dtDraw    NULL
  35. #define    psDraw    NULL
  36. #endif
  37.  
  38. extern int FontSel();
  39.  
  40. /*    Common variables */
  41. int    pagePending = 1;
  42. int    currentPage = 0;
  43.  
  44. struct backend B[] = {
  45. /*   bename,    beprolog,    beepilog,    bechar,    bepage,    befontsel
  46.         beoverlay,    bepassthru,    bexlat, beDraw,
  47.         bestdfont,    besymfont */
  48.  
  49. #ifdef    PS
  50.     { "ps",    psProlog,    psEpilog,    psChar,    psPage,    FontSel,
  51.         psOverlay,    NULL,        psXlate, psDraw,
  52.         psStdFont,    psSymFont },
  53. #endif
  54.  
  55. #ifdef    DT
  56.     { "dt",    dtProlog,    dtEpilog,    dtChar,    dtPage,    FontSel,
  57.         NULL,        dtPassthru,    NULL, dtDraw,
  58.         dtStdFont,    dtSymFont },
  59. #endif
  60.  
  61. #ifdef    LJ
  62.     { "lj",    ljProlog,    ljEpilog,    ljChar,    ljPage,    FontSel,
  63.         NULL,        NULL,        NULL, NULL,
  64.         ljStdFont,    ljSymFont },
  65. #endif
  66.     { NULL }
  67. };
  68.  
  69.  
  70. getdriver(name)
  71. char *name; {
  72.  
  73.     be = BNULL;
  74.     if (B[0].bename == NULL) {
  75.     fprintf(stderr, "%s: No drivers configured!\n", progname);
  76.     exit(1);
  77.     }
  78.  
  79.     if (B[1].bename == NULL) {
  80.     if (strcmp(B[0].bename, name)) {
  81.         fprintf(stderr, "%s: Asked for driver '%s', only %s exists\n",
  82.         progname, name, B[0].bename);
  83.         exit(1);
  84.     }
  85.     be = &B[0];
  86.     return;
  87.     }
  88.     for (be = B; be->bename != NULL; be++)
  89.     if (strcmp(name, be->bename) == 0)
  90.         return;
  91.     fprintf(stderr, "%s: No driver called '%s' configured\n", progname, name);
  92.     exit(1);
  93. }
  94.