/* arclynx - simple version of Lynx for Acorn machines
 * (c) 1996 Andrew Wood
 *
 * Routines contained in this file (a_hist.c):
 *   lynx_history_push() - last modified 96/07/18
 *   lynx_history_pop()  - last modified 96/07/18
 */

#include "arclynx.h"
#include <string.h>


/******************************************************************************
 * lynx_history_push(status,url) - push url on to history list
 */
void lynx_history_push(Status *status,char *url) {
 if (status->history_pos>=(LYNX_HISTORY-1)) return;   /* discard if too many */
 status->history[status->history_pos]=(char *)malloc(strlen(url)+1);
 if (status->history[status->history_pos]==NULL) return;
 strcpy(status->history[status->history_pos],url);
 status->history_pos++;
}


/******************************************************************************
 * lynx_history_pop(status) - pop url from history list
 */
char *lynx_history_pop(Status *status) {
 static char temp[MAX_URL_LENGTH];
 status->history_pos--;
 if (status->history_pos<0) {status->history_pos=0; return("");}
 strcpy(temp,status->history[status->history_pos]);
 free(status->history[status->history_pos]);
 return(temp);
}
