Subject: RE: uudecode?
From: [email-masked] (Lincoln, W. Terry)

21 Jan 1999 21:31:53 -0800
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/mixed;
    boundary="---- =_0_MIME_Boundary_83.36a75188.malbp0u0.pc003.ultimate.com"
To: John Cooper <[email-masked]>,
        "'gnu-win32 mail list'" <[email-masked]>

------ =_0_MIME_Boundary_83.36a75188.malbp0u0.pc003.ultimate.com

All,

The source code that was submitted uses an uninitialized variable and it   
will generate garbage on some compilers.
See:
 ------------------------------------------------------cut here:   
uuencode.c
#include <stdio.h>
#define ENC(c) ((c) ? ((c) & 077) + ' ': '`')
static int uuencode(char *nom)  /* nom means 'name' in french :-) */
{
    int ch, n, idx;
/*      ^^
**  Declaration */
    register char *p;
    char buf[80], outbuf[250];
    FILE *in;

    if ((in = fopen(nom, "rb")) == NULL)
        return 1;  /* please add some error checking/reporting */
    printf("begin 0666 %s\n",nom);/* note: no attempt to fake any   
permissions
*/
    while ((n = fread(buf, 1, 45, in)) != 0) {
        idx = 0;
        outbuf[idx++] = ENC(ch);
/*                          ^^ first use.
    Where is first initialization? */
        for (p = buf; n > 0; n -= 3, p += 3) {
            ch = *p >> 2;
            ch = ENC(ch);
            outbuf[idx++] = ch;
            ch = ((*p << 4) & 060) | ((p[1] >> 4) & 017);
            ch = ENC(ch);
            outbuf[idx++] = ch;
            ch = ((p[1] << 2) & 074) | ((p[2] >> 6) & 03);
            ch = ENC(ch);
            outbuf[idx++] = ch;
            ch = p[2] & 077;
            ch = ENC(ch);
            outbuf[idx++] = ch;
        }
        outbuf[idx++] = '\n';
        outbuf[idx] = 0;
        printf("%s", outbuf);
    }
    printf("%c\nend\n", ENC(0));
    fclose(in);
    return 0;
}

W. Terry Lincoln                    \     \ | | /
Senior Engineer                      \     _| |_
Ultimate Technology Corporation       \   |_   _|
division of Tridex(NASDAQ/trdx)        \    | |
[email-masked]              \ / | | \
http://www.angelfile.com/ny/TerryLincoln \  | |
==========================================  ~~~
Opinions expressed do not represent the management
of UTC.

 -----Original Message-----
From: John Cooper [mailto:[email-masked]]
Sent: Wednesday, January 20, 1999 2:23 PM
To: root
Cc: John Cooper; gnu-win32
Subject: Re: uudecode?

 ----------------------------------------------------
[email-masked] (root) writes:

 > Let's stop this uuencode/decode discussion.  Here are two small little
 > programs in that old but powerful language we all know somehow.

This source simply doesn't work for me - it generates all sorts of   
different
characters at the beginning of encoded lines, rather than the "M" that I   
see
with most uuencoders.

I finally pulled over the sharutils-4.2 source, got that to build under   
NT and
then carefully enabled (or disabled) the binary flag on the fopen calls.   
 It
now seems to work fine - without mucking with mounts or using bash (I   
prefer
zsh).

Thanks for all the ideas...

    --- John

 -
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".
[[ WARREN~1.VCF : 3851 in WARREN~1.VCF ]]  

------ =_0_MIME_Boundary_83.36a75188.malbp0u0.pc003.ultimate.com
Content-Type: application/octet-stream; name="WARREN~1.VCF"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="WARREN~1.VCF"

------ =_0_MIME_Boundary_83.36a75188.malbp0u0.pc003.ultimate.com--
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".