[chrisl@stud.ntnu.no: Printing through telnet to Windows desktop printer]

From: Brian E. Lavender (brian@brie.com)
Date: Sat Aug 07 1999 - 00:02:18 PDT


I noticed there are couple mutt users out there, and I implemented this
cool printing solution. It's taken from pine. I guess those pine guys
got some things right! Mutt guys got the rest right.

I don't know how many of you use lynx out there, but looking at lynx
2.8.2, it looks real clean. It's nice to have a clean text base web
browser.

Hopefully no gooey folks are reading this.

In case you are wondering what mutt is, it is a screen based mail reader.
It borrows heavily from elm. The most imediate feature that I noticed
is its capability to display threaded messages. It is somewhat difficult
to learn and not all that intuitive, but it has a long list of powerful
features. See http://www.mutt.org for details.

brian

----- Forwarded message from Christian Stigen Larsen <chrisl@stud.ntnu.no> -----

Date: Thu, 22 Jul 1999 01:41:51 +0200
From: Christian Stigen Larsen <chrisl@stud.ntnu.no>
To: mutt-users@mutt.org
Subject: Printing through telnet to Windows desktop printer
Mail-Followup-To: mutt-users@mutt.org
X-Mailer: Mutt 0.95.6i
Precedence: bulk

This is probably old hat to most of you, but I didn't know
about this nifty trick myself and discovered it worked very
well with mutt.

Problem: You ssh/telnet from a Windows machine and use Mutt
         for reading mail. You want to easily print your
         mail on your local Windows desktop printer.

Solution: ANSI supports printing, if you use e.g. SecureCRT
          for ssh connection, you can have SecureCRT trap
          print-sequences and send them to your local
          printer. And if you use a2ps for formatting, it
          will look good too (and you can add "page 1 of 4"
          etc.)

This is how:

          We found a small code-snippet in the (ugh) Pine
          contribution directory. We compiled it simply
          with "cc ansiprt.c -o lpransi".

          In the .muttrc file you must add something like

             set print_cmd="a2ps <options> | lpransi"

         or if you don't want postscript, simply:

             set print_cmd="cat - | lpransi"

         (do we need the "cat -", or is print_cmd="lpransi" enough?)
         This worked perfectly with our local printers. Note
         that you can use this (probably) on any system, but
         we only tested on Windows (probably depends on your
         telnet/ssh client, printer settings, and so on).

This is the file ansiprt.c that we found is attached.

Apologies to those who are grimacing right because this was completely
mandatory to all people that use Mutt. :-)

Cheers!

-- 
Christian Stigen Larsen -- http://www.sublevel3.org
    chrisl@stud.ntnu.no    http://www.stud.ntnu.no/~chrisl/

/* * 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, mikes@cac.washington.edu * * 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); }

----- End forwarded message -----

-- Brian Lavender http://www.brie.com/brian/



This archive was generated by hypermail 2b29 : Fri Feb 25 2000 - 14:29:06 PST