|
|
Name Platforms
Description Capabilities
Types Basic Capabilities
Formfeed / Linefeed
Character Translation
Escape Translation Remote Printing
Notes Files
See also |
Name |
css.devices |
Platforms |
Unix, Windows NT
|
Description |
The file css.devices is a data base describing the CSS devices (printers). This data base is used by all CSS programs and utilities. The printers are defined by giving a set of capabilities and by describing how operations are performed. Initialization and termination sequences are included in css.devices. Entries in css.devices consist of a number of fields separated by colons ':' (similar to termcap(5)). The first entry for each printer gives the logical CSS device number (1..999) and separated by a vertical bar '|' the device name. The name may include spaces for readability but should not exceed 20 characters. Only the last entry of multiple definitions with the same device number will become active. By assigning a device number 0 (zero), an entry becomes inactive and will be skipped by the compile process through csa(U). In contrast to termcap(5) the definitions in css.devices do not serve as a reference for the CSS programs. Rather they have to be compiled with the aid of the csa(U) administrator utility into an internal, very efficient format. Thus any changes to css.devices become active only after a successful compilation. |
Capabilities |
Name |
Type |
Description |
Default |
as |
bool |
automatic printer selection |
false |
bm |
bool |
binary mode |
false |
bol |
str |
begin of line control sequence |
|
bop |
str |
begin of page control sequence |
|
bor |
str |
begin of report control sequence |
|
bp |
bool |
banner page |
false |
cr |
bool |
LF » CR/LF conversion |
false |
dn |
str |
device name, may be used place of the logical device number as alternative identification |
|
dt |
str |
printer type, controls routing of binary reports |
|
dv |
str |
Unix device file for output |
|
el |
str |
Unix lock file for external locks |
|
eol |
str |
end of line control sequence |
|
eop |
str |
end of page control sequence |
|
eor |
str |
end of report control sequence |
|
es |
bool |
elongate by spaces, elongated printing (e9, e10) is achieved by inserting space characters |
false |
et |
bool |
expand tab characters to standard positions. Useful for ports, that do not support stty(1) settings (e.g. parallel ports). |
|
e1..e127 |
str |
escape translation |
|
fp |
num |
formfeed padding (depreciated) |
0 |
if1 |
str |
printer initialization file 1 |
|
if2 |
str |
printer initialization file 2 |
|
lp |
num |
linefeed padding (depreciated) |
0 |
map |
str |
combine several forms into a form class |
|
mp |
num |
Max. pages. Reduces output to num pages per report. If
the limit is reached, the report will be set to the hold status. |
|
op |
str |
output through pipe |
|
pg |
bool |
page printer flag |
false |
ps |
num |
preset page size |
0 |
rpm |
str |
remote print mode:
Mode |
Protocol |
lpd |
standard BSD lpd |
rlpd |
relaxed lpd |
rtel |
reverse telnet |
pros |
Axis Pros |
raw |
TCP/IP direct port addressing |
For a detailed description, see the Remote Printing
section below.
|
|
rph |
str |
remote print host name or IP address |
|
rpp |
str |
remote print port number or service name
Mode |
Default |
lpd |
515 |
rlpd |
515 |
rtel |
2000 |
pros |
35 |
raw |
none |
|
|
rpq |
str |
remote print queue name. In some printer box manuals, this
value is also referred to by 'remote port', 'remote service name' or 'remote printer
name'. |
|
rpr |
str |
remote port |
|
rpw |
str |
remote password
Mode |
Default |
pros |
netprinter |
|
|
tf1 |
str |
printer termination file 1 |
|
tf2 |
str |
printer termination file 2 |
|
tr |
str=str |
character translation |
|
vd |
bool |
view device |
false |
wfc |
str |
write fail command |
|
wft |
num |
write fail timeout in seconds |
3600 |
xmap |
str |
combine all forms except the group specified into a form class (exclusive map) |
|
# |
str |
comment |
|
The following entry describes some of the capabilities of a Brother HL-8 running in
LaserJet II mode:
1|HL-8 (LaserJet
Mode):dn=HL8:as:pg:cr:\
:dv=/dev/tty04:dt=HPGL:map=a,a4h,a4q:\
:bor=\EE\E&l0O\E&l68P\E&l66F\E&l2E\E*t300R:\
:bor <A4L>=\E&l1O\E&l48P\E&l46F:\
:eor=\EE:\
:e1=\E&k0S:#10 cpi:e2=\E&k4S:#12 cpi:\
:e3=\E&k2S:#16.5 cpi:e4=\E&k2S:#16.5 cpi:\
:e11=\E(s1S:e12=\E(s0S:#italic on/off:\
:e15=\E&a-0.5R:\e16=\E=:#superscript on/off:\
:e17=\E=:e18=\E&a-0.5R:#subscript on/off: |
Definitions may span to multiple lines by giving a backslash '\' as the last
character of a line. Empty fields can be included for readability and are most often used
between the last field on a line and the first field on the next. Capabilities in css.devices
are of three types: Boolean capabilities, which indicate that the printer has some
particular feature or that a certain mode of operation shall be applied, numeric
capabilities giving the size or count of something, and string capabilities, which give a
sequence that can be used to perform particular printer operations or define a file name
to be downloaded to the device.
Device definitions may contain an include statement:
1|Printer 1:include=file:
Include files may however not span device definitions, i.e. they may only
contain capabilities of the devices they have been entered for. Multiple as well as nested
include statements are allowed. The include file may be specified absolute
(name starting with a slash /) or relative. Relative files are searched
for in $base_dir/include (normally /usr/lib/css/include). Within include
files the line continuation indicator \ may be omitted. |
Types |
Each capabilitiy has a two or more letter code. For instance, the fact that a printer shall be 'automatically selected', even if no device had been entered in the lpr(U) command line (i.e. it is a so called system printer), is indicated by the capability as. Numeric capabilities are followed by the character '=' and then their decimal value. \E |
Escape character |
^x |
Control-X (x = any character) |
\n |
Linefeed |
\r |
Carriage Return |
\t |
Horizontal Tab |
\a |
Audible Alarm |
\b |
Backspace |
\f |
Formfeed |
\v |
Vertical Tab |
Any character can be given as three octal digits after a \ or as
two hexadecimal digits after \x. Preceding a character by the tilde '~' will
set its high order bit (0x80). Combinations such as '~^x' and '~\E' are supported.
If it is necessary to place a CSS meta character '=', ':', '^',
'~", '/' and '\' in a capability, it must be escaped by a \
(\=, \%, \:, \^, \~, \/ and \\) or
encoded in the above octal or hexadecimal form.
|
Basic Capabilities |
The dv capability serves to establish a connection between a CSS device and a Unix device. If the string starts with a slash '/', the value is taken as an Unix device file name and used as is. All other values are combined with the leading string '/dev/lp' (e.g. dv=02 will expand to '/dev/lp02'). If no dv entry is present, the name is constructed using '/dev/lp' and the logical device number (e.g. printer no. 5 is attached to /dev/lp5). As an exception to this rule, printer no. 1 attaches to just /dev/lp. To set the terminal I/O modes (such as baud rate, parity, number of stop bits, type of handshaking and all other line attributes) the setmode(U) utility should be used. Under CssNT the dv entry is mandatory, no default is assumed. Devices are defined in the Universal Naming Convention (UNC): dv=//host-name/printer-share-name Please note, that within css.devices all file names must be entered using the Unix directory separator '/'. The colon ':' after the drive letter, must be preceded by the backslash '\' (BS). Failing to do so would cause CSS to assume the end of the parameter entry: C\:/dev/printer1 You may also enter a disk file as target device. This feature is often used to verify the output generated of device definition. The contents of this file is overwritten by each printout. E.g.the printer defined by the CssNT Setup program has the entry dv=C\:/CssDev1.txt Therefor, output will be directed to the disk file C:\CssDev1.txt. All CSS programs do accept a symbolic name in place of the logical device number. The symbolic device name may be defined by the dn capability. The string is case insensitive and should not exceed 16 characters. Embedded spaces are not allowed. The dt capability (device type) serves to group printers by type. CSS allows report routing of binary reports only to devices of the same type. Therefor the same type should be assigned only to devices with identical control language (e.g. HPGL5, PostScript). The string is case sensitive and should not exceed 14 characters. Whenever CSS has to share a printer
within distinct virtual environments or with another software package (such as alternate spoolers or office automation software with integrated spooler), a lock file name, indicating the current use of a device may be defined by the el-parameter. Any printer with such an entry will only be used, if the corresponding lock file will mark the device as currently no in use. The locking method may be chosen through the ext_lock parameter in css.default. If the printer is available, CSS signals its use by creating the file or putting an advisory lock onto the file according to the lock method chosen. The name of the lock file must be specified in absolute format (i.e. must start with the slash '/' character (e.g. /usr/spool/lock/lck..lp2). Names beginning with '/usr/spool/css/LCK..' may not be used. The access path of the lock files must exist and be accessible by all users (see mkdir(1) and chmod(1)).
When used in combination with the EXT_LOCK=sema parameter of
css.default, it is the responsibility of the system administrator to assure that no unused lock files exist
in order to provide undisturbed operation. Notably kill(1) commands with the -9 option should be avoided, since they disallow the killed process to cleanup its environment and to terminate in a decent way. To achieve a correct state after a powerfail, existing lock files may be removed by appropriate rm(1) commands in the file /etc/rc.
In any case EXT_LOCK=lock (the default) should be favored,
since it provides clean and safe locking without the danger of zombie file
semaphores. The el capability may also be used to 'cheat' CSS by assigning more than one logical device to a single physical device. The as boolean capability is used to enable an automatic printer selection for reports that have been created without specifying a target device by the d- or r-option of the lpr(U) command. Whenever such a report is spooled, CSS will scan the as devices and - provided that the requested form is mounted - choose it for output. The as parameter should not be used for printer that have to be selected explicitly (typical for daisy wheel and off-site printers). All devices having as set are referred to as main- or system-printers. The fact, that a particular model is not able to print in elongated mode (CSS control sequences e9 and e10), is stated by the es capability (elongate by spaces). To avoid misalignment CSS will elongate by spaces, i.e. emulate the elongate attribute by inserting a space after each character on such printers. The et capability (expand tabs) causes tab characters to be expanded to the standard positions (9, 17, ...). This is especially useful for ports that do not support stty(1) settings. Since device descriptions of laser printers often include form definitions such as orientation, number of lines per page and margins are often defined by the use of (form-) conditional bor entries, different logical forms (see css.forms) may be printed on the same physical paper type without the need of a form change (automatic form change). Such form groups may be defined by the use of the map capability. For instance, the entry map=a,b,e,f combines the forms A, B, E and F into one group and will allow printouts onto one form of the group, if any other form of the same group is mounted as the current form of the target device. To calculate the page- and line-length however, the definitions of the requested form will be used. Multiple map entries may be defined per device. The xmap capability (exclusive map) allows to combine all forms except the ones defined in the xmap definition. Map entries are still allowed, but are restricted to subgroups of the xmap forms. Printing of one or more banner pages is controlled by the bp capability. However, banner pages are generated only, if the form used includes the corresponding entry with the same name.
|
|
CSS provides the feature to merge strings (text and control sequences) into the print file. The anchors available are:
bor |
at the beginning or each report |
bop |
at the beginning or each page |
bol |
at the beginning or each line |
eor |
at the end or each report |
eop |
at the end or each page |
eol |
at the end or each line |
The syntax of the box and eox capabilities is:
name [<form>][/flag...][%var.eq.val...][{copy}][[page]][(line)][-option...]=value
Multiple entries (up to a system imposed limit) of the above capabilities
are allowed. Output occurs strictly in the order of the definitions. By stating
conditions, the selection of the statement may be restricted.
The conditions available are:
Condition |
The definition is valid if... |
<form> |
...the printout is assigned to form |
/flag |
...the flag condition is TRUE. Condition flags may be set through the C-option of the lpr(U) call or dynamically during the printout. The flags may be combined by logical operators:
/&flags |
logical and (default): all flags defined must be set |
/|flags |
logical or: at least one of the flags must be set |
/!flags |
logical not: none of the flags may be set |
/(expr) |
flag expressions may be defined by combining flag names and the operators ! (unary not), & (and) and | (or). Operator precedence is !, &, | in decreasing order. Parenthesis may be used to overwrite the default precedence order. Examples:
/(a & b) |
same as /ab or /&ab |
/(a | b) |
same as /|ab |
/(!a & !b) |
same as /!ab |
/(! (a | b)) |
dito. |
/(a | b & c) |
is /(a | (b & c)) |
|
|
%V.eq.val
%V.ne.val |
...the current content of ordering variable %V is equal or unequal (operator .ne.) to val (see below for a list of all available variables). Val must immediately follow the comparison operator. If val contains embedded spaces it may be enclosed by quotes or double quotes, which in turn can be escaped as \' or \" to be considered as part of val. With the i-option comparison may be defined as non case sensitive. Examples: New years day of a new decade: %'d'd.eq.1 %'m'd.eq.1 %[1]'yy'd.eq.0 %1'yy'd.ne.0 New years day of a new century: %'d'd.eq.1 %d'm'.eq.1 %'yy'd.eq.00 %[1]1'yyyy'd.ne.0 New years day of a new millennium: %'d'd.eq.1 %'m'd.eq.1 %[1]'yyyy'd.eq.000 |
{copy} |
...the current copy is within the range copy. A copy range may be defined as:
9 |
absolute copy counted from the beginning of the
current print job |
-9 |
relative copy counted from the end of the
print job |
9,99 |
from-to copy (absolute) |
$ |
last copy |
o |
odd copy numbers |
e |
even copy numbers |
Examples:
{e} |
all even copies: 2,4,... |
{2,$} |
from copy 2 (all copies except first) |
{o -5,$} |
the odd copies of the last six |
{1,-1} |
all copies except the first and the last one |
|
[page] |
...the current page is within the range page. Page ranges follow the same syntax as copy ranges:
9 |
absolute page counted from the beginning of the
report |
-9 |
relative page counted from the end of the report. |
9,99 |
from-to page (absolute) |
$ |
last page |
o |
odd page numbers |
e |
even page numbers |
Examples:
[e] |
all even pages: 2,4,... |
[2,$] |
from page 2 (all pages except first) |
[o -5,$] |
the odd pages of the last six |
[1,-1] |
all pages except the first and the last one |
|
(line) |
...the current line is within the range line. Line ranges follow the same syntax as page ranges:
9 |
absolute line counted from the beginning of the
page |
-9 |
relative line counted from the end of the
page. |
9,99 |
from-to line (absolute) |
$ |
last line |
o |
odd line numbers |
e |
even line numbers |
Examples:
(e) |
all even lines: 2,4,... |
(2,$) |
from lines 2 (all lines except first) |
(o -5,$) |
the odd lines of the last six |
(1,-1) |
all lines except the first and the last one |
|
The following table defines the permissible conditions:
|
bor |
eor |
bop |
eop |
bol |
eol |
form |
¤ |
¤ |
¤ |
¤ |
¤ |
¤ |
flag |
¤ |
¤ |
¤ |
¤ |
¤ |
¤ |
value |
¤ |
¤ |
¤ |
¤ |
¤ |
¤ |
copy |
¤ |
¤ |
¤ |
¤ |
¤ |
¤ |
page |
|
|
¤ |
¤ |
¤ |
¤ |
line |
|
|
|
|
¤ |
¤ |
|
|
Options: Options may be used to change the behavior of the CSS despool process. Besides common options, the eol- and eop-parameters allow the definition of special options. To clarify their mode of operation consider the following device definition: 1|Test (Page Printer):pg:\ :eol=<eol>:eop=<eop>:eor=<eor> The input file Line1 linefeed Line2 linefeed formfeed produces the output Line1 <eol> linefeed Line2 <eol> <eop> linefeed formfeed <eor> eol and eop l-option: This option suppresses output of linefeeds (hex 0x0A) for all lines that evaluate one or more eol definitions to be active. If an active eop definition has the l-option set, the linefeed character of the last line will be suppressed (which is redundant to eol ($) -l). Of course, linefeeds may still be generated explicitly within the eox control sequence. eop f-option: This option suppresses output of form feeds (hex 0x0C) even if the device has been defined as page printer (pg boolean). The f-option is useful for printers that require special control sequences to end a page (e.g. single sheet feeders). It may also be helpful to develop PostScript definitions. Suppression of form feeds is active for all pages that evaluate one or more eop definitions with the f-option set, to be active. Example:
:eop [1,-1] -f=... : # suppress formfeed:\ :eop [$]=...: # except last page: |
Common options: Options without argument may be grouped following a single ‘–’ character. Arguments may immediately follow the option character or may be delimited by a space. Option |
Description |
-i |
Ignore case in ordering variable value
condition. |
-p |
Pipe option: use the standard output of the command defined by value as capability result. The value definition must start with a slash / and may contain options. The named file should have its execution flag set. Note: the p-option is not available in CssNT. |
The following options take effect if the capability conditions are met and after output of the value definition is complete. If value requests a file or pipe operation, the options are processed only if the named file or pipe can be located and executed (pipe). To only modify condition flags, empty value strings are allowed. |
-c cond |
Clear, set condition flag(s) cond to false. |
-s cond |
Set condition flag(s) cond to true. |
-t cond |
Toggle condition flag(s) cond from true to false and from false to true respectively. |
Note! In order to maintain full flexibility, no restrictions apply to the use of the p-option. You should however be aware, that overuse may seriously degrade your systems performance. It would be unsound to define :bol -p=/usr/css/bol.sh: whereas it may make sense to use :bol [$] ($) -g=/usr/css/bol.sh: for the last line of the last page of the document. |
|
|
Within the control string of the box and eox definitions (output section), so called ordering variables may be embedded. Ordering variables are special character strings that will be substituted by a value at runtime (for more information on ordering variables see the sections below). Whenever the output section of a box and eox definition starts with the slash character '/', the value is considered to be a absolute path name of a Unix file. If the named file exists and is readable (see chmod(1)), its content is downloaded to the printer. These file names too may be constructed by the use of ordering variables (e.g. to group LaserJet macros by form and language). All box- and eox-capabilities of a device are processed in the order of their definition. If conditions are present, an evaluation cycle takes place prior output. The use of dynamic condition flags allows to define if, elseif, else conditions, which ease the definition of processing variants with a default:
:bor <a4h> -s H=\Ex: # if form = A4H:\ :bor <a4q> -s
Q=\Ey: # elseif form = A4Q:\ :bor /!HQ=\Ez: # else all other forms: |
For a description of the operational flow of a printout see also fdu(U). Caution: Some printer models are designed to process a 'reset device' command immediately upon reception (i.e. out of sequence) and may thus destroy the content of their buffer unintentionally if such a command is sent by an eor definition. Typical actions performed through eor include resetting of attributes and selection of the standard character pitch of 10 cpi. |
The following ordering variables are supported by CSS:
%a |
Number of first page printed, 1 on full printouts. |
%c |
Creation date of current report |
%d |
Current system date (date of the printout) |
%f |
File name that has been specified on the lpr(U) command line for the current report. If spooling was through pipe, the null string or the value of the format parameter (see below) will be generated. |
%h |
Report title (lpr t-option) |
%i |
Total number of copies to print |
%k |
Current copy number |
%l |
Number of lines per page as defined in the ps parameter in css.forms or in the lpr P-option respectively |
%m |
Current line number within current page |
%n |
Total number of pages within current report |
%p |
Current page number |
%r |
Internal CSS report number |
%s |
Creation time of current report |
%t |
Current system time (time of the printout) |
%z |
Number of last page selected, equal to %n on full printouts. |
%A |
Generates the control sequences requested by the S-option of the lpr(U) call, translated to the target device. S-options pointing to escape definitions with an e- or p-option will be skipped and thus not included in %A. Example: :e40 -e=%A: |
%C |
Condition flags (lpr C-option) in the order a..zA..Z0..9 |
%D |
Device number (lpr d-option) |
%E |
Employee-id (lpr e- or u-option or login name, respectively) |
%F |
Form type (lpr f-option) |
%L |
LANG(UAGE) environment variable or lpr L-option |
%N |
Device name as defined in the dn parameter of css.devices (lpr d-option) |
%O |
lpr O-option |
%P |
Program name (lpr p-option) |
%S |
Form subtype (lpr f-option) |
%T |
Device type (dt parameter of css.devices) |
%V |
Device file (dv parameter of css.devices) |
%Z |
Generates the control sequences requested by the T-option of the lpr(U) call, translated to the target device. T-options pointing to escape definitions with an e- or p-option will be skipped and thus not included in %Z. Example: :e41 -e=%Z: |
The syntax for ordering variables is:
%[flags][(field)][[offset]][max][.min]['format']name
flags |
The flags available include '-' (minus) for lowercase, '+' for uppercase conversion, '<' for left justification and '*' to generate 8-bit binary values. Left justification is performed only if the min value defines a result field that is larger in size than the content of the variable name. The flag '*' will cause CSS to convert numeric values into 8-bit binary entities. This is especially useful for the %l variable (number of lines per page) and will e.g. with bor=\EC%*l and ps=66 generate the following output: 0x1b (ESC) 0x43 ('C') 0x42 (66). |
field |
Fields are mostly used with the ordering variable %O (from the lpr O-option). A field defines a colon ':' delimited substring of the option value. The use of a field index (zero origin) reduces the result of the ordering variable to the substring it points to (without field delimiters). Example: :op=/usr/css/outpipe -t %(0)O -n %(1)O -x %(2)[1]2O: The command lpr -O abc:12:defg will generate /usr/css/outpipe -t abc -n 12 -x ef |
offset |
The result is reduced by offset leading characters. |
max |
Maximal size of the result. If the current value of the
variable exceeds max characters, the result is truncated at the right. |
min |
Minimal size of the result. If the current value of the
variable is less than min characters, the result is left padded by spaces (0x20)
and right aligned. If min or max have been defined with a leading zero '0',
it is used as fill character in place of the spaces. By adding the '<' flag
a left aligned output may be achieved. |
format |
Format specification for the time and date variables %c,
%d, %s and %t:
d, dd |
day, d=1..9 single digit, dd=double digit |
m, mm |
month (date), single- and double digit |
yy, yyyy |
year, two or four digits |
h, hh |
hour, one or two digits |
m, mm |
minutes (time), one or two digits |
s, ss |
seconds, one or two digits |
Example: |
'mm/dd/yy' |
US date format |
Default: |
'dd.mm.yy'
'hh:mm' |
European date format
time |
|
name |
Name of the ordering variable (D, F, and so on). |
For instance, the definition bor=/usr/lib/css/mac/%+1L/%P is
converted to /usr/lib/css/mac/G/prog_xy (Assumption: LANG=german). The fdu(U) utility has been designed to generate LaserJet macros.
It can however also be used to easily create any type of binary bor- and eor-files
by using its data command. Example:
fdu -o /usr/css/if1 <<#eof#
data esc, '[', 12, 'X';
#eof# |
|
|
It is out of the scope of this manual to fully cover the countless ways the conditional box and eox capabilities can be put to use. In the following section you can find some typical examples:
1. A laser printer with two paper trays is reserved to produce correspondence. The first page of each letter shall be taken from tray one, all other thereafter from tray two:
... :bop <cor> [1]=\E&l1H: # select tray 1:\ :bop <cor> [2,$]=\E&l4H: # select tray 2:\ ... |
2. A second double tray printer is loaded with A4 sheets in tray one and A5 sheets in tray two. Printing on both formats in portrait and landscape mode shall be managed without the need of form changes:
... :map=a4p,a4l,a5p,a5l:\ :bor <a4p>=...: # setup A4P, tray 1:\ :bor <a4l>=...: # setup A4L, tray 1:\ :bor <a5p>=...: # setup A5P, tray 2:\ :bor <a5l>=...: # setup A5L, tray 2:\ ... |
3. When printing onto the standard form A, setting the condition flag n on the command line (lpr -C n file...) shall add the current page number as header (text Page x of y). To still yield correct page breaks, an additional two lines must be taken into account in the bor setup: Assumption: Form A ps=64
... :bor <a>/!s=..: # setup for 64 lines:\ :bor <a>/s=...: # setup for 64 + 2 lines:\ :bop <a>/s=Page %p of %n \r\n\n: ... |
4. While printing checks, line 46 shall be printed in OCR font. The companies bank-account number has to be added as a constant (<program data+account-no>): Mode 1 / the program produces lines of variable size (as in C):
... :bol <chk>(46)=\Eon: # start OCR font:\ :eol <chk>(46)=+012000576>\Eoff:\ ... |
Mode 2 / the program produces lines of fixed size (as in Cobol), so that left positioning with backspaces is required:
... :bol <chk>(46)=\Eon: # start OCR font:\ :eol <chk>(46)=\b\b\b\b\b\b\b\b\b\b:\ :eol <chk>(46)=+012000576>\Eoff:\ ... |
The if1, if2, tf1 and tf2 capabilities allow the definition of Unix file names (absolute path names). If the files specified exist and are readable (see chmod(1)), their content will be downloaded after bor processing (if1 and if2 file) and before eor processing (if1 and if2 file) respectively. The init- and termination file names may be constructed dynamically at runtime by the use of ordering variables. Since the same features are provided by bor and eor, these parameters may be dropped in a future CSS release. They remain supported for backward compatibility reasons only. The op capability (output pipe) lets you define a process that is used for output in place of writing to the dv device file. The access path of the program or shell script must be entered as absolute pathname, i.e. must start with the slash '/' character and the named file must have execute permission. Prior to call of the op process an ordering variable evaluation cycle takes place. The CSS despooler subsequently feeds the report into the standard input of the named program. This feature gives the system integrator complete control to accomplish tasks such as opening connections to network nodes, dial a remote system, routing output to other processes, creating accounting information, sending mail to users or post-processing data. Example: /etc/css.devices:
:op=/usr/css/lp_filter %V %E '%h' %m %C:\ :dv=/dev/tty05:... |
/usr/css/lp_filter:
: /bin/sh deviceFile=$1 user=$2 title="$3" pages=$4 cond=$5 # store accounting info echo "$user $title $pages" >>/usr/css/acct # write to device and store exit status cat >$deviceFile rc=$? # inform user if the M flag has been set case "$cond" in *M*) mail -s CSS -u $user <<!! Your report '$title' has been printed. !! esac # and return exit status exit $rc |
If the op process returns an exit status other than zero, the report will be set to the 'hold' status and retained in the report queue. The op parameter is not available in CssNT. The wfc capability (write fail command) can be used to define a command that is executed when writing to the device fails for more than wft (write fail timeout) seconds. The access path of the program or shell script must be entered as absolute pathname, i.e. must start with the slash '/' character and the named file must have execute permission. Example: /etc/css.devices:
:wfc=/usr/css/printerFail %V %D %N %d %t %r '%h':\ :dv=/dev/tty05:... |
/usr/css/printerFail:
: /bin/sh deviceFile=$1 deviceNo=$2 deviceName=$3 date=$4 time=$5 reportNo=$6 title="$7" # store logging info echo "- $date, $time: $deviceNo $deviceFile" >>/usr/css/failLog case "$deviceNo" in 1) routeDevice=2 2) routeDevice=1 esac # route device csu -o$deviceNo:$routeDevice 2>&1 >>/usr/css/failLog # inform root mail -s CSS -u root <<!! Printout of report $reportNo '$title' has failed. Device $deviceNo routed to device $routeDevice. !! |
The vd boolean capability is used to identify
device definitions dedicated for the report preview
of css(U)
and WinCss(U). Devices having vd
set, are invisible to all CSS utilities, they can however be assigned
to the VIEW_DEVICE and WINCSS_VIEW_DEVICE parameters in css.default.
A common use of view devices is to nullify hard coded control sequences
with tr definitions for undisturbed display. As an example, suppose
we have an application written which generates print output for a specific
printer model and we do not have the time to rewrite the programs to suite
the hypothetical CSS printer. The obvious solution to achieve
device independence, is to use tr definitions to replace the e1..e127
capabilities:
# print reports written for my-printer-model
on brand x model y
1|Brand X / Model Y:dn=pr1:dv=/dev/lp:\
:tr=\EI1=\E(s1S: # italic on, use instead of e11=... :\
:tr=\EI0=\E(s0S: # italic off, use instead of e12=... :\
... |
To set italic printing on, our device dependent program writes 'ESC I 1'
(0x1b4931). The above definition causes CSS to translate this
control sequence to 'ESC ( s 1 S' (the HP code to turn italic printing on)
during output. The program has migrated to be device independent without
changing one line of code. But one problem remains to be solved: the
report preview feature of css(U) and WinCss(U)
use a very simple device model for display preparation. In fact it has no capabilities
defined at all, causing each 2 byte escape sequences
of the CSS hypothetical printer to be silently ignored. This device
definition is not well suited to process output of our example application
and the report preview will contain odd characters resulting from escape
codes. What we need is a device that nullifies all control sequences:
# view device for reports written for
my-printer-model
901|View Device:vd:\
:tr=\EI1=: # italic on :\
:tr=\EI0=: # italic off :\
... |
Using the above device, 'ESC I 1' and 'ESC I 0' will be replaced by
nothing (the null string) when sent to the display. To connect a view
device to the css(U)
program, the VIEW_DEVICE parameter in css.default
must be set to the proper device number, e.g. VIEW_DEVICE=901.
The WinCss report view module recognizes some basic formatting
codes:
Code |
CSS Notation |
Formatting |
ESC b |
\Eb |
bold on |
ESC B |
\EB |
bold off |
ESC i |
\Ei |
italic on |
ESC I |
\EI |
italic off |
ESC u |
\Eu |
underline on |
ESC U |
\EU |
underline off |
Consequently, the WinCss view device could be defined as:
# view device for reports written for
my-printer-model
902|WinCss View Device:vd:\
:tr=\EI1=\Ei: # italic on :\
:tr=\EI0=\EI: # italic off :\
... |
To connect this view
device to the WinCss(U)
program, the WINCSS_VIEW_DEVICE parameter in css.default
should be set to the corresponding device number, e.g. WINCSS_VIEW_DEVICE=902.
The WINCSS_VIEW_DEVICE parameter defaults to VIEW_DEVICE, in
which case no formatting codes should be used.
|
Formfeed / Linefeed
|
The ps capability defines the number of lines at 6 LPI
the printer will advance between two consecutive form feeds. Printers that remain at their
home position when receiving the second formfeed should not define ps (or ps=1)
since not doing so, prevents the page parity feature from operating correctly. A ps
value of 0 or 1 will cause CSS to never send a explicit formfeed, but
to emulate form feeds by an appropriate number of linefeeds. The size information thereto
is taken from the forms data base. Any other ps value causes raw form feeds to be
sent whenever the form size (see css.forms / ps
parameter) is identical. The cr boolean causes a linefeed to carriage return /
linefeed conversion to be performed, when set.
By the use of the pg boolean, a device can be defined to operate in page-printer
mode, i.e. to cause the last page of any report to be terminated by a formfeed character.
This capability should normally be specified for laser printers. |
Character Translation
|
The tr capability is used to define string or
character translations. The input string has to be defined between the first and the
second equal '=' character. The output string is defined following the second equal
sign. Embedded equal characters in both strings have to be escaped as usual ('\=').
No restrictions exist to the size of the of neither of the strings. The output section may
define download files and/or include ordering variables like in box and eox.
Form, flag, page and line conditions as well as common options can also be specified
(syntax see box). Of overlapping input strings, the shorter value is
favored:
tr=1=A:tr=12=AB:
The second tr string is never translated!
Dynamic condition flags may be used for context sensitive control. If for example a
flag shall be set, whenever pattern is found in a document, use:
:tr -s f=pattern=pattern:# retain pattern:\
:eop /f -c f=value...:# next eop, then clear flag:
|
Escape Translation
|
To enable the use of the features of today's printer models and still retain device independence, CSS provides a hypothetical printer model. This imaginary printer is sensitive to the control sequences Esc,1 to Esc,127 (hex 0x1B 0x01 up to 0x1B 0x7F). At printout time, these control sequences will be translated to the values defined by the e1 up to e127 capabilities of the target device. If no related entry can be found, the Esc control is silently ignored and no output is performed. For instance, if a device entry defines :e5=^N: and a program writes Esc,5 CSS will send a Cntl-N to the printer. Escape translation can be turned off by the bm capability or temporarily by the B-option of lpr(U). The assignment of the Esc controls to 'real' printer features is up to the user. However, to enable CSS to provide the automatic character pitch selection (see a-option of lpr(U)), the meaning of e1 up to e4 is predefined: e1 |
change print density to 10 cpi (chars per inch) |
e2 |
change print density to 12 cpi |
e3 |
change print density to 16.5 cpi |
e4 |
change print density to more than 16.5 cpi |
If a printer in use is not capable to change its character pitch, e1 to e4
should not be defined. If only some of the above cpi changes are not supported, these
entries should be defined equal to the next higher (denser) value. If no denser cpi is
possible, the sequence for the densest value must be set. The automatic cpi selection (see
a-option of lpr(U)) causes CSS to use the
lowest possible pitch (i.e. the largest possible font) for the widest line of a report to
fit on the current form (see css.forms / ll
capability).
|
|
The syntax of the enn capabilities is: name [-option...]=value Options without argument may be grouped following a single character. Arguments may immediately follow the option character or may be delimited by a space. Option |
Description |
-e |
Expand option: The value of the definition is processed in the same way as box and eox capabilities, i.e. the %-variables are substituted and/or control file input is possible. |
-p |
Pipe option: use the standard output of the command defined by value as capability result. The value definition must start with a slash / and may contain options. The named file should have its execution flag set. This option implies the e-option. Note: the p-option is not available in CssNT. |
The following options take effect if the capability conditions are met and after output of the value definition is complete. If value requests a file or pipe operation, the options are processed only if the named file or pipe can be located and executed (pipe). To only modify condition flags, empty value strings are allowed. |
-c cond |
Clear, set condition flag(s) cond to false. |
-s cond |
Set condition flag(s) cond to true. |
-t cond |
Toggle condition flag(s) cond from true to false and from false to true respectively. |
Summary
The hypothetical printer model used by CSS may have features defined, that are
not available on each physical device. Undefined Esc controls in the range between Esc,1
and Esc,127 (e1..e127) are thus discarded during output. This may not be the
desired mode of operation e.g. for printers used by word processors. To achieve
transparent data delivery without escape translation, automatic pitch selection, cr
and pg processing, the target devices should be defined as 'binary mode'
(bm) printer. To set a regular CSS device into binary mode for the duration
of one single report, the B-option of lpr(U) may be
used. In binary mode the lpr(U) a-option
is ingnored and the automatic termination of the last page (pg-parameter)
is not performed.
Important Note! In normal operation on a hypothetical CSS device the despooler silently ignores undefined escape codes. If e.g. the lpd program encounters ESC,9 (hex 0x1b 0x09) and no e9-paramter has been defined for the output device, the two character control sequence is discarded and not sent to the printer. If transparent output is required, you have to use binary mode reports. |
|
Remote Printing
|
The definition of the rpm capability causes CSS
to ignore the dv and op parameters and connect to remote
devices through TCP/IP sockets. The available settings for rpm are:
Value |
Protocol |
Description |
lpd |
BSD lpd |
This is the most widely used protocol for remote printing. Almost every
print box on the market supports lpd. |
rlpd |
relaxed lpd |
Relaxed lpd is a Unitec variant of BSD lpd. Especially
with large reports, it may be considerably faster than its standard counterpart. It is
however not supported by each print box. Wherever possible, you should try this protocol
prior the use of plain lpd. |
rtel |
reverse telnet |
Rtel is available on some print boxes, but may exist in several variants.
The CSS implementation has been fully tested with the Lantronix MPS
server. |
pros |
Axis Pros |
Pros can be used with the hardware of Axis Communications. |
raw |
raw TCP/IP |
Some print server boxes allow to directly address their printer interface
by specifying a special port number. The raw protocol may be used to connect to such
ports. |
The rph capability specifies the host address of a remote print server
and is a required entry for all protocols. The value can be set in the standard four
number notation (e.g. "128.41.1.11") or as symbolic alias name as defined in the
TCP/IP hosts file. On Unix systems, this file is located in the /etc
directory. On Windows systems the location varies depending on OS type and version. Each
line in the hosts file contains the numeric IP address and one or more
symbolic alias names.
The rpp capability specifies the TCP/IP port number to be used for the
connection to the host identified by the rph entry. The value can be set
as number (e.g. "515") or as symbolic alias name as defined in the TCP/IP services
file. On Unix systems, this file is located in the /etc directory. On Windows
systems the location varies depending on OS type and version. Each line in the services
file holds the service name, a port number and a port type (the type should mostly be tcp).
Port numbers are usually predefined by the print server manufacturer or by the protocol,
it thus makes little sense to use symbolic names. Except for the raw protocol, commonly
used defaults are defined.
The rpq capability identifies the queue name of the remote print
server. This entry is named differently by almost each manufacturer and also referred to
by 'remote port', 'remote service name' or 'remote printer name'. If your hardware has
multiple queue names to choose from, you should select a queue that does not perform any
implied actions on the data sent to it. If e.g. you get additional empty pages at the end
of each report, you may have chosen a queue that appends a form feed to the
print jobs it
receives. The rpq entry is required by all protocols, except raw.
The rpr capability identifies the remote port number. It is
transmitted to the server in the rtel protocol, but not required. It may also be used with
pros as an alternative to the rpq parameter to specify the printer number
handled by the Axis box (e.g. rpr=2 is the same as rpq=pr2).
The rpw capability identifies the password required to connect to the
remote print server. It is used with the pros and rtel protocols. The default for pros is
'netprinter' and for rtel the empty string.
The remote print definitions for a Lantronix MPS server (e.g. named MPS_0d242f) would
look like:
:rpm=rlpd:rph=128.41.1.11:rpq=MPS_0d242f_TEXT:...
For an Axis box the definition could be:
:rpm=pros:rph=128.41.1.12:rpq=pr1:...
or equivalent:
:rpm=pros:rph=128.41.1.12:rpr=1:...
Note: All of the supported remote print protocols have been fully tested with some widely used print boxes. Unitec is unable to provide support for these and future protocols, except for lpd, relaxed lpd and raw. |
|
Notes
|
Although the use of the Esc control sequences e5..e127 may be assigned freely, for compatibility reasons (e.g. with ulp(U)), we suggest the following standard: e5 |
correspondence quality on |
e6 |
correspondence quality off |
e7 |
near letter quality on |
e8 |
near letter quality off |
e9 |
elongated printing on |
e10 |
elongated printing off |
e11 |
italic printing on |
e12 |
italic printing off |
e13 |
underline mode on |
e14 |
underline mode off |
e15 |
advance to superscript |
e16 |
reset superscript |
e17 |
advance to subscript |
e18 |
reset subscript |
e19 |
load alternate character set |
e20 |
restore primary character set |
e21..e127 |
unused, at disposition |
If a printer model does not support a capability, the corresponding parameters
should not be specified. The despooler program lpd will thereafter ignore the escape codes
while printing on that device. |
Files
|
Css:
|
|
/usr/lib/css/dev |
(Device Database) |
CssNT: |
|
lib\dev |
(Device Database) |
|
See also
|
csa(U), css(P),
css.forms, lpr(U), setmode(U)
|
|
|
|
|