CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> ***Ignored.\n", old_tag->name, t->name, old_tag->name);
CTRACE((tfp, "SGML: Found </%s> when expecting </%s>. </%s> ***Ignored.\n", old_tag->name, t->name, old_tag->name));
PRIVATE void end_element ARGS2(	HTStream *,	context,	HTTag *,	old_tag){#ifdef EXTENDED_HTMLDTD    BOOL extra_action_taken = NO;    canclose_t canclose_check = close_valid;    int stackpos = is_on_stack(context, old_tag);    if (!Old_DTD) {	while (canclose_check != close_NO &&	       context->element_stack &&	       (stackpos > 1 || (!extra_action_taken && stackpos == 0))) {	    canclose_check = can_close(old_tag, context->element_stack->tag);	    if (canclose_check != close_NO) {		CTRACE(tfp, "SGML: End </%s> \t<- %s end </%s>\n",			    context->element_stack->tag->name,			    canclose_check == close_valid ? "supplied," : "***forced by",			    old_tag->name);		do_close_stacked(context);		extra_action_taken = YES;		stackpos = is_on_stack(context, old_tag);	    } else {		CTRACE(tfp, "SGML: Still open %s \t<- ***invalid end </%s>\n",			    context->element_stack->tag->name,			    old_tag->name);		return;	    }	}	if (stackpos == 0 && old_tag->contents != SGML_EMPTY) {	    CTRACE(tfp, "SGML: Still open %s, ***no open %s for </%s>\n",			context->element_stack ?			context->element_stack->tag->name : "none",			old_tag->name,			old_tag->name);	    return;	}	if (stackpos > 1) {	    CTRACE(tfp, "SGML: Nesting <%s>...<%s> \t<- ***invalid end </%s>\n",			old_tag->name,			context->element_stack->tag->name,			old_tag->name);	    return;	}    }    /* Now let the non-extended code deal with the rest. - kw */#endif /* EXTENDED_HTMLDTD */    /*    **	If we are in a SELECT block, ignore anything    **	but a SELECT end tag. - FM    */    if (context->inSELECT) {	if (!strcasecomp(old_tag->name, "SELECT")) {	    /*	    **	Turn off the inSELECT flag and fall through. - FM	    */	    context->inSELECT = FALSE;	} else {	    /*	    **	Ignore the end tag. - FM	    */	    CTRACE(tfp, "SGML: ***Ignoring end tag </%s> in SELECT block.\n",			old_tag->name);	    return;	}    }    /*    **	Handle the end tag. - FM    */    CTRACE(tfp, "SGML: End </%s>\n", old_tag->name);    if (old_tag->contents == SGML_EMPTY) {	CTRACE(tfp, "SGML: ***Illegal end tag </%s> found.\n",		    old_tag->name);	return;    }#ifdef WIND_DOWN_STACK    while (context->element_stack) /* Loop is error path only */#else    if (context->element_stack) /* Substitute and remove one stack element */#endif /* WIND_DOWN_STACK */    {	HTElement * N = context->element_stack;	HTTag * t = N->tag;	if (old_tag != t) {		/* Mismatch: syntax error */	    if (context->element_stack->next) { /* This is not the last level */		CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> ***assumed.\n",			     old_tag->name, t->name, t->name);	    } else {			/* last level */		CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> ***Ignored.\n",			    old_tag->name, t->name, old_tag->name);		return;			/* Ignore */	    }	}	context->element_stack = N->next;		/* Remove from stack */	FREE(N);	(*context->actions->end_element)(context->target,		 t - context->dtd->tags, (char **)&context->include);#ifdef WIND_DOWN_STACK	if (old_tag == t)	    return;  /* Correct sequence */#else	return;#endif /* WIND_DOWN_STACK */	/* Syntax error path only */    }    CTRACE(tfp, "SGML: Extra end tag </%s> found and ignored.\n",		old_tag->name);}