761 |
# Example: find_tool awk:gawk:nawk awk_tooltest1 awk_tooltest2 |
# Example: find_tool awk:gawk:nawk awk_tooltest1 awk_tooltest2 |
762 |
find_tool () |
find_tool () |
763 |
{ |
{ |
764 |
default_TOOL=$1 |
dTn=$1 |
765 |
|
default_TOOL=$2 |
766 |
echo find_tool: ${1+"$@"} >>$LOGFILE |
echo find_tool: ${1+"$@"} >>$LOGFILE |
767 |
cmds="`IFS=:; echo $1`"; shift; tooltests="${1+$@}" |
cmds="`IFS=:; echo $2`"; shift; shift; tooltests="${1+$@}" |
768 |
if test -z "$tooltests"; then tooltests=version_test; fi |
if test -z "$tooltests"; then tooltests=version_test; fi |
769 |
clist=; for cmd in $cmds; do clist="$clist `Which -a $cmd`"; done |
clist=; for cmd in $cmds; do clist="$clist `Which -a $cmd`"; done |
770 |
# Make sure the default tool is just the first real command name |
# Make sure the default tool is just the first real command name |
797 |
fi |
fi |
798 |
done |
done |
799 |
if test -n "$TOOL"; then |
if test -n "$TOOL"; then |
800 |
echo "Notice: The default version of \`$default_TOOL' is defective." >>$LOGFILE |
echo "Notice: The default version of $dTn (\`$default_TOOL')" >>$LOGFILE |
801 |
echo "using \`$TOOL' and hoping for the best." >>$LOGFILE |
echo "is defective. Using \`$TOOL' and hoping for the best." >>$LOGFILE |
802 |
echo "Notice: The default version of \`$default_TOOL' is defective." >&2 |
echo "Notice: The default version of $dTn (\`$default_TOOL')" >&2 |
803 |
echo "using \`$TOOL' and hoping for the best." >&2 |
echo "is defective. Using \`$TOOL' and hoping for the best." >&2 |
804 |
echo $TOOL |
echo $TOOL |
805 |
else |
else |
806 |
echo $default_TOOL |
echo $default_TOOL |
807 |
fi |
fi |
808 |
} |
} |
809 |
|
|
810 |
id_tool_test () |
id_tool_test () |
811 |
{ |
{ |
820 |
fi |
fi |
821 |
} |
} |
822 |
|
|
823 |
ID=`find_tool id version_test id_tool_test` |
ID=`find_tool id id version_test id_tool_test` |
824 |
echo "Using ID=$ID" >>$LOGFILE |
echo "Using ID=$ID" >>$LOGFILE |
825 |
|
|
826 |
# You can't run CVS as root; print a nice error message here instead |
# You can't run CVS as root; print a nice error message here instead |
965 |
fi |
fi |
966 |
} |
} |
967 |
|
|
968 |
EXPR=`find_tool ${EXPR}:gexpr \ |
EXPR=`find_tool expr ${EXPR}:gexpr \ |
969 |
version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \ |
version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \ |
970 |
expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR` |
expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR` |
971 |
|
|
1045 |
return 0 |
return 0 |
1046 |
} |
} |
1047 |
|
|
1048 |
TR=`find_tool ${TR}:gtr version_test tr_tooltest1` |
TR=`find_tool tr ${TR}:gtr version_test tr_tooltest1` |
1049 |
echo "Using TR=$TR" >>$LOGFILE |
echo "Using TR=$TR" >>$LOGFILE |
1050 |
|
|
1051 |
# MacOS X (10.2.8) has a /bin/ls that does not work correctly in that |
# MacOS X (10.2.8) has a /bin/ls that does not work correctly in that |
1070 |
return 0 |
return 0 |
1071 |
fi |
fi |
1072 |
} |
} |
1073 |
LS=`find_tool ls:gls version_test ls_tooltest` |
LS=`find_tool ls ls:gls version_test ls_tooltest` |
1074 |
echo "Using LS=$LS" >>$LOGFILE |
echo "Using LS=$LS" >>$LOGFILE |
1075 |
|
|
1076 |
# Awk testing |
# Awk testing |
1112 |
return 0 |
return 0 |
1113 |
} |
} |
1114 |
|
|
1115 |
AWK=`find_tool gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2` |
AWK=`find_tool awk gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2` |
1116 |
echo "Using AWK=$AWK" >>$LOGFILE |
echo "Using AWK=$AWK" >>$LOGFILE |
1117 |
|
|
1118 |
|
|