[comp.sys.sgi] man -t to lpr

sims@cam.nist.gov (Jim Sims) (10/11/90)

I have recently discovered the -t option to man, for typesetting
man pages and sending to a printer. I am running 3.3.1 and using
lpr rather than lp, hence the problem. man -t sends to lp; I
want to be able to send to lpr. Anyone know how to do this? 
According to the man page, *.z files are unpacked using pcat
and then sent to the named printer. Presumably there is more
processing than that going on. If I knew exactly what man does,
I could write a small script to do the job.

Thanks in advance.

-----------------------------------------------------------------------
NAME:   James S. Sims                    TELE: (301) 975-2710
USMAIL: National Institute of Standards and Technology
(formerly National Bureau of Standards)  ARPA,BITNET: sims@enh.nist.gov
        Bldg. 225 Room B-146               
	Gaithersburg, MD  20899

karron@MCIRPS2.MED.NYU.EDU (10/13/90)

Jim Simms (sims@enh.nist.gov) writes:

>I have recently discovered the -t option to man, for typesetting
>man pages and sending to a printer. I am running 3.3.1 and using
>lpr rather than lp, hence the problem. man -t sends to lp; I
>want to be able to send to lpr. Anyone know how to do this?
>According to the man page, *.z files are unpacked using pcat
>and then sent to the named printer. Presumably there is more
>processing than that going on. If I knew exactly what man does,
>I could write a small script to do the job.

I don't know how to fix the man binary.

I also don't know why sgi (or ATT) made the man program into a compiled
binary, leaving us without the source.  In the old days the man command was a
script that could be fixed/hacked to local taste.  I think that the lack of
man page sources, and the inability of the man system to format man pages
without nroff, and the whole catman compiled man page system is an attempt on
the part of ATT to limit access of users to unix and protect its distribution
from local disturbance.  This is entirely contrary to the sprit of unix, and I
have complained to sgi to look into ways it can open up the man system
so that you can directly use it for what it was intended,
not as a barrier to protect the ATT distribution.

If there was an additional material that sgi should put in the 4Dgifts, AWF,
TeX (binarys), and the "Man" system (even a local shell script) are my
nominations.

+-----------------------------------------------------------------------------+
| karron@nyu.edu                          Dan Karron                          |
| . . . . . . . . . . . . . .             New York University Medical Center  |
| 560 First Avenue           \ \    Pager <1> (212) 397 9330                  |
| New York, New York 10016    \**\        <2> 10896   <3> <your-number-here>  |
| (212) 340 5210               \**\__________________________________________ |
| Please Note :Soon to move to dan@karron.med.nyu.edu 128.122.135.3  (Mid Oct)|
+-----------------------------------------------------------------------------+

ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) (10/13/90)

In article <9010121941.AA00328@mcirps2.med.nyu.edu>, karron@MCIRPS2.MED.NYU.EDU writes:
|> Jim Simms (sims@enh.nist.gov) writes:
|> 
|> >I have recently discovered the -t option to man, for typesetting
|> >man pages and sending to a printer. I am running 3.3.1 and using
|> >lpr rather than lp, hence the problem. man -t sends to lp; I
|> >want to be able to send to lpr. Anyone know how to do this?
|> >According to the man page, *.z files are unpacked using pcat
|> >and then sent to the named printer. Presumably there is more
|> >processing than that going on. If I knew exactly what man does,
|> >I could write a small script to do the job.
|> 
|> I don't know how to fix the man binary.
|> 
|> I also don't know why sgi (or ATT) made the man program into a compiled
|> binary, leaving us without the source.  In the old days the man command was a
|> script that could be fixed/hacked to local taste.

The old man command was a very slow AT&T shell script which could take up to
12 seconds to find a manual page (or no man page).  Customers and internal
users alike complained that this was way too slow.  We replaced the shell
script with binary modelled on the features of the AT&T, Sun and BSD man
commands. (BTW, the Sun and BSD man commands are also binaries, not shell
scripts.) Performance increased to a typical 2 seconds to lookup a man page
(or tell you none were found).  From the perspective of browsing online
manual pages, you could browse many more manual pages with the new command
than the old script, especially if you mistyped the name of the manual page
you wanted.

