=================================================================== *** athena.c Wed Mar 19 10:54:52 1997 --- athena.c Wed May 11 03:12:22 1994 *************** *** 0 **** --- 1,53 ---- + /* + * $Header: /afs/athena.mit.edu/astaff/project/newtex/src/dvips/RCS/athena.c,v 1.2 94/05/11 03:11:31 bert Exp $ + * + * local Athena hacks for dvips + */ + + #include "dvips.h" + #include + + extern char *newstring(char*); /* duplicate string */ + extern char *printer; /* what printer to send this to? */ + + char *pipe_str (pstr) + char *pstr; + { + char pipe[128]; + char *p; + int i, j; + + for (p=pstr, i=0; *p && i<127; p++) { + if (*p=='%') { + p++; + switch(*p) { + case 'P': + if (printer) { + if ((i+2) < 127) strcpy(pipe+i, "-P"); + i += 2; + } + case 'p': + if (printer) { + j = strlen(printer); + if ((i+j) < 127) strcpy(pipe+i, printer); + i += j; + } + break; + case '%': + if ((i+1) < 127) *(pipe+(i++)) = '%'; + break; + default: + if ((i+2) < 127) { + *(pipe+(i++)) = '%'; + *(pipe+(i++)) = *p; + } + fprintf(stderr,"Unknown option %%%c in pk path\n",*p); + } + } + else + pipe[i++] = *p; + } + pipe[i] = '\0'; + + return newstring(pipe); + } =================================================================== *** athena.h Wed Mar 19 10:54:52 1997 --- athena.h Fri Feb 25 06:35:07 1994 *************** *** 0 **** --- 1,7 ---- + /* + * $Header: /afs/athena.mit.edu/astaff/project/newtex/src/dvips/RCS/athena.h,v 1.1 94/02/25 06:35:03 bert Exp $ + * + * local Athena hacks for dvips + */ + + extern char *pipe_str (char*); =================================================================== RCS file: RCS/config.ps,v retrieving revision 1.1 diff -wc -r1.1 config.ps *** config.ps 1994/02/23 21:03:31 1.1 --- config.ps 1994/02/25 11:34:28 *************** *** 1,20 **** * ! * See config.lino for more info. * With a virtual machine, we can claim 1M of memory. * m 1000000 * * And send output by default to the printer. * ! o !lpr * * Default resolution. * ! D 400 * * Last resort sizes. * ! R 100 120 144 300 360 400 432 480 * * Paper size information. First definition is the default. * --- 1,21 ---- + * $Header: /afs/athena.mit.edu/astaff/project/newtex/src/dvips/RCS/config.ps,v 1.2 94/02/25 06:34:21 bert Exp $ * ! * See dvips.tex for more info. * With a virtual machine, we can claim 1M of memory. * m 1000000 * * And send output by default to the printer. * ! o !lpr %P * * Default resolution. * ! D 600 * * Last resort sizes. * ! R 300 329 360 432 518 600 622 657 720 746 864 1037 1244 1493 * * Paper size information. First definition is the default. * =================================================================== RCS file: RCS/dvips.c,v retrieving revision 1.1 diff -wc -r1.1 dvips.c *** dvips.c 1994/02/25 05:04:34 1.1 --- dvips.c 1994/02/25 11:30:16 *************** *** 6,11 **** --- 6,12 ---- #endif #include "dvips.h" /* The copyright notice there is included too! */ + #include "athena.h" #ifndef SYSV extern char *strtok() ; /* some systems don't have this in strings.h */ #endif *************** *** 820,825 **** --- 821,834 ---- } } while (queryoptions != 0) ; #endif + + /* pipe_str() is a local hack that replaces %-sequences with + * appropriate strings. This is the magic that makes printer + * selection work without configuration files. + * -- bert 02/25/94 + */ + oname = pipe_str(oname); + checkenv(1) ; /* * The logic here is a bit convoluted. Since all `additional' =================================================================== RCS file: RCS/resident.c,v retrieving revision 1.1 diff -wc -r1.1 resident.c *** resident.c 1994/02/23 22:39:39 1.1 --- resident.c 1994/02/25 11:32:13 *************** *** 613,620 **** } (void)fclose(deffile) ; } else { ! if (printer) ! error("! no such printer (can't find corresponding config file)") ; } } --- 613,624 ---- } (void)fclose(deffile) ; } else { ! /* Normally, dvips refuses to deal with -P option unless there is ! * a "config.printername" file for every printer. ! * That would be a bad idea on Athena. ! * (Some magic is needed elsewhere to make it work.) ! * -- bert 02/25/94 ! */ } }