[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inline methods without mimencode and Perl

From: Kai Großjohann
Subject: Inline methods without mimencode and Perl
Date: Tue, 30 Jul 2002 19:11:02 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (i686-pc-linux-gnu)

After some thinking it seems that inline methods can be made to work
even for strange remote systems which don't have a way for doing
base64 or uu encoding.

The idea is this: for reading a file from such a system, we use "od
-b".  This is documented to work even on Unix Version 7, so I'm
pretty sure it will work everywhere.

When writing a file to a system, we test a few variants.

* Maybe "echo -e" groks octal escapes.  So we just create a sequence
  of "echo -e" commands and redirect their output to the file we

* To make it really work, we will need to find out how to suppress
  the final newline.  Sometimes, "-n" is the trick, and sometimes,
  ending the sequence with "\c" is the trick.

* The printf(1) program is a more portable variant of echo, so it
  should be tried first.

* Something like "awk 'BEGIN{print("a\304b")}'" can be used.

All of the above potentially suffer from the null byte problem.  For
example, mawk will truncate the output at the null byte.  We need to
detect whether this is the case.  If it is the case, then we need to
revert to the following ugly hack for producing null bytes.  It is
really really really awful.

    dd if=/dev/zero bs=1 count=1

So, what do you folks think?  Is anyone there who would like to do
this?  It's not quite clear to me where in the current architecture
does all this detection fit in.  Clearly, if mimencode works, then we
don't want to invest all the work in figuring out how to suppress the
trailing newline...

And then there is the small matter of doing encoding and decoding on
the Emacs side.  Especially putting in the extra `dd' invocations
will look ugly.

A large number of young women don't trust men with beards.  (BFBS Radio)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]