Subject: How to append to top of document?

From: Jens Kjaerulff <[email-masked]>
Date: Tue, 27 Oct 1998 12:18:46 +0100 (MET)

I hope this is the right place to ask:

In Pine, when I export a mail to an existing file, it gets appended to the
bottom of the document. How do I change this so that it get appended to
the top instead?

Please mail reply directly to:

[email-masked]

Thank you for your help

-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Mike Brudenell <[email-masked]>
Date: Tue, 27 Oct 1998 12:05:37 +0000

Greetings -

> I hope this is the right place to ask:

Hmmmm.... strictly speaking you should be asking in the comp.mail.pine
Usenet News group instead.  As I recall that is where general user-level
requests for help should go, whereas the Pine-Info mailing list is really
more for discussion about problems administrators experience setting up or
configuring Pine and discussion of bugs etc.

Be warned that there seem to be some very bolshy people around on the
Pine-Info list at present, so you may get a few less-than-pleasant replies.
:-(

> bottom of the document. How do I change this so that it get appended to

There isn't an easy way to do this.  If you pause for a moment and consider
an existing text file you should be able to see that adding text to the end
of it (appending) is a very easy and cheap operation:

	*  Open file for output, but DON'T truncate (empty) it;
	*  Position write-pointer at end of data;
	*  Write out new data;
	*  Close file.

In contrast prepending (put new material at the start of the file) or
elsewhere in the file (inserting) is expensive, involving reading in the
data already in the file, writing out the new material, then re-writing out
the previous contents.

It is also risk-prone: for example if you run out of disk space during an
APPEND Pine can truncate the file back to its original size and its content
is left intact (but without the new material, which it can warn you about).
However if you are prepending/inserting then your quota might run out
before the file's previous content is completely written out.  The result
would be a corrupted file which MIGHT have (some of) the new material, and
would DEFINITELY have lost some of the materialthat used to be in there and
you thought safe.

(There are ways around this, but it involves using even more disk space to
write a temporary copy of the file which is then renamed over the old one.)

If you REALLY need to insert new stuff at the beginning of the file you can
probably use Pine's Pipe command to achieve the effect.  (But that, as they
say, is left as an excercise for the reader. ;-)

Cheers,

Mike Brudenell
-- 
The Computing Service, University of York, Heslington, York Yo10 5DD, UK
Tel: +44-1904-433811  FAX: +44-1904-433740  http://www.york.ac.uk/~pmb1/

* Unsolicited commercial e-mail is NOT welcome at this e-mail address. *

---

From: "Robin S. Socha" <[email-masked]>
Date: Tue, 27 Oct 1998 12:41:20 +0100

> bottom of the document. How do I change this so that it get appended to

That's not possible out of the box. You could use the custom print command to
pipe the file into a temp file and then cat the file you want to append to
into that temp file, then overwrite the existing file. Ummm... this is pretty
braindamaged. Perl, anyone?

Robin

-- 
Robin S. Socha
<http://www.kens.com/robin/>