#!/usr/lib/buildtool/bt_sh
# $Id: sh_head.in,v 1.29 2004/05/08 20:05:19 jmmv Exp $
# Common header for shell scripts, including shared functions.
#
# buildtool
# Copyright (c) 2003, 2004 Julio M. Merino Vidal.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the author nor the names of contributors may
#    be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

ProgName=${0##*/}
LogName=

ConfigFile=
DefsFile=
DocsFile=
LogicFile=

# -------------------------------------------------------------------------

#
# btcmn_err message
#   Show error message on stderr and exit with error status.
#
btcmn_err() {
    local spaces="$(echo ${ProgName} | sed -e 's/./ /g')"

    echo "${ProgName}: $1" 1>&2
    shift
    while [ $# -gt 0 ]; do
        echo "${spaces}  $1" 1>&2
        shift
    done
    exit 1
}

# -------------------------------------------------------------------------

#
# btcmn_warn message
#   Show warning message on stderr.
#
btcmn_warn() {
    local spaces="$(echo ${ProgName} | sed -e 's/./ /g')"

    echo "${ProgName}: $1" 1>&2
    shift
    while [ $# -gt 0 ]; do
        echo "${spaces}  $1" 1>&2
        shift
    done
}

# -------------------------------------------------------------------------

#
# btcmn_log_start name
#    Open the given log file and add a header to it for the current
#    session.
#
btcmn_log_start() {
    LogName=$1
    [ -f ${LogName} ] && echo >> ${LogName}
    echo "-------------------------------------------------------------------------" >> ${LogName} # NOLINT
    echo "LOG STARTED FOR MODULE ${ProgName} ON $(date)" >> ${LogName}
    echo >> ${LogName}
}

# -------------------------------------------------------------------------

#
# btcmn_log_name
#    Get the current log name.
#
btcmn_log_name() {
    echo ${LogName}
}

# -------------------------------------------------------------------------

#
# btcmn_log_msg text
#    Append the given message to the log file.
#
btcmn_log_msg() {
    echo $* >> ${LogName}
}

# -------------------------------------------------------------------------

#
# btcmn_req_project
#   Check if we are executing Buildtool inside a buildtoolized project.
#   If so, set BT_TOPDIR to its top directory, set all *File variables
#   pointing to the right script, check if the current Buildtool version
#   is enough to work with this project and automatically source the defs
#   block.  The function does not return if the check fails.
#
btcmn_req_project() {
    local major minor oldpwd

    config() {
        btcmn_err "no config() function defined; cannot continue."
    }

    defs() {
        btcmn_err "no defs() function defined; cannot continue."
    }

    docs() {
        btcmn_err "no docs() function defined; cannot continue."
    }

    oldpwd=$(pwd)
    BT_TOPDIR=
    while [ -z "${BT_TOPDIR}" -a $(pwd) != / ]; do
        if [ -f Generic.bt -o -f Defs.bt ]; then
            BT_TOPDIR=$(pwd)
        else
            cd ..
        fi
    done
    [ -z "${BT_TOPDIR}" ] &&
        btcmn_err \
            "this module needs to be run from inside a Buildtool project"

    if [ -f Config.bt ]; then
        ConfigFile=${BT_TOPDIR}/Config.bt
    else
        ConfigFile=${BT_TOPDIR}/Generic.bt
    fi

    if [ -f Defs.bt ]; then
        DefsFile=${BT_TOPDIR}/Defs.bt
    else
        DefsFile=${BT_TOPDIR}/Generic.bt
    fi

    if [ -f Docs.bt ]; then
        DocsFile=${BT_TOPDIR}/Docs.bt
    else
        DocsFile=${BT_TOPDIR}/Generic.bt
    fi

    if [ -f Logic.bt ]; then
        LogicFile=${BT_TOPDIR}/Logic.bt
    else
        LogicFile=${BT_TOPDIR}/Generic.bt
    fi

    cd ${oldpwd}

    [ -f Logic.bt ] && LogicFile=$(pwd)/Logic.bt

    BT_REQUIRE=
    . ${DefsFile}
    defs
    if [ -z "${BT_REQUIRE}" ]; then
        btcmn_err "broken package; does not define BT_REQUIRE"
    fi

    major=$(echo ${BT_REQUIRE} | cut -d . -f 1)
    minor=$(echo ${BT_REQUIRE} | cut -d . -f 2)

    [ ${major} -ne 0 -a ${major} -ne 0 ] && \
        btcmn_err "this package requires the Buildtool ${major}.x branch"
    [ ${minor} -gt 16 ] && \
        btcmn_err "this package requires Buildtool ${BT_REQUIRE}"
}

# -------------------------------------------------------------------------

#
# btcmn_req_config
#   Check for the presence of the config script and source it if found.
#   Does not return if the file is not found.
#
btcmn_req_config() {
    [ ! -f ${ConfigFile} ] && btcmn_err "cannot open ${ConfigFile}"
    config_init() { return 0; }
    config() { return 0; }
    . ${ConfigFile}
}

# -------------------------------------------------------------------------

#
# btcmn_req_defs
#   Check for the presence of the defs script and source it if found.
#   Does not return if the file is not found.
#
btcmn_req_defs() {
    [ ! -f ${DefsFile} ] && btcmn_err "cannot open ${DefsFile}"
    defs() { return 0; }
    . ${DefsFile}
}

# -------------------------------------------------------------------------

#
# btcmn_req_docs
#   Check for the presence of the docs script and source it if found.
#   Does not return if the file is not found.
#
btcmn_req_docs() {
    [ ! -f ${DocsFile} ] && btcmn_err "cannot open ${DocsFile}"
    docs() { return 0; }
    . ${DocsFile}
}

# -------------------------------------------------------------------------

#
# btcmn_req_logic
#   Check for the presence of the logic script and source it if found.
#   Does not return if the file is not found.
#
btcmn_req_logic() {
    [ ! -f ${LogicFile} ] && btcmn_err "cannot open ${LogicFile}"
    logic() { return 0; }
    . ${LogicFile}
}

# -------------------------------------------------------------------------

#
# btcmn_req_runtime
#   Check if we were executed by the main buildtool wrapper program.
#
btcmn_req_runtime() {
    if [ ${__BUILDTOOL:-no} != yes ]; then
        btcmn_err "this program must be run through Buildtool"
    fi
}

# -------------------------------------------------------------------------

#
# btcmn_run_module module [args]
#   Execute the given module passing all extra arguments to it.
#
btcmn_run_module() {
    local module="$1"; shift

    case ${module} in
        config)
            btcmn_req_project
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_config ${BT_PKG_CONFIG_FLAGS} "$@"
            ;;
        dist)
            btcmn_req_project
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_dist ${BT_PKG_DIST_FLAGS} "$@"
            ;;
        doc)
            btcmn_req_project
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_doc ${BT_PKG_DOC_FLAGS} "$@"
            ;;
        lint)
            btcmn_req_project
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_lint ${BT_PKG_LINT_FLAGS} "$@"
            ;;
        logic)
            btcmn_req_project
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_logic ${BT_PKG_LOGIC_FLAGS} "$@"
            ;;
        pkgflags)
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_pkgflags "$@"
            ;;
        swcgen)
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_swcgen "$@"
            ;;
        wizard)
            __BUILDTOOL=yes /usr/lib/buildtool/bt_sh ${BT_SH_FLAGS} \
                /usr/lib/buildtool/bt_wizard "$@"
            ;;
        *)
            btcmn_err "no such module \`${module}' (internal error)"
            ;;
    esac
}

