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.

Printing FAQ

What are printer interface scripts?

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.


Hate these ads?

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.


Technorati tags:  

Comments /SCOFAQ/FAQ_scotec7interfacescript.html
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

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner





Views for this page
Today This Week This Month This Year  Overall
150122918 3,964

/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.

Publishing your articles here

More:
       - FAQ




Unix/Linux Consultants


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.


http://www.cleverminds.net Need expert advice? Want a second opinion? CleverMinds is a one-stop-shop for a wide range of technology solutions. We support Unix, Linux, SCO as well as CMS, ecom, blogs, podcasts, search engines consulting and more. Contact us at web2.0@cleverminds.net 0r (617) 894-1282


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


Twitter
  • May 16 08:08
    My tea tastes like chlorine. I dumped it out, tried just the teawater. That's fine. Why does my tea taste like chlorine?
  • May 16 07:31
    Have stayed away from the gym most of the week - my neck is feeling better.









Change Congress

Related Posts