# t150 --- availability to shell, --version / --help
#
# Copyright (C) 2010-2015 Thien-Thi Nguyen
#
# 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 3 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/>.

. $srcdir/common
split_std_out_err no
set -e

programs='
ci
co
ident
merge
rcs
rcsclean
rcsdiff
rcsmerge
rlog
'

##
# Check that each program can be found by the shell
# (via the ‘type’ command), and that each program displays
# reasonable output when invoked with ‘--version’ and ‘--help’.
##

for p in $programs ; do
    must 'type $p'

    vcmd="$p --version"
    vout=$wd/version-$p
    must '$vcmd > $vout'
    grep -F "$p (GNU RCS)" $vout || say_what $vcmd

    hcmd="$p --help"
    hout=$wd/help-$p
    must '$hcmd > $hout'
    grep -F 'Report bugs to' $hout || say_what $hcmd
done

# t150 ends here