# -------------------------------------------------------------------------

# Local Variables: ***
# mode: shell-script ***
# End: ***
# vim: syntax=sh
#
# $Id: frontend.in,v 1.14 2003/09/30 18:51:57 jmmv Exp $
# bt_pkgflags's frontend.
#
# buildtool
# Copyright (c) 2003 Julio M. Merino Vidal.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the author nor the names of contributors may
#    be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

set -w

usage() {
    local exitstatus=$1 detailed=${2:-no}

    [ ${detailed} = yes ] && echo "buildtool version 0.16" 1>&2

    echo "usage: ${ProgName} [options] pkg1[,op,ver] .. pkgN[,op,ver]" 1>&2

    if [ ${detailed} = yes ]; then
        cat 1>&2 <<EOF

Available options:
    {-c|--cflags}    Print compilation flags.
    {-h|--help}      Show this help message.
    {-l|--libs}      Print library flags.

Available operators:
    < or lt, <= or le, = or eq, != or ne, >= or ge, > or gt

pkgconfig files are searched in the following path:
    \${PKG_CONFIG_PATH}:/usr/lib/pkgconfig
pkgflags files are searched in the following path:
    \${BT_PATH_PKGFLAGS}:/usr/share/buildtool/pkgflags

See buildtool(1) for more information.
EOF
    fi

    exit ${exitstatus}
}

