#!/usr/bin/env bash
#
# orthologer - Pipeline for deducing orthology from fasta files.
# Copyright (C) 2005-2023 E. Zdobnov lab: F. Tegenfeldt
# <fredrik.tegenfeldt@unige.ch> based on code by E. Kriventseva
#
# This file is part of orthologer.
#
# orthologer 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 3 of the License, or
# (at your option) any later version.
#
# orthologer 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 orthologer.  If not, see <http://www.gnu.org/licenses/>.
#
set -u

export EC_OK=0
export EC_FAIL=255

export EC_BASH_GENERAL=1
export EC_BASH_KEYWORD=2
export EC_BASH_PERMISSION=126
export EC_BASH_NOTFOUND=127
export EC_BASH_BADEXIT=128

# this returns the fatal error signal
# error codes 129-165 is 128+<signal>
ec_bash_signal() {
    [ $# -eq 1 ] || return 0
    local ec=$1
    # return signal
    [[ $ec -gt 128 && $ec -le 165 ]] && return $((ec-128))
    return 0
}
