This article is from a FAQ concerning SCO operating
systems. While some of the information may be applicable to any OS,
or any Unix or Linux OS, it may be specific to SCO Xenix, Open
Desktop or Openserver.
There is lots of Linux, Mac OS X and general Unix info elsewhere on
this site: Search this site is the best
way to find anything.
Much of the printer information here makes references to "interface scripts". Some people call them "printer drivers" (they aren't). These scripts are what controls what happens to your print job as it goes to the printer.
Understand that Unix printing is very different than Windows printing. Windows apps are very dumb about printing, and depend upon the printing system to know all about the nitty gritty details. Unix printing takes the opposite approach: the printing system knows nothing about printers at all. Your only chance outside of the application itself to affect what happens is in the interface script.
The scripts are found in /usr/spool/lp/admins/lp/interfaces (or /var/spool/lp/admins/lp/interfaces on modern systems, though the "old" path will still work). You will find that each of the printers listed by lpstat will have a script here, and the names will be the same as the name of the printers.
Note that if you are using HP JetDirect printers, the script will be there, but the actual script you want to modify is in the sub-directory "model.orig".
If you are using Unixware, you might find Unixware HP JetDirect Printing by Jason Dale helpful.
To make changes to interface scripts permanent, you want to make the same changes in the model script that was used to create the printer. The model scripts are usually in /usr/spool/lp/model, but it's possible for a printer to get its script from anywhere, so it's best to check. You can look in /usr/spool/lp/admins/lp/printers where you will find a sub-directory for each printer you have. Within that sub-directory is the file "configuration", and you can "cat configuration" to see where the script originated.
If you want your script changes to survive upgrades, copy them to a new name in /usr/spool/lp/model, and change the configuration file to reflect this, either by setting the model in the Printer Manager or by directly editing /usr/spool/lp/admins/lp/printers/yourprinter/configuration.
The scripts get called by lpsched when the printer is ready to accept data (your lp command just created files in /usr/spool/lp/temp; see How can I get the file from the print spooler before it prints? ). The script gets passed the print job number, the user who submitted the job, a title (seldom used- it's the "-t" option to lp) , the number of copies, any options, and finally all the files to be printed. This means that the interface will always see at least 6 arguments. The lpsched programs sets stdout to point to the device the printer uses, so the interface script doesn't have to deal with that at all. A simplistic script could just do this:
shift; shift; shift; shift; shift
# throw away everything but the file names
cat $*
Most scripts offer more features than that, of course.
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 4 | 21 | 98 | 1,806 | 4,852 |
/SCOFAQ/FAQ_scotec7interfacescript.html copyright 1997-2003 (various) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
FAQScoTecSeveninterfacescript :
"shift; shift; shift; shift; shift"
You could also say shift 5.
-BigDumbDinosaur
---December 12, 2004
Yes, you can. But I like to spell these things out so they are more obvious to everyone. I'm not a fan of clever coding, shortcut tricks and all: I like straightforward, very obvious code. You could argue that "shift 5" is just as obvious, but I just don't think it is..
--TonyLawrence
Add your comments