* Printcap filter to do cr to crlf mapping?
@ 2003-06-03 22:44 Jeremy Thomson
2003-06-04 23:23 ` Dave Uhring
2003-06-05 12:39 ` nospam
0 siblings, 2 replies; 3+ messages in thread
From: Jeremy Thomson @ 2003-06-03 22:44 UTC (permalink / raw)
We use v5.1.
I have a printer at a remote location that cant be set up to convert
unix lf to DOS cr lf pairs.
So I thought I could do it in the printcap by writing a simple .c
proglet to do the conversion & use one of the printcap filters.
To test I had a c program double.c that printed each character of
stdin twice on stdout, (makes it easy to see if its working).
I replaced if, of and xf with my double program but the output
remained unchanged.
The printcap entry with original filters
55|lp55:\
:if=/usr/lbin/lpf:\
:lf=/usr/adm/lp55err:\
:lp=/dev/null:\
:mx#0:\
:of=/usr/lbin/lpf:\
:pl#66:\
:pw#132:\
:rm=10.254.1.51:\
:rp=pr5:\
:sd=/usr/spool/lpd55:\
:xf=/usr/lbin/xf:
From 'man printcap', the section dealing with filters...
------------
Filter and Flags
The lpd line printer daemon creates a pipeline of filters to process
files
for various different printer device. The filters you select depend
on the
flags that are passed to the lpr command. The pipeline setup is:
__________________________________
Flag Filter Description
__________________________________
none if regular text
-p pr | if regular text + pr
-c cf cifplot
-d df DVI (tex)
-g gf plot
-n nf ditroff
-f rf FORTRAN
-t tf troff
-v vf raster image
__________________________________
The if filter is invoked with arguments according to the following
format:
if [-c] -wwidth -llength -iindent -nlogin -hhost acct-file
The xf pass-through filter is specified when output is preformatted
and
does not require special filtering.
The -c flag is passed only when the -l flag (pass control-characters
literally) is specified to the lpr command. The -wwidth and
-llength
parameters specify the page width and length (from the assigned or
default
values of pw and pl respectively in the printcap file) in
characters. The
-n and -h flags specify the login name and hostname of the owner of
the
job, respectively. The acct-file is passed from the af entry in the
printcap file.
The if filter is opened for all individual jobs, which makes it
suitable
for accounting. When the if filter is not specified, the system uses
the of
filter as the default value. The of filter however, is opened only
once and
is only given the -wwidth and -llength flags.
All other filters are called according to the following format:
filter -xwidth -ylength -nlogin -h host acct-file
In this format, -xwidth and -ylength are represented in pixels as
specified
by the px and py entries, respectively, in the printcap file.
All filters take standard input (stdin) as the source file and
standard
output (stdout) as the destination. The printer may log either to
standard
error (stderr) or use syslogd, and must not ignore the SIGINT
signal.
--------------
From the above I assumed the 'if' filter would be invoked as I was
submitting the print files using a naked 'lp -d' command (no options).
To solve the problem I have disbaled printing for printer 55 & run a
script daemon to inspect its queue and pass the printfiles through a
cr2crlf program and print to a synonym printer (same TCP/IP port).
But there must be a more elegant way.
Jeremy Thomson
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Printcap filter to do cr to crlf mapping?
2003-06-03 22:44 Printcap filter to do cr to crlf mapping? Jeremy Thomson
@ 2003-06-04 23:23 ` Dave Uhring
2003-06-05 12:39 ` nospam
1 sibling, 0 replies; 3+ messages in thread
From: Dave Uhring @ 2003-06-04 23:23 UTC (permalink / raw)
On Tue, 03 Jun 2003 15:44:35 -0700, Jeremy Thomson wrote:
> We use v5.1.
>
> I have a printer at a remote location that cant be set up to convert
> unix lf to DOS cr lf pairs.
Most such printers can be set by an ESC sequence to interpret LF as CR/LF.
An example way of doing this is in the NetBSD handbook:
http://netbsd.org/guide/en/chap-print.html#id2963136
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Printcap filter to do cr to crlf mapping?
2003-06-03 22:44 Printcap filter to do cr to crlf mapping? Jeremy Thomson
2003-06-04 23:23 ` Dave Uhring
@ 2003-06-05 12:39 ` nospam
1 sibling, 0 replies; 3+ messages in thread
From: nospam @ 2003-06-05 12:39 UTC (permalink / raw)
in article 3c672d5.0306031444.25cc61d8@posting.google.com, Jeremy Thomson at
thomsonj@fliway.com wrote on 04/06/2003 08:44:
> The printcap entry with original filters
>
> 55|lp55:\
> :if=/usr/lbin/lpf:\
> :lf=/usr/adm/lp55err:\
> :lp=/dev/null:\
> :mx#0:\
> :of=/usr/lbin/lpf:\
> :pl#66:\
> :pw#132:\
> :rm=10.254.1.51:\
> :rp=pr5:\
> :sd=/usr/spool/lpd55:\
> :xf=/usr/lbin/xf:
>
Soon as you put :rm in you can kiss good bye local filters/effects. BSD
printing just passes all you local format requests to the remote machine to
format. Since these days most remote machines are actually HP lasers who
also ignore the formating you loose! What you need to do is use a bounce
queue. One queue formats the jobs and uses the input filter to lpr the
result onto a remote queue to deliver to the printer.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-05 12:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-03 22:44 Printcap filter to do cr to crlf mapping? Jeremy Thomson
2003-06-04 23:23 ` Dave Uhring
2003-06-05 12:39 ` nospam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox