ok i managed to bash the cleanup function into shape

Code:
void cleanup(char *tag)
{
	char *a, temp[100];
	int i;
	
	if (tag[0] == '"')
	{
		i=0;
		a=&tag[0];
		memset(temp, 0, sizeof(temp));
		while (*++a != '"')
			temp[i++] = *a;
			
		strcpy(tag, temp);
	}
}