CTRACE(tfp, "HTRule: *** FAIL `%s'\n", current);
CTRACE((tfp, "HTRule: *** FAIL `%s'\n", current));
char * HTTranslate ARGS1(    CONST char *,	required){    rule * r;    char *current = NULL;    StrAllocCopy(current, required);    HTAA_clearProtections();	/* Reset from previous call -- AL */    for(r = rules; r; r = r->next) {	char * p = r->pattern;	int m=0;   /* Number of characters matched against wildcard */	CONST char * q = current;	for(;*p && *q; p++, q++) {   /* Find first mismatch */	    if (*p!=*q) break;	}	if (*p == '*') {		/* Match up to wildcard */	    m = strlen(q) - strlen(p+1); /* Amount to match to wildcard */	    if(m<0) continue;		/* tail is too short to match */	    if (0!=strcmp(q+m, p+1)) continue;	/* Tail mismatch */	} else				/* Not wildcard */	    if (*p != *q) continue;	/* plain mismatch: go to next rule */	switch (r->op) {		/* Perform operation */#ifdef ACCESS_AUTH	case HT_DefProt:	case HT_Protect:	    {		char *local_copy = NULL;		char *p2;		char *eff_ids = NULL;		char *prot_file = NULL;		CTRACE(tfp, "HTRule: `%s' matched %s %s: `%s'\n",			    current,			    (r->op==HT_Protect ? "Protect" : "DefProt"),			    "rule, setup",			    (r->equiv ? r->equiv :			     (r->op==HT_Protect ?"DEFAULT" :"NULL!!")));		if (r->equiv) {		    StrAllocCopy(local_copy, r->equiv);		    p2 = local_copy;		    prot_file = HTNextField(&p2);		    eff_ids = HTNextField(&p2);		}		if (r->op == HT_Protect)		    HTAA_setCurrentProtection(current, prot_file, eff_ids);		else		    HTAA_setDefaultProtection(current, prot_file, eff_ids);		FREE(local_copy);		/* continue translating rules */	    }	    break;#endif /* ACCESS_AUTH */	case HT_Pass:				/* Authorised */		if (!r->equiv) {		    CTRACE(tfp, "HTRule: Pass `%s'\n", current);		    return current;		}		/* Else fall through ...to map and pass */	case HT_Map:	    if (*p == *q) { /* End of both strings, no wildcard */		  CTRACE(tfp, "For `%s' using `%s'\n", current, r->equiv);		  StrAllocCopy(current, r->equiv); /* use entire translation */	    } else {		  char * ins = strchr(r->equiv, '*');	/* Insertion point */		  if (ins) {	/* Consistent rule!!! */			char * temp = (char *)malloc(				strlen(r->equiv)-1 + m + 1);			if (temp==NULL)			    outofmem(__FILE__, "HTTranslate"); /* NT & AS */			strncpy(temp,	r->equiv, ins-r->equiv);			/* Note: temp may be unterminated now! */			strncpy(temp+(ins-r->equiv), q, m);  /* Matched bit */			strcpy (temp+(ins-r->equiv)+m, ins+1);	/* Last bit */			CTRACE(tfp, "For `%s' using `%s'\n",				    current, temp);			FREE(current);			current = temp; 		/* Use this */		    } else {	/* No insertion point */			char * temp = (char *)malloc(strlen(r->equiv)+1);			if (temp==NULL)			    outofmem(__FILE__, "HTTranslate"); /* NT & AS */			strcpy(temp, r->equiv);			CTRACE(tfp, "For `%s' using `%s'\n",						current, temp);			FREE(current);			current = temp; 		/* Use this */		    } /* If no insertion point exists */		}		if (r->op == HT_Pass) {		    CTRACE(tfp, "HTRule: ...and pass `%s'\n",				current);		    return current;		}		break;	case HT_Invalid:	case HT_Fail:				/* Unauthorised */		CTRACE(tfp, "HTRule: *** FAIL `%s'\n",			    current);		FREE(current);		return (char *)0;	} /* if tail matches ... switch operation */    } /* loop over rules */    return current;}