home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / ap / ghostscr / gs.c / gs.c.diff
Text File  |  1995-05-02  |  4KB  |  156 lines

  1. *** gs.c.org    Sun Oct 24 18:47:50 1993
  2. --- gs.c    Sun Oct 24 18:48:00 1993
  3. ***************
  4. *** 25,30 ****
  5. --- 25,31 ----
  6.   #include "string_.h"
  7.   /* Capture stdin/out/err before gs.h redefines them. */
  8.   #include <stdio.h>
  9. + #include <stdlib.h>
  10.   static FILE *real_stdin, *real_stdout, *real_stderr;
  11.   static void
  12.   get_real(void)
  13. ***************
  14. *** 108,116 ****
  15. --- 109,127 ----
  16.   private int quiet;
  17.   private int batch;
  18.   
  19. + /* Icky kludgy global flags */
  20. + char svgalib_detected = 0;
  21. + char video_resolution[25];
  22. + float size_multiplier = 1.0;
  23. + float adjust_xo = 0.0;
  24. + float adjust_yo = 0.0;
  25. + char xo_units = 'i';
  26. + char yo_units = 'i';
  27.   main(int argc, const char *argv[])
  28.   {    int argi;
  29.       char cstr[128];
  30. +     strcpy(video_resolution,"1024x768x256");
  31.       get_real();
  32.       gs_init0(real_stdin, real_stdout, real_stderr, argc);
  33.          {    char *lib = getenv(GS_LIB);
  34. ***************
  35. *** 204,209 ****
  36. --- 215,221 ----
  37.   private int
  38.   swproc(const char *arg)
  39.   {    char sw = arg[1];
  40. +         char optionbuf[20], *ptr;
  41.       arg += 2;        /* skip - and letter */
  42.       switch ( sw )
  43.          {
  44. ***************
  45. *** 296,301 ****
  46. --- 308,358 ----
  47.                  }
  48.              }
  49.           /* Enter the name in systemdict. */
  50. +         if (!strncmp(arg,"DEVICE=linux",12)) svgalib_detected = 1;
  51. +         if (svgalib_detected == 1) { 
  52. +             if (!strncmp(arg,"MAGSTEP=",8)) {
  53. +                 strcpy(optionbuf,arg);
  54. +                 ptr = optionbuf;
  55. +                         ptr += 8;
  56. +                         size_multiplier=atof(ptr);
  57. +                     }
  58. +             if (!strncmp(arg,"XO=",3)) {
  59. +                 strcpy(optionbuf,arg);
  60. +                 ptr = optionbuf;
  61. +                         ptr += 3;
  62. +                         adjust_xo=atof(ptr);
  63. +             ptr++;
  64. +             while (*ptr != 0) {
  65. +                 ptr++;
  66. +              }
  67. +             ptr--;
  68. +             if (*ptr == 'n') {
  69. +                   xo_units = 'i';
  70. +                 } else if (*ptr == 'm') {
  71. +                     xo_units = 'c';
  72. +             } else if (*ptr == '%') {
  73. +                 xo_units = '%';
  74. +             }
  75. +               }
  76. +             if (!strncmp(arg,"YO=",3)) {
  77. +                 strcpy(optionbuf,arg);
  78. +                 ptr = optionbuf;
  79. +                         ptr += 3;
  80. +                         adjust_yo=atof(ptr);
  81. +             ptr++;
  82. +             while (*ptr != 0) {
  83. +                 ptr++;
  84. +              }
  85. +             ptr--;
  86. +             if (*ptr == 'n') {
  87. +                   yo_units = 'i';
  88. +                 } else if (*ptr == 'm') {
  89. +                     yo_units = 'c';
  90. +             } else if (*ptr == '%') {
  91. +                 yo_units = '%';
  92. +             }
  93. +             }
  94. +         } 
  95.           initial_enter_string(arg, nlen, &value);
  96.           break;
  97.          }
  98. ***************
  99. *** 324,347 ****
  100.          }
  101.           break;
  102.       case 'r':            /* define device resolution */
  103. !        {    float xres, yres;
  104. !         ref value;
  105. !         gs_init1();
  106. !         switch ( sscanf((char *)arg, "%fx%f", &xres, &yres) )
  107. !            {
  108. !         default:
  109. !             puts("-r must be followed by <res> or <xres>x<yres>");
  110. !             gs_exit(1);
  111. !         case 1:            /* -r<res> */
  112. !             yres = xres;
  113. !         case 2:            /* -r<xres>x<yres> */
  114. !             make_real(&value, xres);
  115. !             initial_enter_name("DEVICEXRESOLUTION", &value);
  116. !             make_real(&value, yres);
  117. !             initial_enter_name("DEVICEYRESOLUTION", &value);
  118. !            }
  119.           break;
  120. !        }
  121.       case 'v':            /* print revision */
  122.           print_revision();
  123.           gs_exit(0);
  124. --- 381,410 ----
  125.          }
  126.           break;
  127.       case 'r':            /* define device resolution */
  128. !            if (svgalib_detected == 0) {
  129. !         {    float xres, yres;
  130. !             ref value;
  131. !             gs_init1();
  132. !             switch ( sscanf((char *)arg, "%fx%f", &xres, &yres) )
  133. !                {
  134. !             default:
  135. !                 puts("-r must be followed by <res> or <xres>x<yres>");
  136. !                 gs_exit(1);
  137. !             case 1:            /* -r<res> */
  138. !                 yres = xres;
  139. !             case 2:            /* -r<xres>x<yres> */
  140. !                 make_real(&value, xres);
  141. !                 initial_enter_name("DEVICEXRESOLUTION", &value);
  142. !                 make_real(&value, yres);
  143. !                 initial_enter_name("DEVICEYRESOLUTION", &value);
  144. !                }
  145. !                  break;
  146. !         }
  147. !            } else {
  148. !         strcpy(video_resolution,arg);
  149. !                 video_resolution[24] = 0;
  150.           break;
  151. !            }
  152.       case 'v':            /* print revision */
  153.           print_revision();
  154.           gs_exit(0);
  155.