Subject: Re: Printing at Home

From: David L Miller <[email-masked]>
Date: Fri, 14 Oct 1994 10:20:49 -0700

The attached program is extracted from the contrib/utils directory of the 
Pine source distribution.....

|\ |  |\/|  David L. Miller    [email-masked]  (206) 685-6240
|/ |_ |  |  Software Engineer, Pine Development Team   (206) 685-4045 (FAX)
University of Washington, Networks & Distributed Computing, JE-20
4545 15th Ave NE, Seattle WA 98105, USA

On 12 Oct 1994, David Warness wrote:

> Date: 12 OCT 1994 15:30:31 GMT 
> From: David Warness <[email-masked]>
> Newgroups: comp.mail.pine
> Subject: Printing at Home 
> 
> Pine has the wonderfull feature of being able to print text at home even
> though you're dialed in remotely.  Does there exist somewhere a program
> that will allow the same thing w/o having to mail something to you?
> 
> local-print <file_name>
> 
> If someone somewhere has seen something like this lurking around .. I'd
> appreciate a push in the right direction.
> 
> --
> -Dave
> 
> +-----------------------------------------------------------------------------+
> | David Warness       | Psychiatrists say that one out of four people are     |
> | Look for me at ...  | mentally ill. Check three friends. If they're ok,     |
> | [email-masked] | you're it!                                            |
> +-----------------------------------------------------------------------------+
> 
> 

/*
 * ansiprt.c
 *
 * Simple filter to wrap ANSI media copy escape sequences around 
 * text on stdin.  Writes /dev/tty to get around things that might be
 * trapping stdout.  This is actually a feature because it was written
 * to be used with pine's personal print option set up to take "enscript"
 * output and send it displayward to be captured/printed to a postscript 
 * device.  Pine, of course, uses popen() to invoke the personal print
 * command, and interprets stdout as diagnostic messages from the command.
 *
 * Michael Seibel, [email-masked]
 *
 * 21 Apr 92
 *
 */
#include <stdio.h>
#include <sys/file.h>

#define	BUFSIZ	8192

main(argc, argv)
int  argc;
char **argv;
{
    char c[BUFSIZ];
    int  n, d;
    int  ctrld = 0;

    if(argc > 1){
        n = 0;
	while(argc > ++n){
	    if(argv[n][0] == '-'){
		switch(argv[n][1]){
		  case 'd':
		    ctrld++;
		    break;
		  default :
		    fprintf(stderr,"unknown option: %c\n", argv[n][1]);
		    break;
		}
	    }
        }
    }

    if((d=open("/dev/tty",O_WRONLY)) < 0){
        perror("/dev/tty");
	exit(1);
    }

    write(d,"\033[5i", 4);
    while((n=read(0, c, BUFSIZ)) > 0)
	write(d, c, n);

    if(ctrld)
	write(d, "\004", 1);

    write(d,"\033[4i", 4);
    close(d);
}

---

From: [email-masked] (David Warness)
Date: 12 Oct 1994 15:30:31 GMT

local-print <file_name>

--
-Dave