Discussion:
poor mans uudecode / uuencode
(too old to reply)
a***@spenarnc.xs4all.nl
2024-07-29 10:17:45 UTC
Permalink
I got annoyed with google, refusing to deliver a zip file.

Assuming a case-insensitive Forth that allows digits into base 64
I came up with a poor mans uudecode/uuencode for linux.
This assumes scripting and interpreted control structures.
In ciforth at least it could be compiled as easily.
(Executables take up more space than scripts.)

16 byte chunks translate to 22/23 printable characters
by mere printing them in BASE 64.
It works on 32 bits but the chunks are half.

/-------------------------- 8< ENCODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 2 CELLS 0 READ-FILE THROW WHILE 2@ .UD CR REPEAT
/-------------------------- 8< -----------------------------
You may need to define .UD if you don't have it
: .UD <# #S #> TYPE ;

/-------------------------- 8< DECODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 64 ACCEPT DUP WHILE
0. 2SWAP >NUMBER 2DROP DSP@ 2 CELLS TYPE 2DROP REPEAT
/-------------------------- 8< -----------------------------

If you can't address the stack, you will substitute
<untested> /DSP@ 2 CELLS /PAD 2! PAD 2 CELLS / <untested>

Sending
uuen.script < hcc2020feb.zip >q.txt
Receiving:
uude.script > hcc2020feb.zip <q.txt

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -
sjack
2024-07-30 13:07:18 UTC
Permalink
Post by a***@spenarnc.xs4all.nl
I got annoyed with google, refusing to deliver a zip file.
Assuming a case-insensitive Forth that allows digits into base 64
I came up with a poor mans uudecode/uuencode for linux.
Agree, don't reinvent; if Linux has a fine utility for the
purpose, then just pass it the parameters and fetch the results:

sys base64 foo > foo.b64 # for encoding
sys base64 -d foo.b64 >foo # for decoding

SYS Toad word to make Linux call (fork).
base64 Linux utility

--
me
dxf
2024-07-31 02:37:01 UTC
Permalink
Post by sjack
Post by a***@spenarnc.xs4all.nl
I got annoyed with google, refusing to deliver a zip file.
Assuming a case-insensitive Forth that allows digits into base 64
I came up with a poor mans uudecode/uuencode for linux.
Agree, don't reinvent; if Linux has a fine utility for the
sys base64 foo > foo.b64 # for encoding
sys base64 -d foo.b64 >foo # for decoding
SYS Toad word to make Linux call (fork).
base64 Linux utility
Standard encodings wouldn't fool mail systems?

Loading...