CGI Tektronix Emulator

Ronald Florence ron at mlfarm.uucp
Tue Mar 13 18:59:11 AEST 1990


When I posted the CGI Tektronics emulator to comp.sources.misc, I
probably should have included this bit of code.  Most tektronics plots
look best in landscape mode.  Unfortunately, the SCO Laserjet CGI 1.1
driver landscape mode is broken: it sends a spurious positioning
sequence before each line of output.  I reported the bug to SCO years
ago.  They pretty much said "Well, maybe it is ... who cares?"

The following simple-minded code compiles into a filter that will let
the SCO Laserjet CGI driver work in landscape mode.  We use it with an
option in our lp-interface ("lp -oS"); it could be used in a CGIPRNT
environmental declaration:

	setenv ORIENTATION landscape
	setenv CGIPRNT "laserjet | cgiland | lp -og"

Then run "tek -p" to get hardcopy output.

__________________________
#! /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:
#	cgiland.c
# This archive created: Tue Mar 13 08:43:26 1990
# By:	Ronald Florence (Maple Lawn Farm, Stonington, CT)
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'cgiland.c'" '(1024 characters)'
if test -f 'cgiland.c'
then
	echo shar: "will not over-write existing file 'cgiland.c'"
else
sed 's/^X//' << \SHAR_EOF > 'cgiland.c'
X/* 
X * cgiland.c
X * copyright 1989 Ronald Florence (ron at mlfarm)
X *
X * kluge driver to filter spurious "\033&a864V" sequences out of
X * cgi 1.1 hp driver output
X */
X
X
X#include <stdio.h>
X#define ESC '\033'
X
Xmain()
X{
X  register c, checking = 0;
X  int  quit = 0;
X  char save[8];
X
X  while ((c = getchar()) != EOF)
X    {
X      if (c != ESC && checking == 0)
X	putchar(c);
X      else 
X	{
X	  switch (checking)
X	    {
X	    case 0 :
X	      break;
X	    case 1:
X	      if (c != '&')
X		quit++;
X	      break;
X	    case 2:
X	      if (c != 'a')
X		quit++;
X	      break;
X	    case 3:
X	      if (c != '8')
X		quit++;
X	      break;
X	    case 4:
X	      if (c != '6')
X		quit++;
X	      break;
X	    case 5:
X	      if (c != '4')
X		quit++;
X	      break;
X	    case 6:
X	      if (c != 'V')
X		quit++;
X	      break;
X	    }
X	  save[checking] = c;
X	  checking++;
X	  if (quit)
X	    {
X	      int k;
X	      for (k = 0; k < checking; k++)
X		putchar (save[k]);
X	      checking = 0;
X	      quit = 0;
X	    }
X	  else if (checking == 7)
X	    checking = 0;
X	}
X    }
X}
SHAR_EOF
if test 1024 -ne "`wc -c < 'cgiland.c'`"
then
	echo shar: "error transmitting 'cgiland.c'" '(should have been 1024 characters)'
fi
fi
exit 0
#	End of shell archive

--

Ronald Florence			ron at mlfarm.uu.net
				{yale,uunet}!hsi!mlfarm!ron



More information about the Comp.unix.xenix mailing list