[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Provide a /bin/cat based inline encoding?
From: |
Pete Forman |
Subject: |
Re: Provide a /bin/cat based inline encoding? |
Date: |
Mon, 15 Mar 2004 11:00:13 +0000 |
At 2004-03-14 17:09 +0100, Kai Grossjohann wrote:
Kai Grossjohann <address@hidden> writes:
> So it would be useful to allow Tramp to interoperate with really dumb
> hosts, which have neither Perl nor uuencode, nor mimencode.
Maybe it's useful to use "sed -ne l"? Please try this on a number of
files. Include non-ascii characters in them, put $ signs in them, put
tabs and \r in them.
I'm not sure if the output format of "sed -ne l" is the same
everywhere. I tried FreeBSD (-current) and GNU/Linux (Debian woody),
and they seem to be the same.
The IRIX 6.5.5m version does not conform. Two faults that I've
noticed are:
No $ at the end of the line
Octal escape of ^A is \01 but it should have three digits \001
There are three versions of sed on Solaris 8. Only the one in
/usr/xpg4/bin/ conforms. The ones in /usr/bin/ and /usr/ucb/ behave
in the same way as Irix.
AIX 4.3 is okay.
Something to watch out for using standard UNIX utilities for encoding
is that the text lines input must not contain NUL (\000) and must not
exceed {LINE_MAX} bytes in length.
This would allow us to encode files on the remote end. Lisp code can
be used to decode them.
For the other direction, it might work to use "echo -e" and octal
escapes. Except that I think that "echo -e" is not standardized.
Hm. Is there a program which is known to grok octal escapes
everywhere?
Here is a vintage piece of script that has served me well.
# Look for a version of echo that handles escapes
if [ `echo "a\062z"` = a2z ]
then ECHOE="echo"
elif [ `echo -e "a\062z" 2>&1` = a2z ]
then ECHOE="echo -e"
elif [ `print "a\062z" 2>&1` = a2z ]
then ECHOE="print"
elif [ `/bin/echo -e "a\062z" 2>&1` = a2z ]
then ECHOE="/bin/echo -e"
else ECHOE="/bin/echo"
fi
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
address@hidden -./\.- opinion of Schlumberger, Baker
http://petef.port5.com -./\.- Hughes or their divisions.