#!/bin/sh
#
# Copyright
#
#	Copyright (C) 2009-2010 Jari Aalto <jari.aalto@cante.net>,
#
# License:
#
#       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, see <http://www.gnu.org/licenses/>.
#
# Description
#
#	A shell function to help to use zpaq in Debian.
#
#	Create; option -9 acts like "-cCONFIG_MAX"
#
#	    zpaq -9 archive.zpaq dir/*
#
#	Same as above; the "c" is default and be omitted.
#
#	    zpaq -9c archive.zpaq dir/*
#
#	Append mode
#
#	    zpaq -9a archive.zpaq file
#
#	Append mode; without saving a SHA1
#
#	    zpaq -9b archive.zpaq file

zpaq ()
{
    unset zpaq_dir
    unset zpaq_conf
    unset zpaq_mode

    local zpaq_dir  2> /dev/null
    local zpaq_conf 2> /dev/null
    local zpaq_mode 2> /dev/null

    zpaq_dir=/usr/share/doc/zpaq/examples

    case "$1" in
	-1*) zpaq_conf=$zpaq_dir/min.cfg ;;
	-3*) zpaq_conf=$zpaq_dir/mid.cfg ;;
	-9*) zpaq_conf=$zpaq_dir/max.cfg ;;
    esac

    unset zpaq_dir  # No more used.

    case "$1" in
	-[139] | -[139]c) zpaq_mode="c" ;;
	-[139]a) zpaq_mode=a ;;
	-[139]b) zpaq_mode=b ;;
    esac

    if [ "$zpaq_mode" ]; then
	shift
    fi

    /usr/bin/zpaq $zpaq_mode$zpaq_conf "$@"
}

# End of file
