# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/sbin/snappd/scripts/Back.pl 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2000,2002 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
#
#!/usr/bin/perl -T
# @(#)82        1.3  src/bos/usr/sbin/snappd/scripts/Back.pl, snapp, bos720 5/31/02 07:49:28

#--------------------------------------------------------------------------
#--------	Back page for Snapp Program	---------------------------
#--------------------------------------------------------------------------
#--------	This page goes to the History file ------------------------
#--------	and loads the last page the user visited ------------------
#--------------------------------------------------------------------------

$ENV{'PATH'} = '/bin:/usr/bin';

open (HISTORYFILE, "/var/snapp/snapp.History");
open (HISTORYTMP, ">/var/snapp/snapp.History.tmp");

@VisitedPages = <HISTORYFILE>;
$length = @VisitedPages;

for ($i = 0; $i < $length - 1; $i++) {
	print HISTORYTMP "$VisitedPages[$i]";
}

$BackPage = $VisitedPages[$length - 2];
print "$BackPage\n";

close (HISTORYFILE);
close (HISTORYTMP);

system("/usr/bin/cp /var/snapp/snapp.History.tmp /var/snapp/snapp.History");

system($BackPage);
