home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume24 / psroff3.0 / part18 / t2conf.c < prev   
Encoding:
C/C++ Source or Header  |  1991-10-09  |  1.7 KB  |  91 lines

  1. /*
  2.     Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  3.         All Rights Reserved
  4.  
  5.     See the LICENSE file for a full description of restrictions under which
  6.     this software is provided.
  7.  
  8.     Function:        Switch for alternate backends.
  9.  */
  10.  
  11. #include "defs.h"
  12.  
  13. #ifndef    lint
  14. static char SCCSid[] =
  15.     "@(#)t2conf.c: 2.3 Copyright 91/02/20 09:06:48 Chris Lewis";
  16. #endif
  17.  
  18. #ifdef    PS
  19. #include "ps.h"
  20. #endif
  21.  
  22. #ifdef    LJ
  23. #include "lj.h"
  24. #endif
  25.  
  26. #ifdef    DT
  27. #include "dt.h"
  28. #endif
  29.  
  30. #ifndef    INSPECIAL
  31. #define    dtDraw    NULL
  32. #define    psDraw    NULL
  33. #endif
  34.  
  35. extern int FontSel();
  36.  
  37. /*    Common variables */
  38. int    pagePending = 1;
  39. int    currentPage = 0;
  40.  
  41. struct backend B[] = {
  42. /*   bename,    beprolog,    beepilog,    bechar,    bepage,    befontsel
  43.         beoverlay,    bepassthru,    bexlat, beDraw,
  44.         bestdfont,    besymfont */
  45.  
  46. #ifdef    PS
  47.     { "ps",    psProlog,    psEpilog,    psChar,    psPage,    FontSel,
  48.         psOverlay,    NULL,        psXlate, psDraw,
  49.         psStdFont,    psSymFont },
  50. #endif
  51.  
  52. #ifdef    DT
  53.     { "dt",    dtProlog,    dtEpilog,    dtChar,    dtPage,    FontSel,
  54.         NULL,        dtPassthru,    NULL, dtDraw,
  55.         dtStdFont,    dtSymFont },
  56. #endif
  57.  
  58. #ifdef    LJ
  59.     { "lj",    ljProlog,    ljEpilog,    ljChar,    ljPage,    FontSel,
  60.         NULL,        NULL,        NULL, NULL,
  61.         ljStdFont,    ljSymFont },
  62. #endif
  63.     { NULL }
  64. };
  65.  
  66.  
  67. getdriver(name)
  68. char *name; {
  69.  
  70.     be = BNULL;
  71.     if (B[0].bename == NULL) {
  72.     fprintf(stderr, "%s: No drivers configured!\n", progname);
  73.     exit(1);
  74.     }
  75.  
  76.     if (B[1].bename == NULL) {
  77.     if (strcmp(B[0].bename, name)) {
  78.         fprintf(stderr, "%s: Asked for driver '%s', only %s exists\n",
  79.         progname, name, B[0].bename);
  80.         exit(1);
  81.     }
  82.     be = &B[0];
  83.     return;
  84.     }
  85.     for (be = B; be->bename != NULL; be++)
  86.     if (strcmp(name, be->bename) == 0)
  87.         return;
  88.     fprintf(stderr, "%s: No driver called '%s' configured\n", progname, name);
  89.     exit(1);
  90. }
  91.