/* rplbs.c   MR 19/09/98 
   RePLace Backslash Sequences:
       Remove backslash-newline combinations, 
       Replace sequences \" \' \f \t \b \r \n \a \\ by <ABC>, where ABC is
         a short descriptive string,
       Replace \x where x is anything else with simply x. */

#include <stdio.h>

main()
	{
	int ic = 0x00; 
	int icpr;

	while ( icpr = ic, ( ic = getchar() ) != EOF )
		{
		if ( icpr == '\\' )
			{
			switch ( ic )
				{
			case '\n': break;

			case '"': printf( "<DBLQ>" ); break;
			case '\'': printf( "<SGLQ>" ); break;
			case 'f': printf( "<FF>" ); break;
			case 't': printf( "<TAB>" ); break;
			case 'b': printf( "<BSP>" ); break;
			case 'r': printf( "<CR>" ); break;
			case 'n': printf( "<NEWL>" ); break;
			case 'a': printf( "<BEL>" ); break;

			case '\\': printf( "<BSL>" ); ic = 0x00; break;

			default: putchar( ic ); break;
				}/*switch*/
			}
		else
			{
			if ( ic == '\\' ) { ; }
			else { putchar( ic ); }
			}
		}/*while*/


	return 0;
	}