The reason for the significant speed up is that the man script was based
on find(1) which is rather slow at finding files.  The man command uses
a more sophisticated algorithm for scanning directories for manual pages.

In case of NFS mounted manual page directories, the new binary man command
far exceeds the capabilities of the old man script.  In some situations,
the man script could take minutes to find a manual page or exhaustively
search the directories to inform you that none were found.  The new man
executable takes much less time because of the search algorithm.

New executable programs like xman can provide even faster browsing of
manual pages as they can cache lookup information and provide pretty
display of the manual pages.  Of course, it's not a shell script either
though sources may be available.

With large libraries of online documentation like X man pages, GL man pages,
and libc man pages, not to mention all of the add on user level man pages,
I personally appreciate being able to rapidly browse online manual pages.

						--- Ciemo

slevy@klein.geom.umn.edu (Stuart Levy) (10/14/90)

I also am glad that SGI replaced the sluggish "man" shell script with a
speedy "man" binary.  Anyone wanting more control can still get it:
with the "-w" option man prints just the pathnames of the man-pages it finds,
so you could easily write a script to process those files as desired.

    Stuart Levy, Geometry Group, University of Minnesota
    slevy@geom.umn.edu

sims@cam.nist.gov (Jim Sims) (10/14/90)

First of all, thanks to all who have responded. Since all
responses have been to this newsgroup, I don't think I need
to summarize. 

I still haven't found the solution I'm looking for, so let
me try to restate what I want to do: 

