#!/bin/sh

# @(#)REPORT version 3.12 created 1/13/93
# @(#)Copyright (c), 1987, 1992 StatSci, Inc.  All rights reserved.

C=$SHOME/cmd
BATCH=yes; export BATCH
case $1 in -e) flags=-e; shift;; esac
case $# in
0)
	trap "" 2
	(echo "invisible(options(echo=T))";
		$C/report.in $flags ) | Splus 2>&1 | $C/report.out
	;;
1)
	trap "" 2
	(echo "invisible(options(echo=T))";
		$C/report.in $flags < $1 ) | Splus 2>&1 | $C/report.out
	;;
2)
	echo "REPORT will run in batch: input from file $1, output on file $2."
	sleep 5	# chance for user to abort
	nohup sh -c "(echo 'invisible(options(echo=T))';
		$C/report.in $flags < $1) | Splus 2>&1 | $C/report.out" > $2 &
	;;
*)	echo "Usage:

Splus REPORT input output     # batch execution
Splus REPORT input > output    # wait for completion 
Splus REPORT < input > output   # wait for completion

The last two forms can be used in pipelines."
	;;
esac