compare_versions() {
    local v1=$1 op=$2 v2=$3
    local v1_major v1_minor v1_micro
    local v2_major v2_minor v2_micro
    local ret

    # Fill missing numbers in version strings with zeros.
    v1_major=$(echo ${v1} | cut -d . -f 1); : ${v1_major:=0}
    v1_minor=$(echo ${v1} | cut -d . -f 2); : ${v1_minor:=0}
    v1_micro=$(echo ${v1} | cut -d . -f 3); : ${v1_micro:=0}
    v1=${v1_major}.${v1_minor}.${v1_micro}
    v2_major=$(echo ${v2} | cut -d . -f 1); : ${v2_major:=0}
    v2_minor=$(echo ${v2} | cut -d . -f 2); : ${v2_minor:=0}
    v2_micro=$(echo ${v2} | cut -d . -f 3); : ${v2_micro:=0}
    v2=${v2_major}.${v2_minor}.${v2_micro}

    ret=1
    case ${op} in
        lt|'<')
            [ ${v1} '<' ${v2} ] && ret=0
            ;;
        le|'<=')
            [ ${v1} '<' ${v2} -o ${v1} = ${v2} ] && ret=0
            ;;
        eq|'=')
            [ ${v1} = ${v2} ] && ret=0
            ;;
        ne|'!=')
            [ ${v1} != ${v2} ] && ret=0
            ;;
        ge|'>=')
            [ ${v1} '>' ${v2} -o ${v1} = ${v2} ] && ret=0
            ;;
        gt|'>')
            [ ${v1} '>' ${v2} ] && ret=0
            ;;
        *)
            btcmn_err "unknown version operator \`${op}'"
            ;;
    esac

    return ${ret}
}

parse() {
    local fmt="$1" pkgname="$2" pkgop="$3" pkgver="$4"

    if [ "\\${pkgop}" = "\\" ] || [ "\\${pkgver}" = "\\" ] || \
        compare_versions $(${fmt}_get_version) ${pkgop} ${pkgver}
    then
        [ ${show_cflags} = yes ] && output+=$(${fmt}_get_cflags)
        [ ${show_libs} = yes ] && output+=$(${fmt}_get_libs)
    else
        btcmn_warn "version mismatch for \`${pkgname}'"
        return 1
    fi

    return 0
}

