source: trunk/dsys/funcEXE@ 407

Last change on this file since 407 was 27, checked in by rainer, 19 years ago

Support for server-to-server relay and more user policies

File size: 1.6 KB
RevLine 
[1]1#########################################################################
2#
3# Subroutines for determining existence of / path to executables
4#
5#########################################################################
[27]6#
7# Copyright Rainer Wichmann (2005)
8#
9# License Information:
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
[1]24
25findEXE() {
26 if test $# -lt 1
27 then
28 printFATAL "findEXE: insufficient arguments"
29 fi
30
31 X="$PATH";
32 prog="$1";
33 OLD_IFS=${IFS}
34 IFS=':'; export IFS
35 for dir in $X; do
36 exe="$dir/$1"
37 if (test -f "$exe" || test -f "${exe}.exe")
38 then
39 EXECUTABLE="$exe"; export EXECUTABLE
40 IFS=${OLD_IFS}; export IFS
41 return 0
42 fi
43 done
44 IFS=${OLD_IFS}; export IFS
45 printINFO "Command $1 not found in \$PATH"
46 EXECUTABLE=""; export EXECUTABLE
47}
48
49needEXE() {
50 # printINFO "Checking for $@"
51 for arg
52 do
53 findEXE "$arg"
54 test -z "$EXECUTABLE" && printFATAL "Need \"$arg\" in \$PATH"
55 done
56 return 0
57}
Note: See TracBrowser for help on using the repository browser.