/*
 * $Header$
 *
 * d2u:
 *	dos to unix text file converter
 */

/*
 * $Log$
 *
 */

#include <stdio.h>

/* Simple version -- only works as a pipe (for now) */

/* Local defines							*/
/* Conviences for portability and legibility				*/
#ifndef TRUE
# define TRUE (1==1)
#endif
#ifndef FALSE
# define FALSE (0==1)
#endif
/* DOS related definitions						*/
#define CTL_Z	0x1a

/* Identify the current version						*/
char	*RcsHeader = "$Header$",
	*Copyright =
		"Copyright (c) 1994\nby Pasquale J. Villani\nAll rights reserved\n";



int main(int nArgc, char *pArgv[])
{
	FILE *pInputFp = stdin;
	FILE *pOutputFp = stdout;
	int wcChar;

	/* Translate the file one character at a time			*/
	while((wcChar = getc(pInputFp)) != EOF)
	{
		/* Look at the character, and translate it, if 		*/
		/* necessary						*/
		switch(wcChar)
		{

		/* newlines for DOS are CR-LF pairs, so throw out the	*/
		/* CR							*/
		case '\n':
			putc('\r', pOutputFp);
			/* Fall through */

		default:
			putc(wcChar, pOutputFp);
			break;
		}
	}
	putc(CTL_Z, pOutputFp);
}


