Xref: utzoo comp.dcom.lans:8429 comp.periphs.printers:1343 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!mimsy!oasys!relay.nswc.navy.mil!neptune!rchui From: rchui@neptune.nswc.navy.mil (Chui) Newsgroups: aus.computers,comp.dcom.lans,comp.periphs.printers Subject: Re: Laser Printing in a Student Lab Environment Message-ID: <1991Jun20.130225.7752@relay.nswc.navy.mil> Date: 20 Jun 91 13:02:25 GMT References: <1991Jun20.110938.30701@qut.edu.au> Sender: news@relay.nswc.navy.mil (0000-Admin(0000)) Reply-To: rchui@neptune.nswc.navy.mil (Chui) Organization: Naval Surface Warfare Center, Dahlgren VA Lines: 92 3. How does the IIIsi behave in a mixed environment (Macs and PC's)? Can it switch between postscript and HPGL automatically? --------------------------------------------------------------------------- I am really interesting this question. I have installed a PostScript cartridge in HP LaserJet III. I am try to write a output filter file in C for my Sun3 os 4.0 system. This output file performed: 1) chech if there any print job on tty## printer port? 2) check if that print file is a postscript file? (this is option) 3) if no print job and is a postscript file, then sent signal to printer to switch to PostScript mode, print postscript file. 4) Reset to PCL mode. Here is my C code. After I compiled the file, and modify the /etc/printcap file. I try to print by "lpr -h -Pprintername filename". where -h is suppress the burst page which is not in postscript code. This program is work to detect the print jobs and set signal to switch to postscript mode, after that the printer just do nothing, the postscript file never print. But when run this program by input a file("ofps < filename), it works fine, it works everything what I want! Is there anyone out there know why is that? #include #include #include #include char *SD="/usr/spool/lpd/hplp"; main(argc,argv) int argc; char *argv[]; { register char *cp; register int ch; /* 'of' filters are only passed width and length arguments from lpd */ while (--argc) { if (*(cp = *++argv) == '-' ) { switch (cp[1]) { case 'w': /* this filter does nothing with width */ break; case 'l': /* this filter does nothing with length */ break; } } } while (checkq()) /* If there any print job on tty## port? */ system("sleep 20"); printf("\033&l1057.32259J"); /* reset and switch to PCL */ (void) fflush(stdout); system("sleep 50"); /* printer takes 45 sec to reset */ printf("\033&l5257.1058J"); /* to PS mode */ (void) fflush(stdout); system("sleep 50"); while ((ch=getchar()) != EOF) { putchar(ch); } exit(0); } int checkq() { register struct direct *d; DIR *dirp; int nitems=0; if ((dirp = opendir(SD)) == NULL) /* open the lpq directory */ return(-1); while ((d = readdir(dirp)) != NULL) /* list the files */ if (d->d_name[0] == 'c' && d->d_name[1] == 'f') nitems++; /* If there are files begin with "cf" print jobs */ closedir(dirp); return(nitems); }