#!/bin/bash
#---------------------------------------------------------------------
##
## @Synopsis Url handler functions for grabbing file urls.
## This file contains functions for I<downloading> (actually it just
## copies) files which can be accessed through the local file system.
## Url's of this type are specified using the format 
##
##  file://<path>
##
## where <path> is the full path to the file.
##
## @Copyright Copyright 2002 by the Source Mage Team
##
#---------------------------------------------------------------------

#---------------------------------------------------------------------
## @param url
## 
## Copies the specified file url.
##
#---------------------------------------------------------------------
function dl_file_get() {

  local target=$1
  local url_list=$2
  local hints=$3
  local dl_target=$4
  local dl_type=$5
  local url rc=1
  local FILENAME

  [[ $target ]] || return 255

  for url in $url_list; do
    FILENAME=`url_crack $url`  &&
    test -f  "$FILENAME" &&
    test -r  "$FILENAME" &&
    cp -a $FILENAME $target && break
  done
  
  eval "$dl_target=\"$target\""
  eval "$dl_type=\"file\""
  return $rc

}


#---------------------------------------------------------------------
##=back
##
##=head1 LICENSE
##
## This software 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 software 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 software; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##
#---------------------------------------------------------------------

