#!/usr/local/bin/perl
use lib '/usr/local/rib/lib';
# NHSE Repository in a Box (RIB)
#
# The authors of this software are Paul McMahan and Jeff Horner.
# Copyright (c) 1997 by the University of Tennessee.
# Permission to use, copy, modify, and distribute this software for any
# purpose without fee is hereby granted, provided that this entire notice
# is included in all copies of any software which is or includes a copy
# or modification of this software and in all copies of the supporting
# documentation for such software.
# THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR UNIVERSITY OF TENNESSEE
# MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
# MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
#
# $Id: ifetch,v 1.1.1.1 1997/12/10 15:59:32 jhorner Exp $
#
# $Log: ifetch,v $
# Revision 1.1.1.1  1997/12/10 15:59:32  jhorner
# RIB pre 1.0
#
# Revision 1.1  1997/05/06 18:17:32  jhorner
# Initial revision
#

require RIB::Util;
use strict;

# From this script, run the isrch_fetch utility and pass 4 arguments:
#
# isrch_fetch <databases_path> $1 $2 $3
#
# /path/to/Isearch-cgi/isrch_fetch /path/to/my/databases


unless (@ARGV){
    RIB::Util->PrintHeader();
    RIB::Util->ErrorMessage("This script <strong>MUST</strong>".
	" be called with four argument. Please contact the <strong>RIB".
	" </strong>maintainers.");
}

my $ifetch = RIB::Util->GetRibIsearchCgiPath . "/isrch_fetch";
unless (-e $ifetch){
    RIB::Util->ErrorMessage("Could not find program isrch_fetch!".
        " Tried to find it here: $ifetch. It has either been moved".
        " or RIB is incorrectly configured. Please contact your RIB".
        " administrator.");
}
my $ipath = RIB::Util->GetRibDir . "/repositories/" . $ARGV[0] . 
    "/index/";

my $cpath = RIB::Util->GetRibDir . "/repositories/" . $ARGV[0] .
    "/catalog/";    

$ENV{'DOCUMENT_ROOT'} = "$cpath"; 
exec $ifetch , $ipath, @ARGV;