IF I had lp set up, man -t would give me very beautiful troff 
formatted man pages output to a postscript printer on the 
network. I have all of the requisite nroff/troff/psroff etc 
software (Documentor's Workbench Option and LaserWriter Option).
However, I don't want to use lp. It seems to me that the
whole point of the 3.3 lpr implementation is that I should be
able to use lpr instead of lp. However, I think I have discovered
a "fly-in-the-ointment". man -t outputs to the default
lp printer, with no apparent way to change this to have
it output to the default lpr printer. I have been looking
at man on our Suns and the Suns have an environment variable,
TCAT, which would let me do exactly what I want to do. The TCAT
environment variable specifies "The name of the program to use
to display troffed manual pages.  If not set, `lpr -t'
is used. If SGI had this envrionment variable, I could do a
		setenv TCAT 'lpr -t'
and this would give me what I want:  man -t's troff binaries
would be piped to lpr with the appropriate flag set so that
everything would magically come out right on the postscript
printer (I think). The TCAT environment variable seems like
a good idea, since it adds flexibility, so, SGI, please add
in a future release. Without this environment variable, can
anyone see how to do the same thing? 

Incidentally, I've also discovered a neat feature in catman
on the suns. I realize that catman isn't really relevant here,
since we are shipped the results of catman. However, catman
has a -p option for "tell me what you are going to do, rather
than doing i"t. One line of the output of catman -p l is
nroff -Tlpr -man manl/plt.l > catl/plt.l
If the man command on the SGI's had a similar -p option,
telling me what it does to those *.z files (or if someone
else can tell me), then perhaps I could write a simple script.


-----------------------------------------------------------------------
NAME:   James S. Sims                    TELE: (301) 975-2710
USMAIL: National Institute of Standards and Technology
(formerly National Bureau of Standards)  ARPA,BITNET: sims@enh.nist.gov

jim@baroque.Stanford.EDU (James Helman) (10/14/90)

   IF I had lp set up, man -t would give me very beautiful troff
   formatted man pages output to a postscript printer on the network.

I don't believe it would be all THAT beautiful (unless lp(1) is
smarter than I think).  By the time the nroff source has been
formatted into /usr/catman/*/cat1/foo.z, it has lost all the nice
formatting information: bold has been converted to <character>
<backspace> <character>, emphasis has been converted to <underline>
<backspace> <character>.  more(1) is nice enough to display this
gibberish as highlighted text on most terminals or emulators.

If you want nice bold and italics in your hardcopy man pages, your
best bet would probably be xeroxing pages from the hardcopy manual.
;-} However, doing so could violate the copyright notice in the
manuals.  SIDE NOTE: SGI's copyright notice not only forbids
duplication but also calls the manuals' contents "proprietary and
confidential information of SGI" and bars you from dislosing it to
third parties!!!!  SHHH!!!!  Don't tell anyone about lp(1) ;-).

Is that silly, or what?  Another AT&Tism?

Jim Helman
Department of Applied Physics			Durand 012
Stanford University				FAX: (415) 725-3377
(jim@KAOS.stanford.edu) 			Work: (415) 723-9127

"We break windows right." 			ctrl-shift-f12-/

sims@cam.nist.gov (Jim Sims) (10/15/90)

Jim Helman writes:
>>In-reply-to: sims@cam.nist.gov's message of 13 Oct 90 23:29:08 GMT
>>
>>   IF I had lp set up, man -t would give me very beautiful troff
>>   formatted man pages output to a postscript printer on the network.
>>
>>I don't believe it would be all THAT beautiful (unless lp(1) is
>>smarter than I think).  By the time the nroff source has been
>>formatted into /usr/catman/*/cat1/foo.z, it has lost all the nice
>>formatting information: bold has been converted to <character>
>><backspace> <character>, emphasis has been converted to <underline>
>><backspace> <character>.  more(1) is nice enough to display this
>>gibberish as highlighted text on most terminals or emulators.

I see your point, and thanks for educating me. I'm now using

	man topic | ul -t printer | lpr

for getting printed copies of on-line man pages. Scott Presnell
had suggested man topic | col -b | lpr but that removes the
underlining which ul with the -t printer option preserves
(at least to the postscript printer I'm using).

As Jim Helman has pointed out, the formatting that 
        man topic | ul -t printer | lpr
produces is the best that one can get with preformatted man
pages. But I also have local unformatted additions to the
man pages, and all of the nroff/troff/psroff packages, so
man -t should give me very beautiful troff formatted man pages
output to a postscript printer on the network (It does on the
Suns!) SO my original question still stands: How do I send 
the output of man -t to lpr?  :=) The answer to that question
may very well be an SGI implementation (I can wait) of something
like the Sun TCAT environment variable mentioned in my last
posting.

Again, thanks to everyone who has responded.

-----------------------------------------------------------------------
NAME:   James S. Sims                    TELE: (301) 975-2710
USMAIL: National Institute of Standards and Technology
(formerly National Bureau of Standards)  ARPA,BITNET: sims@enh.nist.gov

marinell@Iris1.UCIS.Dal.Ca (Kevin Marinelli) (10/16/90)

 I have encountered the same problem with 'man -t' when trying to use lpr.
The simple solution that I was able to use at our site (because I do not
support lp), is to replace the lp application with the lpr application.

I do not know if SGI would recomend this solution, but it has worked well for 
our site during the last 2 weeks.


Kevin Marinelli
Academic Computing Services
Dalhousie University

karron@MCIRPS2.MED.NYU.EDU (10/19/90)

...lots o' stuff left out...
>
>With large libraries of online documentation like X man pages, GL man pages,
>and libc man pages, not to mention all of the add on user level man pages,
                                               !!!!!!!!!!!!!!!!!!!!!!!!!!!
>I personally appreciate being able to rapidly browse online manual pages.
>
>                                               --- Ciemo

My point about the man page system is that it is made artifically difficult
for a user/programmer to add their own man pages without buying old nroff
software, or knowing about awf.  (woof woof bark bark awf awf arf arf)

Man pages should by dynamic, read/write, not only read/browse.  They should be
much more adaptable (printers,terminals,formatters(TeX), spoolers, and
indexable (keyword))

I like the increased speed, and I look forward to hashed man page stuff.  Hope
you don't ignore speeding up my local man pages.

dan.


+-----------------------------------------------------------------------------+
| karron@nyu.edu                          Dan Karron                          |
| . . . . . . . . . . . . . .             New York University Medical Center  |
| 560 First Avenue           \ \    Pager <1> (212) 397 9330                  |
| New York, New York 10016    \**\        <2> 10896   <3> <your-number-here>  |
| (212) 340 5210               \**\__________________________________________ |
| Please Note :Soon to move to dan@karron.med.nyu.edu 128.122.135.3  (Mid Oct)|
+-----------------------------------------------------------------------------+