Subject: attachments

From: Michael Showers <[email-masked]>
Date: Wed, 13 Apr 1994 08:46:42 -0700 (PDT)

I do not understand how attachments work in Pine.  Coould someone help me 
answer this question from one of our end-users?

>  I sent an e-mail to the eastern US and a long ATTACHMENT came out 
>  looking like code. Is it correct to presume that the attachment was 
>  compressed?

Michael Showers                    | 2079-Columbia Ave.
Computer Systems Manager           | Trail, British Columbia
School District No. 11 (Trail)     | CANADA   V1R-1K7
[email-masked]          | voice: (604) 368-2234

-- A.K.A. The Technical Connection for the CIAO! Free-Net --

 /\       /\ /\
/  \^^^/\/ /^^^^\
                 ^^^^^^ It's great in the Kootenays.
----------------------------------------------------

---

From: Hussain Chinoy <[email-masked]>
Date: Wed, 13 Apr 1994 13:24:48 -0500 (CDT)

Hi there!
	
	This is sort of a unix question.  I've known for a long time that 
Pine can print to a printer using "attached to ansi," but what is the 
command to do that for a file from the unix prompt?

____________________________________________________________________________
   G. Hussain Chinoy		Head Consultant, Arts & Sciences NeXT Lab
   [email-masked]	Cupples I, Room 213
				314.935.4353
				Washington University in St. Louis

---

From: David L Miller <[email-masked]>
Date: Wed, 13 Apr 1994 12:16:12 -0700 (PDT)

Hussain,

The Pine source distribution includes a small utility program called 
ansiprt that will do this in the contrib/utils directory.  Documentstion 
for the program is included in the source file.

Thanks for the request!

--DLM

|\ |  |\/|  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

---

From: John Miller <[email-masked]>
Date: Wed, 13 Apr 1994 13:19:57 -0700 (PDT)

> for the program is included in the source file.

Well, the documentation doesn't really say how to use the command, or 
that the command line option, if present, tells whether to output a ctrl-d
after detecting the EOF on input.. or under what situations you might 
want to do that.  I simplified the program to the following, "ansiprint":

% more ansiprint.c

#include <stdio.h>

main (argc,argv)
char *argv[];
int argc;

{
        char c;

        putchar ('\033');
        putchar ('[');
        putchar ('5');
        putchar ('i');

        while ((c=getchar())!=EOF) putchar(c);
        putchar ('\f');

        putchar ('\033');
        putchar ('[');
        putchar ('4');
        putchar ('i');
}

I found that I had to add the \f (formfeed) at the end in order to force Mac
VersaTerm to print the unix file to attached imagewriter NOW..  otherwise
it just wanted to buffer it up and print when it had what it considered to be
a pagefull.  I found that ansiprt and pine's print had different results, so
I looked into pine's print routine to determine that the above did the trick. 

To use ansiprint:

	% ansiprint < myfile
or
	% cmd1 | cmd2 | ansiprint

ansiprint does not take a file name on the command line.  You must use 
indirection or put at the end of a pipeline.

Feel free to use.  No liabilities here.  :^)

John Miller
Lewis & Clark College

---

From: Hussain Chinoy <[email-masked]>
Date: Wed, 13 Apr 1994 16:19:07 -0500 (CDT)

John,

	Works like a charm!

	Thanks tons!

	hussain

________________________________
	G. Hussain Chinoy
	[email-masked]

---

From: Terry Gray <[email-masked]>
Date: Wed, 13 Apr 1994 14:36:20 -0700 (PDT)

On Wed, 13 Apr 1994, John Miller wrote:

> Well, the documentation doesn't really say how to use the command, or ...

Thanks John... The problem is that David inadvertently got a couple of 
extra words in his sentence.  It should have read:  "Documentation for 
the program *is* the source file." :)

(This is a Unix app, after all.)

-teg

---

From: John Miller <[email-masked]>
Date: Wed, 13 Apr 1994 15:50:36 -0700 (PDT)

> (This is a Unix app, after all.)

Ha Ha!  I followed that convention in my source code as well...

Whoever picks that program up would do well to incorporate my usage notes as
comments.  The program really should take a filename as an argument as well. 
See any C textbook for the solution.  :^)

John

---

From: "Lisa M. Frye" <[email-masked]>
Date: Thu, 14 Apr 1994 11:19:08 -0400 (EDT)

John,

   I have a small program which does the same as your ansiprint.  
However, my program, as well as yours, do not take into account the time 
it takes for the printer to do a formfeed at the end of the page.  I am 
looking for a way to do that so printouts from unix to the ansi printer 
do not lose 3 lines between every page.

       Lisa Frye                       [email-masked]
       Network Software Specialist     LMS Annex Room 105
       Kutztown University             phone: 610-683-4474
       Kutztown, PA. 19530             fax:   610-683-4634

  "You can bring a person to the university, but you can't make him think."

---

From: John Miller <[email-masked]>
Date: Thu, 14 Apr 1994 11:18:29 -0700 (PDT)

> do not lose 3 lines between every page.

Lisa, et. al,

how about adding:

	for (i=0; i<PADCOUNT; i++) putchar ('\0');

just after any formfeed sent to the printer -- this send some nulls out to
keep the serial/parallel port busy while the printer does the form feed. 
(The printer will just drop the nulls instead of good characters).

Here is a revised program.  Adjust PADCOUNT upwards till it works.
Let us know what value works for your printer & configuration.

#include <stdio.h>
#define PADCOUNT 10

main (argc,argv)
char *argv[];
int argc;

{
        char c;
	int i;

        putchar ('\033'); putchar ('['); putchar ('5'); putchar ('i');

        while ((c=getchar())!=EOF) {
		putchar(c);
		if (c=='\f') for (i=0; i<PADCOUNT; i++) putchar ('\0');
	}

        putchar ('\f');      for (i=0; i<PADCOUNT; i++) putchar ('\0');

        putchar ('\033'); putchar ('['); putchar ('4'); putchar ('i');

}

---

From: Matt Simmons <[email-masked]>
Date: Thu, 14 Apr 1994 15:58:30 -0500 (CDT)

> do not lose 3 lines between every page.

Do something like this:

   if char=^L then sleep(1) 

one second should be long enough, but it can always be lengthened.  Hell, 
you could put the sleep time as a command line option
 _________
|_    __  \  U R D U E  U N I V E R S I T Y      Womens 94 NCAA Final Four
  |  |__|  |  Currently: [email-masked]     Bradley University
  |   ____/              [email-masked] Peoria, Illinois
  |  |  Spring 94 - Soph by years, Junior by credits
 _|  |_ Fall 94   - Junior by years, Soph by credits  - Only Purdue makes
|______| U R D U E   U N I V E R S I T Y                  it possible