/* rmccmt.c MR 19/09/98 
   Remove C-style comment.
*/ 

#include <stdio.h>

main()
	{
	int ic = 0x00; 
	int icpr = 0x00; 
	int state = 0; 
	   /* state values:  
	       0 = Outside comment
	       1 = After 1st '/' of possible starting comment delimiter 
	       2 = Inside comment   
	       3 = After 1st '*' of possible ending comment delimiter
	   */
                           
	while ( icpr = ic, ( ic = getchar() ) != EOF )
		{
		switch ( state )
			{
		case 0:
			if ( ic == '/' ) { state = 1; }
			else { putchar( ic ); }
		break;
		case 1:
			if ( ic == '*' ) { state = 2; }
			else 
				{ 
				putchar( icpr ); /* The deceptive '/'  */
				putchar( ic );   /* The non-'*'        */
				state = 0; 
				}
		break;
		case 2:
			if ( ic == '*' ) { state = 3; }
			else { ; }
		break;
		case 3:
			if ( ic == '/' ) { state = 0; }
			else { state = 2; }
		break;
			}/*switch*/
		}/*while*/

	if ( state == 1 ) 
		{ 
		putchar( icpr ); /* Print deceptive '/' (=last char in file) */
		}

	return 0;
	}
