/* 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 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; } } } }