User`s guide
4-164
Guide to Printers and Printing
Supposing that the application does not allow the insertion of carriage returns into the data
stream, you can fix this problem with a simple filter, as follows:
#include <stdio.h>
main(int argc, char **argv)
{
int ch ;
while (EOF != (ch = fgetc(stdin)))
{
switch (ch)
{
case 10: fputc(ch,stdout) ;
fputc(0x0D,stdout) ;
break ;
default: fputc(ch,stdout) ;
break ;
}
}
}
Compile this and name it cr_mapper . and install it somewhere accessible, such as
/usr/lib/lpd. Assign it ownership of root.printq and permissions 555 .
Assuming you have an ASCII queue named asc on an IBM 4029 LaserPrinter, in AIX 4 you
can use lsvirprt to select the asc queue and then format the f1 filter attribute. You should
see something like the following:
User defined filter 1
f1 =
As the f1 attribute has a null default value, the definition is sparse.
Edit the f1 attribute so its definition appears as follows:
User defined filter 1
f1 =
’/usr/lib/lpd/cr_mapper’
When you save the new definition of f1, you can again format it with lsvirprt; you should
see something like the following:
User defined filter 1
f1 = /usr/lib/lpd/cr_mapper
’/usr/lib/lpd/cr_mapper’
The f1 filter can now be used from the command line by using commands such as:
qprt –Pasc –f1 filename
enq –Pasc –o –f –o 1 filename
If the _d attribute wasn’t set to p, the –dp flag and argument would have to be added to the
commands.
qprt –Pasc –dp –f1 filename
enq –Pasc –o –d –o p –o –f –o 1 filename
The cr_mapper program reads characters from stdin and writes them to stdout.
Whenever it reads and writes a linefeed (a hex A, or decimal 10), it writes out a carriage
return (a hex D).