CTRACE(tfp, "HTGetLinkInfo: unexpected typed link to %s!\n", link_dest_intl->parent->address);
CTRACE((tfp, "HTGetLinkInfo: unexpected typed link to %s!\n", link_dest_intl->parent->address));
PUBLIC int HTGetLinkInfo ARGS6(	int,		number,	int,		want_go,	int *,		go_line,	int *,		linknum,	char **,	hightext,	char **,	lname){    TextAnchor *a;    HTAnchor *link_dest;#ifndef DONT_TRACK_INTERNAL_LINKS    HTAnchor *link_dest_intl = NULL;#endif    int anchors_this_line = 0, anchors_this_screen = 0;    int prev_anchor_line = -1, prev_prev_anchor_line = -1;    if (!HTMainText)	return(NO);    for (a = HTMainText->first_anchor; a; a = a->next) {	/*	 *  Count anchors, first on current line if there is more	 *  than one.  We have to count all links, including form	 *  field anchors and others with a->number == 0, because	 *  they are or will be included in the links[] array.	 *  The exceptions are hidden form fields and anchors with	 *  show_anchor not set, because they won't appear in links[]	 *  and don't count towards nlinks. - KW	 */	if ((a->show_anchor) &&	    (a->link_type != INPUT_ANCHOR ||	     a->input_field->type != F_HIDDEN_TYPE)) {	    if (a->line_num == prev_anchor_line) {		anchors_this_line++;	    } else {		/*		 *  This anchor is on a different line than the previous one.		 *  Remember which was the line number of the previous anchor,		 *  for use in screen positioning later. - KW		 */		anchors_this_line = 1;		prev_prev_anchor_line = prev_anchor_line;		prev_anchor_line = a->line_num;	    }	    if (a->line_num >= HTMainText->top_of_screen) {		/*		 *  Count all anchors starting with the top line of the		 *  currently displayed screen.  Just keep on counting		 *  beyond this screen's bottom line - we'll know whether		 *  a found anchor is below the current screen by a check		 *  against nlinks later. - KW		 */		anchors_this_screen++;	    }	}	if (a->number == number) {	    /*	     *  We found it.  Now process it, depending	     *  on what kind of info is requested. - KW	     */	    if (want_go || a->link_type == INPUT_ANCHOR) {		if (a->show_anchor == NO) {		    /*		     *  The number requested has been assigned to an anchor		     *  without any selectable text, so we cannot position		     *  on it.  The code for suppressing such anchors in		     *  HText_endAnchor() may not have applied, or it may		     *  have failed.  Return a failure indication so that		     *  the user will notice that something is wrong,		     *  instead of positioning on some other anchor which		     *  might result in inadvertent activation. - KW		     */		    return(NO);		}		if (anchors_this_screen > 0 &&		    anchors_this_screen <= nlinks &&		    a->line_num >= HTMainText->top_of_screen &&		    a->line_num < HTMainText->top_of_screen+(display_lines)) {		    /*		     *  If the requested anchor is within the current screen,		     *  just set *go_line so that the screen window won't move		     *  (keep it as it is), and set *linknum to the index of		     *  this link in the current links[] array. - KW		     */		    *go_line = HTMainText->top_of_screen;		    if (linknum)			*linknum = anchors_this_screen - 1;		} else {		    /*		     *  if the requested anchor is not within the currently		     *  displayed screen, set *go_line such that the top line		     *  will be either		     *  (1) the line immediately below the previous		     *      anchor, or		     *  (2) about one third of a screenful above the line		     *      with the target, or		     *  (3) the first line of the document -		     *  whichever comes last.  In all cases the line with our		     *  target will end up being the first line with any links		     *  on the new screen, so that we can use the		     *  anchors_this_line counter to point to the anchor in		     *  the new links[] array.  - kw		     */		    int max_offset = SEARCH_GOAL_LINE - 1;		    if (max_offset < 0)			max_offset = 0;		    else if (max_offset >= display_lines)			max_offset = display_lines - 1;		    *go_line = prev_anchor_line - max_offset;		    if (*go_line <= prev_prev_anchor_line)			*go_line = prev_prev_anchor_line + 1;		    if (*go_line < 0)			*go_line = 0;		    if (linknum)			*linknum = anchors_this_line - 1;		}		return(LINK_LINE_FOUND);	    } else {		*hightext= a->hightext;		link_dest = HTAnchor_followMainLink((HTAnchor *)a->anchor);		{		    char *cp_freeme = NULL;		    if (traversal) {			cp_freeme = stub_HTAnchor_address(link_dest);		    } else {#ifndef DONT_TRACK_INTERNAL_LINKS			if (a->link_type == INTERNAL_LINK_ANCHOR) {			    link_dest_intl = HTAnchor_followTypedLink(				(HTAnchor *)a->anchor, LINK_INTERNAL);			    if (link_dest_intl && link_dest_intl != link_dest) {				CTRACE(tfp, "HTGetLinkInfo: unexpected typed link to %s!\n",					    link_dest_intl->parent->address);				link_dest_intl = NULL;			    }			}			if (link_dest_intl) {			    char *cp2 = HTAnchor_address(link_dest_intl);			    FREE(*lname);			    *lname = cp2;			    return(WWW_INTERN_LINK_TYPE);			} else#endif			    cp_freeme = HTAnchor_address(link_dest);		    }		    StrAllocCopy(*lname, cp_freeme);		    FREE(cp_freeme);		}		return(WWW_LINK_TYPE);	    }	}    }    return(NO);}