home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / wizards / 5301 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  3.2 KB

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