blob: bf4a58e0eb6e84fff5101d3e47c98cd999cd9f84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/bin/sh
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
set -e
LC_ALL=C
export LC_ALL
##################################################
# options
usage (){
cat <<EOF
mkc_check_prog detects presense of program file.
Usage: mkc_check_prog [OPTION] progname
OPTIONS:
-h display this screen
-i <progid> program id, a part of _mkc_* cache file
-d delete cache files
Examples:
mkc_check_prog -h
mkc_check_prog lua
mkc_check_prog gawk
mkc_check_prog -i gxx g++
EOF
}
while test $# -ne 0; do
case "$1" in
-h)
usage
exit 0;;
-i)
pathpart=prog_$2
shift;;
-d)
delcache=1;;
--)
shift
break;;
-*)
echo "Unknown option $1" 1>&2
exit 1;;
*)
break;;
esac
shift
done
if test $# -ne 1; then
usage
exit 1
fi
##################################################
# initializing
pathpart=${pathpart-prog_`echo $1 | tr /. __`}
. mkc_check_common.sh
##################################################
# test
check_itself (){
mkc_which -x "$1" 2>"${tmperr}"
}
check_and_cache "checking for program $1" "$cache" "$1"
##################################################
# clean-ups
cleanup
##################################################
# finishing
if test -n "$ret"; then
printme "$ret\n" 1>&2
else
printme 'NOT FOUND\n' 1>&2
fi
echo $ret
|