[comp.unix.programmer] Raw mode on lp - Help!

kdq@demott.COM (Kevin D. Quitt) (10/12/90)

    I need to dump out a file to the printer, which file contains
characters that have the high bit set (for graphics).  I'm running on a
Motorola Delta 3600, SYSV R3V5.1.  Why doesn't the following work?

#include	<sys/lprio.h>
#include	<stdio.h>
#include	<sys/fcntl.h>

char	buffer[ 4096 ];

void main()
{
	int	lp, file, bytes;
	struct lprio	lpr;

	lp	= open( "/dev/lp147", O_WRONLY, 0600 );
	if ( lp  ==  -1 )
		exit(1);

	ioctl( lp, LPRGET, &lpr );
	lpr.ind	= 0;
	ioctl( lp, LPRSET, &lpr );

	ioctl( lp, LPRRAW, &lpr );


	file	= open( "/usr/spool/uucppublic/prntscrn", O_RDONLY, 0 );

	while ( bytes = read( file, buffer, sizeof( buffer )))
		write( lp, buffer, bytes );

	close( file );
	close( lp );
}



    Thanks in advance.

tim@.UUCP (Tim Dawson) (10/16/90)

kdq@demott.COM (Kevin D. Quitt) writes:


>    I need to dump out a file to the printer, which file contains
>characters that have the high bit set (for graphics).  I'm running on a
>Motorola Delta 3600, SYSV R3V5.1.  Why doesn't the following work?
...
>	lp	= open( "/dev/lp147", O_WRONLY, 0600 );
...

Well, I hate to tell you this, but this device has been given a number of 
"Features" that may make this impossible such as:

1) A maximum page width of something like 128 columns
2) Form Feed after a page
3) As I recall, the driver also will only pass 7 bit characters, and then only
   those which are eprintable or are recognized controls.

I short, they attempted to implement some desireable features in the driver 
instead of in lp where they belong.  There is a workaround for the column 
width problem, and maybe for the form feed, but the last time I pursued this, 
running graphic character codes out this device is still very painful if not
impossible.
--
================================================================================
Tim Dawson (...!texsun!Athena!MIS1!tim)  Motorola Computer Systems, Dallas, TX.

"God gave me a brain and I give Him the glory by using it!"