/* STRIPPER - strip out all #operator lines, //comment lines, and @variables  */
#include <stdio.h>

main( )
{
int i, j, nt, len, invar, suppress;
char buf[512], tok[255], tok2[255], tok3[255];

suppress = 0;

while( fgets( buf, 511, stdin ) != NULL ) {
	nt = sscanf( buf, "%s", tok );

	if( GL_smember( tok, "#sql #shell" )) {
		/* check for multiline construct.. if so, skip to next #endsql or #endshell */
		if( sscanf( buf, "%s %s %s", tok, tok2, tok3 ) < 3 ) suppress = 1;
		}
	else if( suppress && GL_smember( tok, "#endsql #endshell" )) suppress = 0;

	if( tok[0] == '#' || suppress ) continue;
	if( strncmp( tok, "//", 2 )==0 ) continue;

	len = strlen( buf );
	invar = 0;
	for( i = 0; i < len; i++ ) {

		if( buf[i] == '@' ) { invar = 1; continue; }

		if( invar && ( isalnum( buf[i] ) || buf[i] == '_' || buf[i] == '.' ) ) continue;
		else invar = 0;

		printf( "%c", buf[i] );
		}
	}
}
	

