home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!spool.mu.edu!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.wizards
- Subject: Printers (was Re: /dev)
- Date: 22 Dec 1992 00:41:33 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 56
- Message-ID: <1h5o7tINNact@early-bird.think.com>
- References: <1h3m36INNd4l@usenet.INS.CWRU.Edu>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1h3m36INNd4l@usenet.INS.CWRU.Edu> cq377@cleveland.Freenet.Edu (David C. Williss) writes:
- > 1. Should I look at the /etc/printcap file to find printers?
-
- Yes.
-
- > Assuming that somebody at the user's site is compatent
- > (bad assumption) they would just have to setup printcap
-
- If they haven't setup printcap, then they can't use the printers they have
- connected to the system. The fact that your one application can't use the
- printers is just a minor component of that problem (unless you're assuming
- that they purchased the systems just to run your application).
-
- > The problems here are 1. Based on past experience, I can't
- > assume they know what their doing. 2. Seems not all flavors
- > of unix use /etc/printcap. (We're supporting multiple platforms)
-
- You'll need to find out what other systems use instead of /etc/printcap,
- and conditionalize your code.
-
- > 2. How do I print to a remote printer. I suppose I could fork
- > and exec lpr. Is that the reccomended method?
-
- Or "lp" on systems that have it instead. That's usually the correct way to
- print to *any* printer. On many Unix systems, the spooler process opens
- the device file permanently, so ordinary processes can't write to it
- directly.
-
- You should provide a configuration option to let you change the command
- that's used. Some sites have custom interfaces to printers.
-
- > 3. For the sake of argument, lets say I ignore printcap and let the
- > user select printer driver/port from within my program. Is
- > there any way to tell which special files in /dev are ports
- > and which aren't? Every book I've read talks about "conventional"
- > names, but every implementation seems to have its own ideas
- > as what to name them. I want to avoid confusing the user by
- > showing such things as /dev/rroot.
-
- I don't think there's any general way to tell. /dev/tty00 is a terminal if
- there's a terminal connected to it, but a printer if there's a printer
- connected to it. There's no way to tell just by looking in /dev -- you
- need to look in the machine room. And network printers don't have any
- corresponding name in /dev. And even if you do determine that a device is
- a printer, the name in /dev is unlikely to be meaningful to the user.
- Users are used to the names that they can give to the lpr or lp commands,
- which might be the type of printer (e.g. "laser"), the location ("lw2" for
- the LaserWriter on the 2nd floor), the department name, or some cute name
- (we name all our printers after newspapers -- this is so obvious that I'm
- sure there are many others). Showing an unsuspecting use names like "ttya"
- or "tty00" is likely to be very confusing.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-