Dpr [ options ] [ -p field-format-list ] [ -P printer ] [ input-file.. ]
Dpr prints D-file to the terminal or a printer. Currently, it supports only line-column type devices.
It makes a table-format print out of a D-file. A record is arranged in a row with its fields aligned in columns. When a field value is too long to be printed in a line, it is just truncated at the right margin of the page. A field is never folded into multiple lines.
An output format may be specified for a field. Of the output format specification (see the manual of D_fmt), only options l, r and cfmt of the output format is valid. Other format specifications are ignored. Output format is specified by -f option or -p option. The -f option provides format only. Fields not listed in -f option are printed in the default format. The -p option limits the field to be printed, and provides the order of fields as well as to provide the format.
Repeating fields (same name fields in a record) are arranged in a vertical box, each line of the box contains an individual field. When the repeat count (number of same name fields) exceeds the maximum number of lines in a page, rest of the fields is just discarded. A record never goes across the page boundary.
When the table becomes too wide for the page, Dpr makes a layered page. A page is divided into two or more layers, and a record is printed across these layers. To help to identify same record, the record number (starts from 1) is shown at the top column of each layer. Arbitrary fields may be used instead of the record number with -i option.
Page size may be given by -x and -y options. But, if the output is tty, they are taken from the window size. When the output is a printer, -x and -y dimensions are taken from the environment variable Dprintcap. You have to set value to the environment correctly to use -P option. (See PRINTER OUTPUT section). When the output is redirected (to a file), predefined values (80 columns by 40 rows) are used.
Title line shows the input file name, date and time (of Dpr execution) and the page number. This is not displayed when the input file is standard input. You can give the header title(s) by the -h option(s). These titles are used in the header instead of the input file name. Multiple -h options are printed as multiple line header, as the first option in the first line, etc.
When -g option is given, Dpr makes page change each time it encounters the value of given fields is changed. This value is printed as the last line of header, and the fields are removed from the page body (unless they are listed in -p option).
By default Dpr writes the result to the standard output, and when it is terminal, it uses more to provide page view. Page view program can be changed by PAGER environment variable.
When -P option is given, Dpr writes the result to the printer. For printer output, an environment variable Dprintcap is mandatory. See PRINTER OUTPUT section below.
Control characters in ASCII are represented in caret form; for example TAB is represnted by "^I". Other control characters are shown in "<xx>" form, where xx is hexadecimal value of the code. Characters not represented in the current locale code are printed as QUESTION MARK (?).
Dpr makes a temporal text file and send it to a printer using a command (through pipe in UNIX). You have to learn about the command. In Windows, it is lpr (Windows NT4.0 or later), In UNIX, it is lp or lpr. (You may use any other command having same function.) These commands should accept a text file (from standard input in UNIX) and print it to a printer with fixed pitch default font.
You have to know how many lines and columns can the printer print with the default paper and default fixed pitch font. These numbers may be found in the manual of the printer. But, if they are not available, you may check them by test pattern printing. Note that columns are counted by the unit of ASCII character font pitch.
Environment variable Dprintcap has one or more entries separated by SEMICOLON (:). Each entry has five fields separated by COLON (:). These fields are positional and name, type, columns, rows and command, in this order.
Name is the name used in the Dpr command -P option. It may be same as the printer name used in the system, but, not necessarily be same. This name is used only for associating the Dpr command and an entry of Dprintcap. Name should be unique in Dprintcap entries.
Type is "t", which means "text" type. Other types such as "postscript" may be supported in future versions.
Columns and rows are number of maximum columns and rows printed by the command. These numbers are used by Dpr when no -x or -y options are given.
Command is a character string used by Dpr command, but for the filename argument. It is something like "lpr -S server -P printer. See the examples below.
In Windows, Dprintcap environment is usually set from Control Panel -- System (detail is different depending on the version). Or, you may set this by "set" command. In UNIX, Dprintcap environment is usually set from .profile, .cshrc or such shell initializing script.
Display fields "filename" and "size" from a D-file
Dpr -p "filename,size"
Print a D-file named "test1.d" with ID field "student-id", and page break at each "classroom":
Dpr -i student-id -g classroom test1.d
Setup Dprintcap environment (WindowsNT4.0 or later):
(you may set the environment from "System" Control Panel)
set Dprintcap=LBP0:t:106:76:lpr -S PRTSERV -P LBP0;LBP1:t:106:76:lpr -S PRTSERV -P LBP1
Setup Dprintcap environment (UNIX sh):
Dprintcap="LBP0:t:106:76:lp -d LBP0"
export Dprintcap
Setup Dprintcap environment (UNIX csh):
setenv Dprintcap "LBP0:t:106:76:lpr -PLBP0"
Print a D-file named "list.d" to the printer defined as LBP0:
Dpr -P LBP0 list.d
See the manual of D_msg.
MIYAZAWA Akira