v17i081: pl - Write to printer attached to user's Terminal or PC, Patch01
Malcolm Carlock
malc at equinox.unr.edu
Thu Apr 4 14:27:11 AEST 1991
Submitted-by: Malcolm Carlock <malc at equinox.unr.edu>
Posting-number: Volume 17, Issue 81
Archive-name: pl/patch01
Patch-To: pl: Volume 17, Issue 72
The "tcput.c" program included with the recently posted PL program was
written in ANSI C, and hence on most systems will fail to compile if "cc"
is used to build it. The program, as distributed on unr.edu (134.197.1.2),
has been changed to fit the "standard" C model. The actual code follows.
Sorry; this should have been distributed in "standard" C originally.
There have also been some problems reporting in getting kermit to print
with PL when in heath-19 mode. It works for me using Kermit version 2.32,
but some other later versions appear to have a problem. According to the
latest on-line kermit docs nothing has changed in the printer control
escape sequences since 2.32. I'm wondering if there's a bug; I'll be
doing some more checking.
A way around the problem with heath-19 mode is to use Kermit's vt102
emulation instead. This appears to work with most (if not all) versions
of Kermit.
Hope this helps.
Malcolm L. Carlock Internet: malc at unr.edu
UUCP: unr!malc
BITNET: malc at equinox
----
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix at uunet.uu.net if you want that tool.
# Contents: PATCH01
# Wrapped by kent at sparky on Wed Apr 3 22:23:42 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive."'
if test -f 'PATCH01' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'PATCH01'\"
else
echo shar: Extracting \"'PATCH01'\" \(3049 characters\)
sed "s/^X//" >'PATCH01' <<'END_OF_FILE'
X*** tcput.c.ansi Wed Apr 3 22:11:57 1991
X--- tcput.c Wed Apr 3 22:10:34 1991
X***************
X*** 1,7 ****
X /*
X * tcput.c Find the given terminal capability in the termcap database,
X * interpet it, and print it to the terminal. Raw mode is used
X! * when printing to avoid system-level mappings.
X *
X * Similar to tput on SYSV unix, but doesn't allow instantiation
X * of parameter strings from the command line.
X--- 1,8 ----
X /*
X * tcput.c Find the given terminal capability in the termcap database,
X * interpet it, and print it to the terminal. Raw mode is used
X! * when printing to avoid system-level mappings, unless such
X! * a change isn't supported (i.e., a socket is in use.)
X *
X * Similar to tput on SYSV unix, but doesn't allow instantiation
X * of parameter strings from the command line.
X***************
X*** 12,21 ****
X #include <stdio.h>
X #include <sgtty.h>
X #include <sys/ioctl.h>
X
X #define PROG "tcput"
X
X! void do_args(char **);
X void usage();
X char *getenv();
X
X--- 13,25 ----
X #include <stdio.h>
X #include <sgtty.h>
X #include <sys/ioctl.h>
X+ #include <errno.h>
X
X+ extern errno;
X+
X #define PROG "tcput"
X
X! void do_args();
X void usage();
X char *getenv();
X
X***************
X*** 25,31 ****
X
X int mputc();
X
X! main(int argc, char **argv)
X {
X int val;
X char *cp = bp;
X--- 29,37 ----
X
X int mputc();
X
X! main(argc, argv)
X! int argc;
X! char **argv;
X {
X int val;
X char *cp = bp;
X***************
X*** 50,56 ****
X }
X
X void
X! do_args(char **argv)
X {
X for (++argv; *argv != NULL && **argv == '-'; ++argv) switch(*++*argv) {
X case 'T':
X--- 56,63 ----
X }
X
X void
X! do_args(argv)
X! char **argv;
X {
X for (++argv; *argv != NULL && **argv == '-'; ++argv) switch(*++*argv) {
X case 'T':
X***************
X*** 76,82 ****
X exit(1);
X }
X
X! mputc(int c)
X {
X putchar(c);
X return 0;
X--- 83,89 ----
X exit(1);
X }
X
X! mputc(c)
X {
X putchar(c);
X return 0;
X***************
X*** 86,97 ****
X {
X struct sgttyb port;
X
X! if (ioctl(0, TIOCGETP, &port) < 0) {
X perror("raw: stdin");
X exit(1);
X }
X port.sg_flags |= RAW;
X! if (ioctl(0, TIOCSETP, &port) < 0) {
X perror("raw: stdin");
X exit(1);
X }
X--- 93,104 ----
X {
X struct sgttyb port;
X
X! if (ioctl(0, TIOCGETP, &port) < 0 && errno != EOPNOTSUPP) {
X perror("raw: stdin");
X exit(1);
X }
X port.sg_flags |= RAW;
X! if (ioctl(0, TIOCSETP, &port) < 0 && errno != EOPNOTSUPP) {
X perror("raw: stdin");
X exit(1);
X }
X***************
X*** 101,112 ****
X {
X struct sgttyb port;
X
X! if (ioctl(0, TIOCGETP, &port) < 0) {
X perror("noraw: stdin");
X exit(1);
X }
X port.sg_flags &= ~RAW;
X! if (ioctl(0, TIOCSETP, &port) < 0) {
X perror("noraw: stdin");
X exit(1);
X }
X--- 108,119 ----
X {
X struct sgttyb port;
X
X! if (ioctl(0, TIOCGETP, &port) < 0 && errno != EOPNOTSUPP) {
X perror("noraw: stdin");
X exit(1);
X }
X port.sg_flags &= ~RAW;
X! if (ioctl(0, TIOCSETP, &port) < 0 && errno != EOPNOTSUPP) {
X perror("noraw: stdin");
X exit(1);
X }
END_OF_FILE
if test 3049 -ne `wc -c <'PATCH01'`; then
echo shar: \"'PATCH01'\" unpacked with wrong size!
fi
# end of 'PATCH01'
fi
echo shar: End of archive.
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.
More information about the Comp.sources.misc
mailing list