
/*
 * cstrip.c pem@zyx.SE, 1989 
 */

/*
 * (jar -- corrected in 2nd posting -- works now)
 */

#include <stdio.h>

main()
{
	char            c, c1;

	goto into_code;

in_code:
	putchar(c);
into_code:
	switch (c = (char) getchar()) {
	case EOF:
		exit(0);
	case '\'':
		goto in_char;
	case '"':
		goto in_string;
	case '/':
		c1 = c;
		if ((c = (char) getchar()) == '*')
			goto in_comment;
		putchar(c1);
	default:
		goto in_code;
	}

in_char:
	putchar(c);
	switch (c = (char) getchar()) {
	case EOF:
		exit(1);
	case '\\':
		putchar(c);
		c = (char) getchar();
	default:
		putchar(c);
		while ((c = (char) getchar()) != '\'')
			putchar(c);
		goto in_code;
	}

in_string:
	putchar(c);
	switch (c = (char) getchar()) {
	case EOF:
		exit(1);
	case '"':
		goto in_code;
	case '\\':
		putchar(c);
		c = (char) getchar();
	default:
		goto in_string;
	}

in_comment:
	switch (c = (char) getchar()) {
	case EOF:
		exit(1);
	case '*':
		   do {
		     if ((c = (char)getchar()) == '/')
		       goto into_code;
		   } while (c == '*');
	default:
		goto in_comment;
	}
}

