From: jgifford@attmail.com
Subject: (none)
Reply-To: jgifford@attmail.com
Organization: The Internet
Date: Sun, 12 Apr 1992 20:16:07 GMT

Thanks for all the help with my problem, turns out that I was getting bad codes
when I edited the multiple uue files to get one file.  I got uustrip.c,
which works great for this purpose.  I am going to try to include it here to
possibly help someone else later.
=========
/***
*From: joep@Stardent.COM (Joe Peterson)
*Subject: Program to strip out non-data lines from uuencoded files

*Date: 23 Jan 91 15:11:53 GMT
*Organization: Stardent Computer, Newton MA
*Lines: 123
* 
*The fact that uuencoded files are often broken up into several parts can be
*a pain.  There are several programs/scripts out there to strip out the
*non-data from these files, but none seem that robust.  There is no way
*for a program to catch every bad line of text, but you can get pretty close!
* 
*I wrote a small program (in C) to take a large file, which is a concatination
*of all the parts in the right order, and write the bare uuencoded file to
*stdout.  This can be piped into uudecode.  Note that there is no need to
*remove any text by hand.  It is very unlikely (unless the poster is very
*devious) that a bad line will sneak through.
* 
*The program first skips everything until hitting the string "begin " at
*the start of a line.  It then examines every line until "end" is encountered
*by itself.  For each line in between, it compares the encoded byte count with
*the actual number of bytes on the line (and allows one extra character at the
*end of the line - I don't know why some postings have this!).  It also makes
*sure all characters (except perhaps that one extra) are in the valid range.
*If the line does not pass these tests, it is discarded.  No attempt is made
*to look for things like CUT HERE, since these conventions seem to change
*from post to post.
 
*The program has worked for every file I have tryed to decode, but there may
*be some conventions I have not yet run across!  Happy decoding!
* 
*                                       Joe Peterson
*                                       joep@stardent.com
***/
 
/*** modified for VMS, usage now "uustrip infile.typ outfile.typ"
*                                       Wes Plouff 7-Apr-91
***/
 
 
#include    <stdio.h>
#include    <string.h>
 
main(argc, argv)
    int     argc;
    char    *argv[];
{
    FILE    *file,*ofile;
    char    line[128];
    int     start;
 
    if (argc != 3)
    {
        fprintf(stderr, "Usage: uustrip infile outfile\n");
        exit(1);
    }
 
    file= fopen(argv[1], "r");
 
    if (file == NULL)
    {
        fprintf(stderr, "Cannot open %s\n", argv[1]);
        exit(1);
    }
    ofile= fopen(argv[2], "w");
 
    start= 0;
    while (read_line(file, line) != EOF)
    {
        if (!strcmp(line, "end"))
        {
            fprintf(ofile," \nend\n");
            break;
        }
 
        if (!strncmp(line, "begin ", 6))
        {
            start= 1;
            fprintf(ofile,"%s\n", line);
            continue;
        }
 
        if (start && valid(line))
            fprintf(ofile,"%s\n", line);
    }
 
    fclose(file);
    fclose(ofile);
}
 
 
read_line(file, string)
    FILE           *file;
    char            string[];
 
{
    int             pos;
    char            c;
 
    pos = 0;
    while ((c = fgetc(file)) != '\n')
    {
        if (c == EOF)
        {
            string[0] = '\0';
            return (EOF);
        }
        string[pos++] = c;
    }
    string[pos] = '\0';
    return (0);
}
 
 
valid(string)
    char    *string;
{
    int     i, count, pad, byte_count, char_count;
 
    count= strlen(string);
 
    byte_count= (*string - ' ');
    if (byte_count == 0)
        return(0);
 
    pad= (byte_count % 3) ? (3 - (byte_count % 3)) : 0;
    byte_count += pad;
    char_count= byte_count * 4 / 3;
    if (((count - 1) != char_count) &&
        ((count - 2) != char_count))
        return(0);
 
    for (i=1; i<(char_count+1); ++i)
        if ((string[i] < ' ') || (string[i] > (' ' + 64)))
            return(0);
 
    return(1);
}
========== The End ========

To use, just save to file, and gcc uustrip.c -o /usr/bin/uustrip
Hope this is helpful, if not, flames to /dev/null      :)
Jim Gifford
jgifford@attmail.com