/* * Well, sometimes it's a pain in the ass to have notepad * open a text file with "only" character 0x0a on the end * of every line. Because notepad for one uses 0x0d 0x0a. * * This will convert it... * * -h for help * * make with: * gcc -o crlf crlf.c */ #include #include #define CRLF2LF 0 #define LF2CRLF 1 #define DEBUG 0 void usage(char * name); void usage(char * name) { printf("%s will convert lf to cr/lf and the reverse.\n", name); printf("Usage: %s [] < > \n", name); printf("\nFlags:\n"); printf("\t-l : CR/LF to LF\n"); printf("\t-c : LF to CR/LF\n"); printf("\t-h : This message\n"); printf("\tDefault is LF to CR/LF\n"); exit(1); } int main(int argc, char * argv[]) { int i, opt = LF2CRLF; int c; char theChar; char lf = '\n'; char cr = '\r'; for(i=1;i