#!/bin/sh #---------------------------------------------------------------------------- # /usr/sbin/uucp-send - send message(s) to uucp host # # Copyright (c) 2001-2020 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2006-11-03 jed # Last Update: $Id$ # # Usage: uucp-send --help - show help # uucp-send hostname compression address(es) - standard script use # # 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. #---------------------------------------------------------------------------- #exec 2>/tmp/uucp-send-trace-$$.log #set -x PATH=/usr/sbin:/usr/bin:/sbin # initialize variables uu_host='' uu_comp='' uu_addr='' if [ $# -le 1 ] then # show help case $1 in --help|-h|-?|/?|'') # show help echo echo "Usage: /usr/sbin/uucp-send hostname compression address(es)" echo exit 1 ;; esac else # read command line parameters if [ $# -ge 3 ] then # $1 - hostname, $2 - compression type, $3-.. address(es) while [ $# -gt 0 ] do if [ -z "${uu_host}" ] then # get hostname and compression uu_host="${1}" uu_comp="${2}" shift; shift else # get address(es) if [ -z "${uu_addr}" ] then uu_addr="${1}" else uu_addr="${uu_addr} ${1}" fi shift fi done fi # get compression program case ${uu_comp} in bzip) # use bzip2 (rbsmtp) cprog='/usr/bin/bzip2' ;; compress) # use compress (rcsmtp) cprog='/usr/bin/compress' ;; gzip) # use gzip (rgsmtp) cprog='/usr/bin/gzip' ;; szip) # use szip (rssmtp) cprog='/usr/bin/szip' ;; *) # use no compression at all (rsmtp) cprog='' ;; esac # check if compression program exists if [ -n "${cprog}" ] then # use compression if [ -f ${cprog} ] then ${cprog} | /usr/bin/uux -r - ${uu_host}!rmail ${uu_addr} else # error echo "compression program '${cprog}' cannot be found!" exit 1 fi else # use no compression /usr/bin/uux -r - ${uu_host}!rmail ${uu_addr} fi fi