Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!ncar!midway!ellis.uchicago.edu!wer5 From: wer5@ellis.uchicago.edu (Will E. Rose) Newsgroups: comp.windows.ms Subject: Re: Printing Uploaded Windows Postscript files from Unix 4.3bsd?? Message-ID: <1991Apr20.181504.699@midway.uchicago.edu> Date: 20 Apr 91 18:15:04 GMT References: <41541@netnews.upenn.edu> <1991Apr20.082038.21633@agate.berkeley.edu> Sender: news@midway.uchicago.edu (NewsMistress) Organization: University of Chicago Lines: 98 Here's the story: First off, Windows puts a ^D at the start of a file, and Unix chokes on this, as well as any ^D in the file. It must be deleted. Also, the first line must be a %! all alone (Apple seems to prefer it that way). We have written a small program that will play this little game for you. It will run under Unix or DOS. Individuals may feel free to use this program. _ANY_ organization or institution must contact the authors first at wer5@midway.uchicago.edu. Questions/comments to me. Will E. Rose User Support Chair University of Chicago Computing Organizations Academic and Public Computing wer5@midway.uchicago.edu Here's the code: /* PSFIX - Will patch a postscript file for proper printing by adding '%!' at the top of the file, and by eliminating any nulls and control-d's in the file. This patching is necessary when printing to Apple Print Servers via LocalTalk, or when printing postscript to a file from MicroSoft Windows 3.0. Authors: Amish S. Dave and Will E. Rose User Support User Support Chair University of Chicago University of Chicago Computing Organizations Computing Organizations GSB Computing Services asd2@midway.uchicago.edu wer5@midway.uchicago.edu wer5@gsbsun.uchicago.edu */ /* This program is copyrighted by the authors. It may be distributed in its unmodified form among individuals. Permission must be obtained for use by corporations or organizations of any kind, including educational institutions, from the authors. Contact: wer5@midway.uchicago.edu */ #include main (argc, argv) int argc; char *argv[]; { FILE *in, *out; int c; int c1,c2,c3; if (argc != 3) { fprintf (stderr, "Improper command syntax:\n"); fprintf (stderr, "Proper Entry: psfix infile outfile\n"); exit (1); } if ( (in = fopen (argv[1], "r")) == (FILE *) NULL) printf ("Couldn't open %s for reading.\n", argv[1]); else if ( (out = fopen (argv[2], "w")) == (FILE *) NULL ) printf ("Couldn't open %s for writing.\n", argv[2]); else { c1 = getc (in); c2 = getc (in); c3 = getc (in); if (c1 != (int) '%' || c2 != (int) '!' || c3 != (int) '\n') { putc ('%',out); putc ('!',out); putc ('\n',out); } if (c1 != 0 && c1 != 4) putc (c1,out); putc (c2,out); putc (c3,out); while ( (c = getc (in)) != EOF ) { if (c != 0 && c != 4) putc (c,out); } fclose (in); fclose (out); printf ("%s has been fixed and saved as %s.\n",argv[1],argv[2]); exit (0); } }