1#!/bin/sh 2# Execute a C# program. 3 4# Copyright (C) 2003, 2005 Free Software Foundation, Inc. 5# Written by Bruno Haible <bruno@clisp.org>, 2003. 6# 7# This program is free software: you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 3 of the License, or 10# (at your option) any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program. If not, see <http://www.gnu.org/licenses/>. 19 20# This uses the same choices as csharpexec.c, but instead of relying on the 21# environment settings at run time, it uses the environment variables 22# present at configuration time. 23# 24# This is a separate shell script, because the various C# interpreters have 25# different command line options. 26# 27# Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS] 28# Options: 29# -L DIRECTORY search for C# libraries also in DIRECTORY 30 31sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g' 32options_ilrun= 33libdirs_mono= 34prog= 35while test $# != 0; do 36 case "$1" in 37 -L) 38 options_ilrun="$options_ilrun -L "`echo "$2" | sed -e "$sed_quote_subst"` 39 libdirs_mono="${libdirs_mono:+$libdirs_mono:}$2" 40 shift 41 ;; 42 -*) 43 echo "csharpexec: unknown option '$1'" 1>&2 44 exit 1 45 ;; 46 *) 47 prog="$1" 48 break 49 ;; 50 esac 51 shift 52done 53if test -z "$prog"; then 54 echo "csharpexec: no program specified" 1>&2 55 exit 1 56fi 57case "$prog" in 58 *.exe) ;; 59 *) 60 echo "csharpexec: program is not a .exe" 1>&2 61 exit 1 62 ;; 63esac 64 65if test -n ""; then 66 test -z "$CSHARP_VERBOSE" || echo ilrun $options_ilrun "$@" 67 exec ilrun $options_ilrun "$@" 68else 69 if test -n "1"; then 70 CONF_MONO_PATH='' 71 if test -n "$libdirs_mono"; then 72 MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+:$CONF_MONO_PATH}" 73 else 74 MONO_PATH="$CONF_MONO_PATH" 75 fi 76 export MONO_PATH 77 test -z "$CSHARP_VERBOSE" || echo mono "$@" 78 exec mono "$@" 79 else 80 if test -n ""; then 81 CONF_CLIX_PATH='' 82 if test -n "$libdirs_mono"; then 83 ="$libdirs_mono${CONF_CLIX_PATH:+:$CONF_CLIX_PATH}" 84 else 85 ="$CONF_CLIX_PATH" 86 fi 87 export 88 test -z "$CSHARP_VERBOSE" || echo clix "$@" 89 exec clix "$@" 90 else 91 echo 'C# virtual machine not found, try installing pnet, then reconfigure' 1>&2 92 exit 1 93 fi 94 fi 95fi 96