At 01:42 PM 2/11/2002 , Tom Lane wrote:
>It's not ideal, certainly, but I think it's preferable to continuing to 
>get burned every time a pg_dump file comes within hailing distance of Windoze.

Perhaps something along this line would be useful.

/* ftpfix.c - ASCII to binary fixup - 1.2 */

/*
** A quick and dirty filter intended to undo the damage caused
** by using FTP in ASCII mode on a binary file.
*/

#include <stdio.h>

void exit();

main()
{
    int         c;                              /* a generic character */

    while ((c = getchar()) != EOF)              /* read the file */
    {
        redo:
        if (c != '\r')                          /* Carriage Return? */
            (void) putchar(c);                  /* copy to output if not */
        else
        {
            if ((c = getchar()) == EOF)
            {
                (void) putchar('\r');           /* wrap up */
                exit(0);
            }
            else
            {
                if (c != '\n')                  /* CR/LF pair? */
                    (void) putchar('\r');       /* catch up stream */
                goto redo;
            }
        }
    }
}

         -crl
--
Chad R. Larson (CRL22)    [EMAIL PROTECTED]
   Eldorado Computing, Inc.   602-604-3100
      5353 North 16th Street, Suite 400
        Phoenix, Arizona  85016-3228

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to