ORIGINAL QUESTION
~~~~~~~~~~~~~~~~~
> I'm using Pine 3.90 on an SS5 server running SunOS 4.1.3_U1. If I want
> to print something out from pine, it gives me the option to print to
> attached-to-ansi. If I select this, it will print out on an LPT1 port.
>
> Is there a shell (Perl, or whatever) script that is available somewhere
> that I can use in place of lp that will direct printing to the LPT1 port
> of a client PC using VT220 terminal emulation??
There are a series of escape sequences that you can use in VT100/220
emulation that will reroute characters from standard output destined for
the screen to the printer. To reroute characters to the printer, you use
<ESC>5i -- to send characters back to the screen again, you use <ESC>4i.
I compiled a C program sent to me from Daniel Bidwell that we are using
in lieu of lp services for all our end users. I have enclosed the source
code of that program below.
Thanks to Ken Rice <rice@green.harvard.edu>,
Laurel Arthur <LaurelC.Arthur@dwe.csiro.au>,
Henry Unger <hunger@hitech.com>, and
Daniel R Bidwell <bidwell@andrews.edu>.
+----------------------------------------+-----------------------------------+
| David J. Nelson | |
| Gopher and CSO Administration | |
| Office of Information and Technology | Merging onto the Information |
| Muhlenberg College - Allentown, PA | Superhighway in a Studebaker. |
| Internet: djnelson@rocky.muhlberg.edu | |
| Telephone: (610) 821-3460 | |
+----------------------------------------+-----------------------------------+
----- cut here -----
#include <stdio.h>
#define BUFSIZE 1000000
#define OPEN_PRINTER printf("\033[5i");
#define CLOSE_PRINTER printf("\f\033[4i");
int main(int argc, char **argv){
/*
* We had a problem compiling the function declaration this way. If your
* compiler doesn't like this, you might try redeclaring it as:
*
* int main (argc, argv)
* int argc;
* char **argv; {
*/
char buffer[BUFSIZE];
int i;
FILE *fp;
if(argc == 1){
OPEN_PRINTER
putchar('\r');
while(gets(buffer) != NULL){
puts(buffer);
}
putchar('\r');
CLOSE_PRINTER
}else if(argc > 1){
for(i=1;i<argc;i++){
if((fp=fopen(argv[i],"r")) == NULL){
fprintf(stderr,"Error reading %s\n",argv[i]);
}else{
OPEN_PRINTER
while(fgets(buffer,BUFSIZE,fp) != NULL){
fputs(buffer,stdout);
}
CLOSE_PRINTER
fclose(fp);
}
}
}
}
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:19 CDT