main() {
    local show_cflags show_libs
    local output pkgname pkgop pkgver ret

    btcmn_req_runtime

    show_cflags=no
    show_libs=no
    while [ $# -gt 0 ]; do
        echo $1 | grep ^- >/dev/null || break

        case $1 in
            -c|--cflags)
                show_cflags=yes
                ;;
            -h|--help)
                usage 0 yes
                ;;
            -l|--libs)
                show_libs=yes
                ;;
            --)
                shift; break
                ;;
            *)
                btcmn_warn "unknown option \`$1'"
                usage 1 no
                ;;
        esac
        shift
    done
    [ $# -eq 0 ] && usage 1 no

    ret=0
    output=
    while [ $# -gt 0 ]; do
        if echo $1 | grep , >/dev/null; then
            pkgname=$(echo $1 | cut -d , -f 1)
            pkgop=$(echo $1 | cut -d , -f 2)
            pkgver=$(echo $1 | cut -d , -f 3)
        elif echo $1 | grep ' ' >/dev/null; then
            pkgname=$(echo $1 | cut -d ' ' -f 1)
            pkgop=$(echo $1 | cut -d ' ' -f 2)
            pkgver=$(echo $1 | cut -d ' ' -f 3)
        else
            pkgname=$1
            pkgop=
            pkgver=
        fi

        if pkgflags_open ${pkgname}; then
            parse pkgflags ${pkgname} ${pkgop} ${pkgver} || ret=1
            pkgflags_close
        elif pkgconfig_open ${pkgname}; then
            parse pkgconfig ${pkgname} ${pkgop} ${pkgver} || ret=1
            pkgconfig_close
        else
            btcmn_warn "cannot locate flags information for \`${pkgname}'"
            ret=1
        fi
        shift
    done

    [ -n "${output}" ] && echo ${output}

    return ${ret}
}

# Local Variables: ***
# mode: shell-script ***
# End: ***
# vim: syntax=sh
#
# $Id: pkgconfig.in,v 1.2 2003/10/04 15:07:59 jmmv Exp $
# Handle pkgconfig files.
#
# buildtool
# Copyright (c) 2003 Julio M. Merino Vidal.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the author nor the names of contributors may
#    be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

global PKG_CONFIG_PATH
global pc_file
global pc_cflags pc_descr pc_libs pc_name pc_version

pkgconfig_open() {
    local pkgname=$1
    local d dirs

    [ -n "${pc_file}" ] && btcmn_err "pkgconfig file already opened"

    pc_file=
    pc_cflags= pc_descr= pc_libs= pc_name= pc_version=

    dirs=$(echo ${PKG_CONFIG_PATH}:/usr/lib/pkgconfig | tr : ' ')
    for d in ${dirs}; do
        if [ -f ${d}/${pkgname}.pc ]; then
            pc_file=${d}/${pkgname}.pc
            pc_name=${pkgname}
            pkgconfig_cnvt_read
            return 0
        fi
    done
    return 1
}

pkgconfig_cnvt_read() {
    local tmp=/tmp/bt_pkgflags-pc.$$
    local Cflags= Description= Libs= Name= Version=
    local Requires=

    egrep -v '^$' ${pc_file} | sed -e 's|=|="|' -e 's|: |="|' -e 's|:$|="|' \
        -e 's|$|"|' > ${tmp}
    set +w
    . ${tmp}
    set -w
    rm -f ${tmp}

    pc_cflags=${Cflags}
    pc_descr=${Description}
    pc_libs=${Libs}
    pc_name=${Name}
    pc_version=${Version}
}

pkgconfig_close() {
    [ -z "${pc_file}" ] && btcmn_err "no pkgconfig file currently opened"
    pc_file=
}

pkgconfig_get_cflags() {
    echo ${pc_cflags}
}

pkgconfig_get_libs() {
    echo ${pc_libs}
}

pkgconfig_get_name() {
    echo ${pc_name}
}

pkgconfig_get_version() {
    echo ${pc_version}
}

# Local Variables: ***
# mode: shell-script ***
# End: ***
# vim: syntax=sh
#
# $Id: pkgflags.in,v 1.1 2003/09/29 18:32:22 jmmv Exp $
# Handle pkgflags files.
#
# buildtool
# Copyright (c) 2003 Julio M. Merino Vidal.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the author nor the names of contributors may
#    be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

global BT_PATH_PKGFLAGS
global bpf_file
global bpf_cflags bpf_descr bpf_libs bpf_name bpf_version

pkgflags_open() {
    local pkgname=$1
    local d dirs

    [ -n "${bpf_file}" ] && btcmn_err "pkgflags file already opened"

    bpf_file=
    bpf_cflags= bpf_descr= bpf_libs= bpf_name= bpf_version=

    dirs=$(echo ${BT_PATH_PKGFLAGS}:/usr/share/buildtool/pkgflags | tr : ' ')
    for d in ${dirs}; do
        if [ -f ${d}/${pkgname}.bpf ]; then
            bpf_file=${d}/${pkgname}.bpf
            bpf_name=${pkgname}
            . ${bpf_file}
            return 0
        fi
    done
    return 1
}

pkgflags_close() {
    [ -z "${bpf_file}" ] && btcmn_err "no pkgflags file currently opened"
    bpf_file=
}

pkgflags_get_cflags() {
    echo ${bpf_cflags}
}

pkgflags_get_libs() {
    echo ${bpf_libs}
}

pkgflags_get_name() {
    echo ${bpf_name}
}

pkgflags_get_version() {
    echo ${bpf_version}
}

# Local Variables: ***
# mode: shell-script ***
# End: ***
# vim: syntax=sh
#
# $Id: sh_tail.in,v 1.3 2003/09/23 16:40:23 jmmv Exp $
# Common footer for shell scripts.
#
# buildtool
# Copyright (c) 2003 Julio M. Merino Vidal.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the author nor the names of contributors may
#    be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#

main "$@"

# Local Variables: ***
# mode: shell-script ***
# End: ***
# vim: syntax=sh
