#!/bin/sh
#
# COPYRIGHT (c) 1990 by John H. Reppy.  See COPYRIGHT file for details.
#

CMD=$0
SML=sml
CML=cml
LOAD="loadCML"

#
# process command-line options
#
while test "$#" != "0"
do
    arg=$1
    shift
    case $arg in
	-o)
	    if test "$#" = "0"
	    then
		echo "$CMD must supply image name for -o option"
		exit 1
	    fi
	    CML=$1
	    shift
	;;
	-sml)
	    if test "$#" = "0"
	    then
		echo "$CMD must supply image name for -sml option"
		exit 1
	    fi
	    SML=$1
	    shift
	;;
	-all)
	    LOAD="loadAll"
	;;
	*)
	    echo "$CMD unrecognized option $arg"
	    exit 1
	;;
    esac
done

$SML <<XXXX
use "load-cml";
$LOAD();
(exportML "$CML";
  output(std_out, CML.versionName); output(std_out, chr(10));
  output(std_out, System.version); output(std_out, chr(10)));
XXXX
