1#!/bin/bash
 2
 3# Wrapper script to call java trang package
 4
 5usage () {
 6  echo "Usage: $0 [-I rng|rnc|dtd|xml] [-O rng|rnc|dtd|xsd] [-i input-param] [-o output-param] inputFileOrUri ... outputFile" >&2
 7  exit 1
 8}
 9
10while getopts i:o:I:O: opt; do
11  case $opt in
12    i)
13      input_param=$OPTARG
14      args="$args -i $OPTARG "
15      ;;
16    I)
17      input_format=$OPTARG
18      args="$args -I $OPTARG "
19      ;;
20    o)
21      input_param=$OPTARG
22      args="$args -o $OPTARG "
23      ;;
24    O)
25      output_format=$OPTARG
26      args="$args -O $OPTARG "
27      ;;
28    *)
29      usage
30      ;;
31  esac
32done
33
34shift $(($OPTIND - 1))
35
36test $# -gt 1 || usage
37
38while [ $# -gt 1 ]; do
39  in="$in $1"
40  shift
41done
42
43out="${!#}"
44
45java -jar TEMPLATE_SHARE/trang.jar $args $in "$out"
46
47exit 0