gedwards@ncratl.Atlanta.NCR.COM (Gordon Edwards) (07/13/90)
Anyone know where I can get a public domain copy of the uuencode program for DOS via anonymous ftp? -- Internet: Gordon.Edwards@Atlanta.NCR.COM NCR Corporation UUCP: uunet!ncrlnk!ncratl!edwards 2651 Satellite Blvd. Amateur Radio: N4VPH Duluth, GA 30136
davem@hpmwtd.HP.COM (Dave McQuate) (07/18/90)
Here's a quickie, no-frills version I wrote--it will encode each file listed on the command line, sending all the encoded stuff to standard out. I've used it in HP's version of unix but it should compile under Turbo C (link with "wildargs.obj" to get command line wild cards to work, tho I'm not sure why one would want to encode several files into one) or ... /* uuencode.c */ #include <stdio.h> #define add(c) ((c & 077) + ' ') int main(argc, argv) int argc; char *argv[]; { FILE *file; int i, j, k, l, m, bytes; char buffer[50]; for ( ++argv; argc-- && *argv; ++argv) { file = fopen(*argv, "rb"); printf("begin 777 %s\n", *argv); for ( ; ; ) { bytes = fread(buffer, 1, 45, file); buffer[bytes] = buffer[bytes + 1] = 0; printf("%c", add(bytes)); for (i = 0; i < bytes; i +=3) { j = buffer[i] >> 2; k = (buffer[i] << 4) & 060 | (buffer[i+1] >> 4) & 017; l = (buffer[i+1] << 2) & 074 | (buffer[i+2] >> 6) & 3; m = buffer[i+2] & 077; printf("%c%c%c%c", add(j), add(k), add(l), add(m)); } printf("\n"); if (bytes != 45) break; } printf("`\nend\n"); fclose(file); } } ___________________________________________________________________________ _