From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,8f0b433d4e38ec47,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-06-03 15:44:37 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: thomsonj@fliway.com (Jeremy Thomson) Newsgroups: comp.unix.tru64 Subject: Printcap filter to do cr to crlf mapping? Date: 3 Jun 2003 15:44:35 -0700 Organization: http://groups.google.com/ Message-ID: <3c672d5.0306031444.25cc61d8@posting.google.com> NNTP-Posting-Host: 210.55.211.10 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1054680276 5779 127.0.0.1 (3 Jun 2003 22:44:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 3 Jun 2003 22:44:36 GMT Xref: archiver1.google.com comp.unix.tru64:9995 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