findnoquote.c

src/findnoquote.c · 411 B

From the archive rm4.tar.gz

Download the archive   « Back to the archive contents

#include <stdio.h>
#include <stdlib.h>

char buf[8000];
main()
{
	int dq=0;
	int sq=0;
	int lcnt=0;
	char *s;
	while (gets(buf))
	{

		s=buf;
		dq=0;	
		sq=0;
		lcnt++;
		while(*s)
		{
			switch(*s++)
			{
				case '\'':
					if(!(dq %2))
						sq++;
					break;
				case '"':
					dq++;
					break;
				default:
					break;
			}
		}
		if(sq % 2 || dq % 2)
		{
			printf("line: %d\n\t%s\n",lcnt,buf);
		}
	}
}

Site Stats

Snippets: 1791
Codebases: 571