PUBLIC void edit_bookmarks NOARGS
PUBLIC BOOLEAN LYCheckUserAgent NOARGS
PUBLIC void edit_bookmarks NOARGS{    int response = 0, def_response = 0, ch;    int MBM_current = 1;#define MULTI_OFFSET 8    int a; /* misc counter */    char MBM_tmp_line[256]; /* buffer for LYgetstr */    char ehead_buffer[265];    /*     *	We need (MBM_V_MAXFILES + MULTI_OFFSET) lines to display     *	the whole list at once.  Otherwise break it up into two     *	segments.  We know it won't be less than that because     *	'o'ptions needs 23-24 at LEAST.     */    term_options = FALSE;    signal(SIGINT, terminate_options);draw_bookmark_list:    /*     *	Display menu of bookmarks.  NOTE that we avoid printw()'s     *	to increase the chances that any non-ASCII or multibyte/CJK     *	characters will be handled properly. - FM     */#if defined(FANCY_CURSES) || defined (USE_SLANG)    if (enable_scrollback) {	LYclear();    } else {	LYerase();    }#else    LYclear();#endif /* FANCY_CURSES || USE_SLANG */    LYmove(0, 5);    lynx_start_h1_color ();    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	sprintf(ehead_buffer, MULTIBOOKMARKS_EHEAD_MASK, MBM_current);	LYaddstr(ehead_buffer);    } else {	LYaddstr(MULTIBOOKMARKS_EHEAD);    }    lynx_stop_h1_color ();    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	for (a = ((MBM_V_MAXFILES/2 + 1) * (MBM_current - 1));		      a <= (MBM_current * MBM_V_MAXFILES/2 ); a++) {	    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 5);	    LYaddch(UCH(LYindex2MBM(a)));	    LYaddstr(" : ");	    if (MBM_A_subdescript[a])		LYaddstr(MBM_A_subdescript[a]);	    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 35);	    LYaddstr("| ");	    if (MBM_A_subbookmark[a]) {		LYaddstr(MBM_A_subbookmark[a]);	    }	}    } else {	for (a = 0; a <= MBM_V_MAXFILES; a++) {	    LYmove(3 + a, 5);	    LYaddch(UCH(LYindex2MBM(a)));	    LYaddstr(" : ");	    if (MBM_A_subdescript[a])		LYaddstr(MBM_A_subdescript[a]);	    LYmove(3 + a, 35);	    LYaddstr("| ");	    if (MBM_A_subbookmark[a]) {		LYaddstr(MBM_A_subbookmark[a]);	    }	}    }    /*     *	Only needed when we have 2 screens.     */    if (LYlines < MBM_V_MAXFILES + MULTI_OFFSET) {	LYmove((LYlines - 4), 0);	LYaddstr("'");	lynx_start_bold();	LYaddstr("[");	lynx_stop_bold();	LYaddstr("' ");	LYaddstr(PREVIOUS);	LYaddstr(", '");	lynx_start_bold();	LYaddstr("]");	lynx_stop_bold();	LYaddstr("' ");	LYaddstr(NEXT_SCREEN);    }    LYmove((LYlines - 3), 0);    if (!no_option_save) {	LYaddstr("'");	lynx_start_bold();	LYaddstr(">");	lynx_stop_bold();	LYaddstr("'");	LYaddstr(TO_SAVE_SEGMENT);    }    LYaddstr(OR_SEGMENT);    LYaddstr("'");    lynx_start_bold();    LYaddstr("^G");    lynx_stop_bold();    LYaddstr("'");    LYaddstr(TO_RETURN_SEGMENT);    while (!term_options &&	   !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&	   !LYCharIsINTERRUPT_NO_letter(response) && response != '>') {	LYmove((LYlines - 2), 0);	lynx_start_prompt_color ();	LYaddstr(MULTIBOOKMARKS_LETTER);	lynx_stop_prompt_color ();	LYrefresh();	response = (def_response ? def_response : LYgetch_single());	def_response = 0;	/*	 *  Check for a cancel.	 */	if (term_options || LYCharIsINTERRUPT_NO_letter(response) ||	    LYisNonAlnumKeyname(response, LYK_PREV_DOC))	    continue;	/*	 *  Check for a save.	 */	if (response == '>') {	    if (!no_option_save) {		HTInfoMsg(SAVING_OPTIONS);		if (save_rc(NULL))		    HTInfoMsg(OPTIONS_SAVED);		else		    HTAlert(OPTIONS_NOT_SAVED);	    } else {		HTInfoMsg(R_TO_RETURN_TO_LYNX);		/*		 *  Change response so that we don't exit		 *  the options menu.		 */		response = ' ';	    }	    continue;	}	/*	 *  Check for a refresh.	 */	if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {	    lynx_force_repaint();	    continue;	}	/*	 *  Move between the screens - if we can't show it all at once.	 */	if ((response == ']' ||	     LYisNonAlnumKeyname(response, LYK_NEXT_PAGE)) &&	    LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	    MBM_current++;	    if (MBM_current >= 3)		MBM_current = 1;	    goto draw_bookmark_list;	}	if ((response == '[' ||	     LYisNonAlnumKeyname(response, LYK_PREV_PAGE)) &&	    LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	    MBM_current--;	    if (MBM_current <= 0)		MBM_current = 2;	    goto draw_bookmark_list;	}	/*	 *  Instead of using 26 case statements, we set up	 *  a scan through the letters and edit the lines	 *  that way.	 */	for (a = 0; a <= MBM_V_MAXFILES; a++) {	    if (LYMBM2index(response) == a) {		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {		    if (MBM_current == 1 && a > (MBM_V_MAXFILES/2)) {			MBM_current = 2;			def_response = response;			goto draw_bookmark_list;		    }		    if (MBM_current == 2 && a < (MBM_V_MAXFILES/2)) {			MBM_current = 1;			def_response = response;			goto draw_bookmark_list;		    }		}		_statusline(ACCEPT_DATA);		if (a > 0) {		    lynx_start_bold();		    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))			LYmove(			 (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			     9);		    else			LYmove((3 + a), 9);		    LYstrncpy(MBM_tmp_line,			   (!MBM_A_subdescript[a] ?					       "" : MBM_A_subdescript[a]),			      sizeof(MBM_tmp_line) - 1);		    ch = LYgetstr(MBM_tmp_line, VISIBLE,				  sizeof(MBM_tmp_line), NORECALL);		    lynx_stop_bold();		    if (strlen(MBM_tmp_line) < 1) {			FREE(MBM_A_subdescript[a]);		    } else {			StrAllocCopy(MBM_A_subdescript[a], MBM_tmp_line);		    }		    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))			LYmove(			 (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			     5);		    else			LYmove((3 + a), 5);		    LYaddch(UCH(LYindex2MBM(a)));		    LYaddstr(" : ");		    if (MBM_A_subdescript[a])			LYaddstr(MBM_A_subdescript[a]);		    LYclrtoeol();		    LYrefresh();		}		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))		    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			 35);		else		    LYmove((3 + a), 35);		LYaddstr("| ");		lynx_start_bold();		LYstrncpy(MBM_tmp_line,			  NonNull(MBM_A_subbookmark[a]),			  sizeof(MBM_tmp_line) - 1);		ch = LYgetstr(MBM_tmp_line, VISIBLE,			      sizeof(MBM_tmp_line), NORECALL);		lynx_stop_bold();		if (*MBM_tmp_line == '\0') {		    if (a == 0)			StrAllocCopy(MBM_A_subbookmark[a], bookmark_page);		    else			FREE(MBM_A_subbookmark[a]);		} else if (!LYPathOffHomeOK(MBM_tmp_line,					    sizeof(MBM_tmp_line))) {			LYMBM_statusline(USE_PATH_OFF_HOME);			LYSleepAlert();		} else {		    StrAllocCopy(MBM_A_subbookmark[a], MBM_tmp_line);		    if (a == 0) {			StrAllocCopy(bookmark_page, MBM_A_subbookmark[a]);		    }		}		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))		    LYmove((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current-1)),			 35);		else		    LYmove((3 + a), 35);		LYaddstr("| ");		if (MBM_A_subbookmark[a])		    LYaddstr(MBM_A_subbookmark[a]);		LYclrtoeol();		LYmove(LYlines-1, 0);		LYclrtoeol();		break;	    }	}  /* end for */    } /* end while */    term_options = FALSE;    signal(SIGINT, cleanup_sig);}