annotate build-aux/csharpexec.sh.in @ 17921:58c1b50299a6

getopt: give accurate ambiguity diagnostic on mem exhaustion * lib/getopt.c (_getopt_internal_r): The previous commit broke out the loop too early, which could give a false indication of ambiguous options under memory exhaustion.
author Pádraig Brady <P@draigBrady.com>
date Wed, 18 Feb 2015 22:37:31 +0000
parents ab58d4870664
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #!/bin/sh
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 # Execute a C# program.
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
17848
ab58d4870664 version-etc: new year
Paul Eggert <eggert@cs.ucla.edu>
parents: 17587
diff changeset
4 # Copyright (C) 2003-2015 Free Software Foundation, Inc.
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 # Written by Bruno Haible <bruno@clisp.org>, 2003.
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 #
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7012
diff changeset
7 # This program is free software: you can redistribute it and/or modify
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 # it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7012
diff changeset
9 # the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7012
diff changeset
10 # (at your option) any later version.
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 #
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 # GNU General Public License for more details.
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 #
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7012
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # This uses the same choices as csharpexec.c, but instead of relying on the
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 # environment settings at run time, it uses the environment variables
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 # present at configuration time.
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 # This is a separate shell script, because the various C# interpreters have
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 # different command line options.
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 # Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS]
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 # Options:
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # -L DIRECTORY search for C# libraries also in DIRECTORY
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g'
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 options_ilrun=
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 libdirs_mono=
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 prog=
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 while test $# != 0; do
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 case "$1" in
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 -L)
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 options_ilrun="$options_ilrun -L "`echo "$2" | sed -e "$sed_quote_subst"`
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 libdirs_mono="${libdirs_mono:+$libdirs_mono@MONO_PATH_SEPARATOR@}$2"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 shift
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 ;;
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 -*)
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 echo "csharpexec: unknown option '$1'" 1>&2
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 exit 1
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 ;;
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 *)
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 prog="$1"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 break
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 ;;
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 esac
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 shift
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 done
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 if test -z "$prog"; then
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 echo "csharpexec: no program specified" 1>&2
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 exit 1
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 fi
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 case "$prog" in
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 *.exe) ;;
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 *)
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 echo "csharpexec: program is not a .exe" 1>&2
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 exit 1
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 ;;
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 esac
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 if test -n "@HAVE_ILRUN@"; then
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 test -z "$CSHARP_VERBOSE" || echo ilrun $options_ilrun "$@"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
67 exec ilrun $options_ilrun "$@"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 else
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 if test -n "@HAVE_MONO@"; then
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 CONF_MONO_PATH='@MONO_PATH@'
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 if test -n "$libdirs_mono"; then
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+@MONO_PATH_SEPARATOR@$CONF_MONO_PATH}"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 else
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 MONO_PATH="$CONF_MONO_PATH"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 fi
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 export MONO_PATH
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 test -z "$CSHARP_VERBOSE" || echo mono "$@"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 exec mono "$@"
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 else
7012
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
80 if test -n "@HAVE_CLIX@"; then
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
81 CONF_CLIX_PATH='@CLIX_PATH@'
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
82 if test -n "$libdirs_mono"; then
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
83 @CLIX_PATH_VAR@="$libdirs_mono${CONF_CLIX_PATH:+@MONO_PATH_SEPARATOR@$CONF_CLIX_PATH}"
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
84 else
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
85 @CLIX_PATH_VAR@="$CONF_CLIX_PATH"
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
86 fi
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
87 export @CLIX_PATH_VAR@
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
88 test -z "$CSHARP_VERBOSE" || echo clix "$@"
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
89 exec clix "$@"
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
90 else
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
91 echo 'C# virtual machine not found, try installing pnet, then reconfigure' 1>&2
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
92 exit 1
268bfcec1a6f Update csharpexec module from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents: 6516
diff changeset
93 fi
6516
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 fi
b23cbd84435d Moved here from lib/csharpexec.sh.in.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 fi