home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
linuxmafia.com 2016
/
linuxmafia.com.tar
/
linuxmafia.com
/
pub
/
palmos
/
wapuniverse-src-0.3.5.build9.tar.gz
/
wapuniverse-src-0.3.5.build9.tar
/
wapuniverse-0.3.5.build9
/
history.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-11-12
|
2KB
|
77 lines
//---------------------------------------------------------------------------
// history.c
// Contains all platform independant WAP/history code
//
// Project: WAPUniverse for PalmOS
// Copyright ⌐ 1999-2000 Filip Onkelinx
//
// http://www.wapuniverse.com/
// filip@onkelinx.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//
// $Workfile: history.c $
// $Author: wapuniverse $
// $Date: 2000/11/11 20:51:09 $
// $Revision: 1.3 $
//
// $Header: /cvsroot/wapuniverse/wapuniverse/src/history.c,v 1.3 2000/11/11 20:51:09 wapuniverse Exp $
//
//---------------------------------------------------------------------------
#include "history.h"
#include "WAP.h"
#include "WAPUniverse.h"
int historyPush(Char *url, GlobalsType *g )
{
if ( !g->History ) { // no history yet, please create one
g->History = Malloc ( sizeof(historyType) );
MemSet(g->History,sizeof(historyType),0);
g->History->index = -1;
}
if (g->History->index < (MAX_HISTORY - 1))
g->History->index++;
else
g->History->index = 0;
if(g->History->hist[g->History->index].url)
free(g->History->hist[g->History->index].url);
g->History->hist[g->History->index].url = Malloc(StrLen(url)+1);
ErrFatalDisplayIf (!g->History->hist[g->History->index].url, "wml.c/Malloc(history2)");
StrCopy(g->History->hist[g->History->index].url,url);
}
Char *historyPop(GlobalsType *g)
{
Char *tmp, *ret;
if ( !g->History )
return(NULL);
if (g->History->index > 0)
g->History->index--;
else
g->History->index = (MAX_HISTORY - 1);
tmp = g->History->hist[g->History->index].url;
ret = Malloc(StrLen(tmp)+1);
ErrFatalDisplayIf (!ret, "wml.c/Malloc(history3)");
StrCopy(ret,tmp);
return(ret);
}