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.
/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.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
"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
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar