termcap entries for LN03's
George Robbins
grr at cbmvax.UUCP
Fri Mar 31 16:24:04 AEST 1989
In article <980 at lgnp1.LS.COM> vskahan at lgnp1.LS.COM (Vince Skahan) writes:
>
> does anyone know how to kick a LN03 into 132 character lanscape
> mode and back to "normal" from Ultrix ??? We have a VMS procedure
> that prints a file containing the proper escape sequences to do the
> trick from VMS systems...but you need to print with a /PASSALL (I think)
> flag to pass the escape characters to the printer...
We use this dumb little filter to set rational margins for both portrait
and landscape printouts. It prepends the appropriate escape codes to
set portrait or landscape mode and appends the command to reset the
default settings.
Usage:
ln03 -P filename | lpr - or - pr filename | ln03 -P | lpr
ln03 -L filename | lpr - or - pr filename | ln03 -L | lpr
I once made up versions for Imagen and some other printer, but it's
all pretty much the same. Orginally there were going to be options
to set mode/margins/whatnot, but the -L/-P "macro" switches seemed to
be adequate...
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# ln03.c
# This archive created: Fri Mar 31 01:16:20 1989
export PATH; PATH=/bin:$PATH
if test -f 'ln03.c'
then
echo shar: will not over-write existing file "'ln03.c'"
else
sed 's/^X//' << \SHAR_EOF > 'ln03.c'
X#include <stdio.h>
X
Xint didfile;
X
Xmain(argc,argv)
X int argc;
X char *argv[];
X{
X int argn;
X
X didfile = 0;
X for (argn = 1; argn < argc; )
X argn = doarg(argc, argv, argn);
X if (didfile == 0)
X dostdin();
X printf("\033[!p");
X fflush(stdout);
X}
X
Xint
Xdoarg(argc, argv, argn)
X int argc;
X char *argv[];
X int argn;
X{
X char *argp;
X char argl;
X
X argp = argv[argn++];
X if (*argp++ != '-') {
X dofile(--argp);
X didfile++;
X } else
X while(argl = *argp++)
X argn = doswitch(argc, argv, argn, argl);
X return(argn);
X}
X
Xint
Xdoswitch(argc, argv, argn, argl)
X int argc;
X char *argv;
X int argn;
X char argl;
X{
X int targ;
X
X switch(argl) {
X case 'L':
X printf("\033[?21 J\033[15m\033[5;255s\015");
X break;
X case 'P':
X printf("\033[?20 J\033[12m\033[13;255s\015");
X break;
X case 'M':
X printf("\033[10;255s");
X break;
X case 'l':
X case 'p':
X default:
X fprintf(stderr,"invalid switch -%c\n",argl);
X }
X return(argn);
X}
X
Xint
Xdofile(argp)
X char *argp;
X{
X FILE *input;
X int c;
X
X if (input = fopen(argp, "r")) {
X while ((c = fgetc(input)) != EOF)
X putchar(c);
X fclose(input);
X } else
X fprintf(stderr,"can't open %s\n",argp);
X}
X
Xdostdin()
X{
X int c;
X while ((c = getchar()) != EOF)
X putchar(c);
X}
X
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
--
George Robbins - now working for, uucp: {uunet|pyramid|rutgers}!cbmvax!grr
but no way officially representing arpa: cbmvax!grr at uunet.uu.net
Commodore, Engineering Department fone: 215-431-9255 (only by moonlite)
More information about the Comp.unix.ultrix
mailing list