delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/01/21/21:31:53

From: TerryL AT ultimatetechnology DOT com (Lincoln, W. Terry)
Subject: RE: uudecode?
21 Jan 1999 21:31:53 -0800 :
Message-ID: <9901211614.AA18911.cygnus.gnu-win32@net2.netacc.net>
Mime-Version: 1.0
To: John Cooper <John DOT Cooper AT citrix DOT com>,
"'gnu-win32 mail list'" <gnu-win32 AT cygnus DOT com>

------ =_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)        \    | |
WTerryLincoln AT engineer DOT com              \ / | | \
http://www.angelfile.com/ny/TerryLincoln \  | |
==========================================  ~~~
Opinions expressed do not represent the management
of UTC.



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


 ----------------------------------------------------
root AT jacob DOT remcomp DOT fr (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
"gnu-win32-request AT cygnus DOT com" 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"

QkVHSU46VkNBUkQNClZFUlNJT046Mi4xDQpOOkxpbmNvbG47V2FycmVuOztNci47DQpGTjpXY
XJyZW4gVGVycnkgTGluY29sbiAoRS1tYWlsKQ0KT1JHOlVUQztFbmdpbmVlcmluZw0KVElUTE
U6U2VuaW9yIEVuZ2luZWVyDQpURUw7V09SSztWT0lDRTooNzE2KSA5MjQtOTUwMA0KVEVMO0h
PTUU7Vk9JQ0U6KDcxNikgMzc3LTM5NTkNClRFTDtDRUxMO1ZPSUNFOig3MTYpIDI2MS0zOTU5
DQpURUw7Q0FSO1ZPSUNFOg0KVEVMO1dPUks7RkFYOig3MTYpIDkyNC0xNDM0DQpBRFI7V09SS
zo7VmljdG9yOzEwMCBSYXdzb24gUm9hZDtWaWN0b3I7Tlk7MTQ1NjQtMDAwMDtVbml0ZWQgU3
RhdGVzIG9mIEFtZXJpY2ENCkxBQkVMO1dPUks7RU5DT0RJTkc9UVVPVEVELVBSSU5UQUJMRTp
WaWN0b3I9MEQ9MEExMDAgUmF3c29uIFJvYWQ9MEQ9MEFWaWN0b3IsIE5ZIDE0NTY0LTAwMDA9
MEQ9MEFVbml0ZWQgU3RhdGVzIG9mPQ0KIEFtZXJpY2ENCkFEUjtIT01FOjs7MTAwIENvdXJ0c
2hpcmUgTGFuZTtQZW5maWVsZDtOWTsxMDUyNi0yNjc4O1VuaXRlZCBTdGF0ZXMgb2YgQW1lcm
ljYQ0KTEFCRUw7SE9NRTtFTkNPRElORz1RVU9URUQtUFJJTlRBQkxFOjEwMCBDb3VydHNoaXJ
lIExhbmU9MEQ9MEFQZW5maWVsZCwgTlkgMTA1MjYtMjY3OD0wRD0wQVVuaXRlZCBTdGF0ZXMg
b2YgQW1lcmk9DQpjYQ0KRU1BSUw7UFJFRjtNUzpVTFRJTUFURS9VVENQTy9MaW5jb2xuVA0KU
kVWOjE5OTkwMTIxVDEzMzYwM1oNCkVORDpWQ0FSRA0K

------ =_0_MIME_Boundary_83.36a75188.malbp0u0.pc003.ultimate.com--
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019