DITREV

Section: User Commands (1)
Updated: local
Index Return to Main Contents
 

NAME

ditrev - reverse ditroff(1) pages  

SYNOPSIS

ditrev [file]  

DESCRIPTION

Ditrev reverses the pages in a ditroff file (or stdin, if no file is specified) and outputs to stdout. This is useful when sending typeset ditroff output to a laser printer: ditroff outputs the pages in an order that, without this filter, forces you to manually reverse them all.

To use this filter, you would use something like the following command:

troff file -t -Pps | ditrev | lpr -n -Pps
(where /usr/local/ditroff is ahead of /usr/bin in your search path).  

COMPARISON WITH PSREV

There is another program called psrev that reverses the pages of PostScript files. Since many laser printers (e.g., the MacIntosh LaserWriter) use PostScript, one could do
troff file -t -Pps | dps | psrev | lpr -Pps
(dps translates between ditroff format and PostScript). Although I didn't know of the existence of psrev when I wrote ditrev, it turns out that there are several advantages of ditrev over psrev:
1.
Ditrev is more general - it works no matter what image format the printer accepts. Thus, ditrev can be used for any printer, and the user doesn't have to know what format the printer expects.
On the other hand, psrev works no matter what text formatter generated the file, as long as the printer accepts PostScript. But, since most text processors (Scribe and tex(1L) in particular) output the pages in the correct order, this probably isn't too useful.
2.
Ditrev runs faster than psrev.
3.
Neither dps nor psrev seem to have man pages.
4.
Dps is often only available on the machine which drives the printer, so you would actually have to do
troff file -t -Pps | rsh 'dps | psrev | lpr -Pps'
This can become more complicated and installation dependent if these other filters aren't in your search path on the remote machine.
 

AUTHOR

Mike Schwartz, University of Washington Computer Science Department.
ihnp4!uw-beaver!schwartz (USENET)
schwartz@wally.arpa (ARPANET)
schwartz%wally.arpa@csnet-relay.arpa (CSNET)
 

BUGS

1.
The transformation performed is very simple; I discovered it by looking at the output of ditroff and the source of dsun(1). Thus, although this filter seems to work, I may have made some oversimplifications.
2.
Input is read into dynamically allocated buffers, and hence, for a large input file, alot of memory is used (but no more than necessary, if compiled with -DREALLOC). This could have been avoided by disallowing input from stdin and using fseek(3) to move through the file. I didn't do this because I wanted to allow input to come from stdin.
 

SEE ALSO

troff(1), ditroff(1), dsun(1), lpr(1), tex(1L), printcap(5).


 

Index

NAME
SYNOPSIS
DESCRIPTION
COMPARISON WITH PSREV
AUTHOR
BUGS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 06:22:39 GMT, December 12, 2024