PUBLIC void LYpush ARGS2(
PUBLIC int LYpush ARGS2(
PUBLIC void LYpush ARGS2(	document *,	doc,	BOOLEAN,	force_push){    /*     *	Don't push NULL file names.     */    if (*doc->address == '\0')	return;    /*     *	Check whether this is a document we     *	don't push unless forced. - FM     */    if (!force_push) {	/*	 *  Don't push the history, printer, or download lists.	 */	if (!LYwouldPush(doc->title)) {	    if (!LYforce_no_cache)		LYoverride_no_cache = TRUE;	    return;	}    }    /*     *	If file is identical to one before it, don't push it.     */    if (nhist> 1 &&	STREQ(history[nhist-1].address, doc->address) &&	!strcmp(history[nhist-1].post_data ?		history[nhist-1].post_data : "",		doc->post_data ?		doc->post_data : "") &&	!strcmp(history[nhist-1].bookmark ?		history[nhist-1].bookmark : "",		doc->bookmark ?		doc->bookmark : "") &&	history[nhist-1].isHEAD == doc->isHEAD) {	if (history[nhist-1].internal_link == doc->internal_link) {	    /* But it is nice to have the last position remembered!	       - kw */	    history[nhist-1].link = doc->link;	    history[nhist-1].line = doc->line;	    return;	}    }    /*     *	OK, push it if we have stack space.     */    if (nhist < MAXHIST)  {	history[nhist].link = doc->link;	history[nhist].line = doc->line;	history[nhist].title = NULL;	StrAllocCopy(history[nhist].title, doc->title);	history[nhist].address = NULL;	StrAllocCopy(history[nhist].address, doc->address);	history[nhist].post_data = NULL;	StrAllocCopy(history[nhist].post_data, doc->post_data);	history[nhist].post_content_type = NULL;	StrAllocCopy(history[nhist].post_content_type, doc->post_content_type);	history[nhist].bookmark = NULL;	StrAllocCopy(history[nhist].bookmark, doc->bookmark);	history[nhist].isHEAD = doc->isHEAD;	history[nhist].safe = doc->safe;	history[nhist].internal_link = FALSE; /* by default */	history[nhist].intern_seq_start = -1; /* by default */	if (doc->internal_link) {	    /* Now some tricky stuff: if the caller thinks that the doc	       to push was the result of following an internal	       (fragment) link, we check whether we believe it.	       It is only accepted as valid if the immediately preceding	       item on the history stack is actually the same document	       except for fragment and location info.  I.e. the Parent	       Anchors are the same.	       Also of course this requires that this is not the first	       history item. - kw */	    if (nhist > 0) {		DocAddress WWWDoc;		HTParentAnchor *thisparent, *thatparent = NULL;		WWWDoc.address = doc->address;		WWWDoc.post_data = doc->post_data;		WWWDoc.post_content_type = doc->post_content_type;		WWWDoc.bookmark = doc->bookmark;		WWWDoc.isHEAD = doc->isHEAD;		WWWDoc.safe = doc->safe;		thisparent =		    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));		/* Now find the ParentAnchor for the previous history		** item - kw		*/		if (thisparent) {		    /* If the last-pushed item is a LYNXIMGMAP but THIS one		    ** isn't, compare the physical URLs instead. - kw		    */		    if (0==strncmp(history[nhist-1].address,"LYNXIMGMAP:",11) &&			0!=strncmp(doc->address,"LYNXIMGMAP:",11)) {			WWWDoc.address = history[nhist-1].address + 11;		    /*		    ** If THIS item is a LYNXIMGMAP but the last-pushed one		    ** isn't, fake it by using THIS item's address for		    ** thatparent... - kw		    */		    } else if ((0==strncmp(doc->address,"LYNXIMGMAP:",11) &&		       0!=strncmp(history[nhist-1].address,"LYNXIMGMAP:",11))) {			char *temp = NULL;			StrAllocCopy(temp, "LYNXIMGMAP:");			StrAllocCat(temp, doc->address+11);			WWWDoc.address = temp;			WWWDoc.post_content_type = history[nhist-1].post_content_type;			WWWDoc.bookmark = history[nhist-1].bookmark;			WWWDoc.isHEAD = history[nhist-1].isHEAD;			WWWDoc.safe = history[nhist-1].safe;			thatparent =			    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));			FREE(temp);		    } else {			WWWDoc.address = history[nhist-1].address;		    }		    if (!thatparent) { /* if not yet done */			WWWDoc.post_data = history[nhist-1].post_data;			WWWDoc.post_content_type = history[nhist-1].post_content_type;			WWWDoc.bookmark = history[nhist-1].bookmark;			WWWDoc.isHEAD = history[nhist-1].isHEAD;			WWWDoc.safe = history[nhist-1].safe;			thatparent =			    HTAnchor_parent(HTAnchor_findAddress(&WWWDoc));		    }		/* In addition to equality of the ParentAnchors, require		** that IF we have a HTMainText (i.e., it wasn't just		** HTuncache'd by mainloop), THEN it has to be consistent		** with what we are trying to push.		**   This may be overkill... - kw		*/		    if (thatparent == thisparent &&			(!HTMainText || HTMainAnchor == thisparent)			) {			history[nhist].internal_link = TRUE;			history[nhist].intern_seq_start =			    history[nhist-1].intern_seq_start >= 0 ?			    history[nhist-1].intern_seq_start : nhist-1;			CTRACE(tfp, "\nLYpush: pushed as internal link, OK\n");		    }		}	    }	    if (!history[nhist].internal_link) {		CTRACE(tfp, "\nLYpush: push as internal link requested, %s\n",			    "but didn't check out!");	    }	}	CTRACE(tfp, "\nLYpush[%d]: address:%s\n        title:%s\n",		    nhist, doc->address, doc->title);	nhist++;    } else {	if (LYCursesON) {	    HTAlert(MAXHIST_REACHED);	}	CTRACE(tfp, "\nLYpush: MAXHIST reached for:\n        address:%s\n        title:%s\n",		    doc->address, doc->title);    }}