home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-Online 1996 May
/
PCOnline_05_1996.bin
/
linux
/
source
/
ap
/
ghostscr
/
gs.c
/
gs.c.diff
Wrap
Text File
|
1995-05-02
|
4KB
|
156 lines
*** gs.c.org Sun Oct 24 18:47:50 1993
--- gs.c Sun Oct 24 18:48:00 1993
***************
*** 25,30 ****
--- 25,31 ----
#include "string_.h"
/* Capture stdin/out/err before gs.h redefines them. */
#include <stdio.h>
+ #include <stdlib.h>
static FILE *real_stdin, *real_stdout, *real_stderr;
static void
get_real(void)
***************
*** 108,116 ****
--- 109,127 ----
private int quiet;
private int batch;
+ /* Icky kludgy global flags */
+ char svgalib_detected = 0;
+ char video_resolution[25];
+ float size_multiplier = 1.0;
+ float adjust_xo = 0.0;
+ float adjust_yo = 0.0;
+ char xo_units = 'i';
+ char yo_units = 'i';
+
main(int argc, const char *argv[])
{ int argi;
char cstr[128];
+ strcpy(video_resolution,"1024x768x256");
get_real();
gs_init0(real_stdin, real_stdout, real_stderr, argc);
{ char *lib = getenv(GS_LIB);
***************
*** 204,209 ****
--- 215,221 ----
private int
swproc(const char *arg)
{ char sw = arg[1];
+ char optionbuf[20], *ptr;
arg += 2; /* skip - and letter */
switch ( sw )
{
***************
*** 296,301 ****
--- 308,358 ----
}
}
/* Enter the name in systemdict. */
+ if (!strncmp(arg,"DEVICE=linux",12)) svgalib_detected = 1;
+ if (svgalib_detected == 1) {
+ if (!strncmp(arg,"MAGSTEP=",8)) {
+ strcpy(optionbuf,arg);
+ ptr = optionbuf;
+ ptr += 8;
+ size_multiplier=atof(ptr);
+ }
+ if (!strncmp(arg,"XO=",3)) {
+ strcpy(optionbuf,arg);
+ ptr = optionbuf;
+ ptr += 3;
+ adjust_xo=atof(ptr);
+ ptr++;
+ while (*ptr != 0) {
+ ptr++;
+ }
+ ptr--;
+ if (*ptr == 'n') {
+ xo_units = 'i';
+ } else if (*ptr == 'm') {
+ xo_units = 'c';
+ } else if (*ptr == '%') {
+ xo_units = '%';
+ }
+ }
+ if (!strncmp(arg,"YO=",3)) {
+ strcpy(optionbuf,arg);
+ ptr = optionbuf;
+ ptr += 3;
+ adjust_yo=atof(ptr);
+ ptr++;
+ while (*ptr != 0) {
+ ptr++;
+ }
+ ptr--;
+ if (*ptr == 'n') {
+ yo_units = 'i';
+ } else if (*ptr == 'm') {
+ yo_units = 'c';
+ } else if (*ptr == '%') {
+ yo_units = '%';
+ }
+ }
+ }
initial_enter_string(arg, nlen, &value);
break;
}
***************
*** 324,347 ****
}
break;
case 'r': /* define device resolution */
! { float xres, yres;
! ref value;
! gs_init1();
! switch ( sscanf((char *)arg, "%fx%f", &xres, &yres) )
! {
! default:
! puts("-r must be followed by <res> or <xres>x<yres>");
! gs_exit(1);
! case 1: /* -r<res> */
! yres = xres;
! case 2: /* -r<xres>x<yres> */
! make_real(&value, xres);
! initial_enter_name("DEVICEXRESOLUTION", &value);
! make_real(&value, yres);
! initial_enter_name("DEVICEYRESOLUTION", &value);
! }
break;
! }
case 'v': /* print revision */
print_revision();
gs_exit(0);
--- 381,410 ----
}
break;
case 'r': /* define device resolution */
! if (svgalib_detected == 0) {
! { float xres, yres;
! ref value;
! gs_init1();
! switch ( sscanf((char *)arg, "%fx%f", &xres, &yres) )
! {
! default:
! puts("-r must be followed by <res> or <xres>x<yres>");
! gs_exit(1);
! case 1: /* -r<res> */
! yres = xres;
! case 2: /* -r<xres>x<yres> */
! make_real(&value, xres);
! initial_enter_name("DEVICEXRESOLUTION", &value);
! make_real(&value, yres);
! initial_enter_name("DEVICEYRESOLUTION", &value);
! }
! break;
! }
! } else {
! strcpy(video_resolution,arg);
! video_resolution[24] = 0;
break;
! }
case 'v': /* print revision */
print_revision();
gs_exit(0);