[comp.unix.xenix.sco] Redirecting printer output from a PC to lp

john@cstreet.com (John Poplett) (10/04/90)

This evening I got intrigued with the possibility (and low-cost!)
of redirecting printer output from a PC running MS-DOS to a
SCO-based system (Xenix 386 2.3.2) and onto lp. I established a 
serial connection, used the "mode" command on DOS to redirect 
printer-bound output to COM1 and set about to write a shell-script 
to snag I/O from the serial line and reroute it to lp. That's 
where the fun begins.

I setup the DOS machine with two mode commands:

mode LPT1:=COM1:
mode COM1:12

This establishes the primary serial port as the primary port for 
printer output at a baud rate of 1200 at 7 bits and even parity.

The shell script below has (at least) two failings. 1) I haven't
succeeded in coaxing it to detect end of file and 2) after much
mucking around with cr/lf mapping, I never convinced the line
discipline to properly map cr/lf pairs to linefeeds (with
double-spacing as the regrettable result).

:

#
# parity = cs7 + parenb (even parity enabled)
#


(stty parity -icanon -isig -echo min 1 time 1 1200 ; cat) < /dev/tty2a |
lp -ob

exit 0

If anyone can make suggestions on improving this shell script (or my
approach in general), please let me know. I'll post if there's interest.

John
-- 
John Poplett @ C Street Software     | A woman who doesn't change
312 Wolff St. Oxnard, Ca. 93033 USA  | her mind, doesn't have one.
(805) 486-7807 / john@cstreet.com    |      ~ Mae West

root@smarine.UUCP (Chris Hapgood) (10/05/90)

The problem about detecting an end-of-file condition is simple: DOS
doesn't supply the EOF and most applications don't write one.  The
problem of not being able to determine EOF from DOS clients on a
network is most easily solved with a time-out feature. 
I believe some networks also use a method that depends upon the 
application returning to DOS.  This is pretty annoying if it is
the only method.  It also has to be performed from the client end.


-- 
Chris Hapgood		@Virginia.EDU,@smarine.uucp:cch0241@medusa
2111 Michie Drive #100		...!uucp!virginia!smarine!medusa!cch0241
Charlottesville, VA  22901
H:(804) 977-8345 W:(804) 974-2584