• poor mans uudecode / uuencode

    From albert@spenarnc.xs4all.nl@21:1/5 to All on Mon Jul 29 12:17:45 2024
    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 -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From sjack@21:1/5 to albert@spenarnc.xs4all.nl on Tue Jul 30 13:07:18 2024
    albert@spenarnc.xs4all.nl wrote:
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)