aboutsummaryrefslogtreecommitdiffstats
path: root/examples/bashdb
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1997-06-05 14:59:13 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:50 +0000
commitd166f048818e10cf3799aa24a174fb22835f1acc (patch)
tree1ca27f9243900f8b236d0cde6a3862002aea9e19 /examples/bashdb
parentccc6cda312fea9f0468ee65b8f368e9653e1380b (diff)
downloadandroid_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz
android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.bz2
android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.zip
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'examples/bashdb')
-rw-r--r--examples/bashdb/bashdb6
-rw-r--r--examples/bashdb/bashdb.fns10
-rw-r--r--examples/bashdb/bashdb.pre2
3 files changed, 12 insertions, 6 deletions
diff --git a/examples/bashdb/bashdb b/examples/bashdb/bashdb
index 9e79d71..97d287d 100644
--- a/examples/bashdb/bashdb
+++ b/examples/bashdb/bashdb
@@ -25,5 +25,9 @@ _libdir=.
_dbgfile=$_tmpdir/bashdb$$ #temp file for script being debugged
cat $_libdir/bashdb.pre $_guineapig > $_dbgfile
-exec bash $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+if [ -f "$BASH" ]; then
+ exec $BASH $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+else
+ exec bash $_dbgfile $_guineapig $_tmpdir $_libdir "$@"
+fi
# end of bashdb
diff --git a/examples/bashdb/bashdb.fns b/examples/bashdb/bashdb.fns
index 9a9aa49..79d9737 100644
--- a/examples/bashdb/bashdb.fns
+++ b/examples/bashdb/bashdb.fns
@@ -13,6 +13,7 @@ _steptrap() {
let " $_trace" &&
_msg "$PS4, line $_curline: ${_lines[$(($_curline-$_firstline+1))]}"
+
# if in step mode, decrement counter
let " $_steps >= 0" && let _steps="$_steps - 1"
@@ -87,7 +88,7 @@ _at_linenumbp() {
if [ -z "${_linebp}" ]; then
return 1
fi
- echo "${curline}" | egrep -s "(${linebp%\|})" >/dev/null 2>&1
+ echo "${_curline}" | egrep "(${_linebp%\|})" >/dev/null 2>&1
return $?
}
@@ -95,11 +96,12 @@ _at_linenumbp() {
# search string brkpts to see if next line in script matches.
_at_stringbp() {
local l;
+
if [ -z "$_stringbp" ]; then
return 1;
fi
l=${_lines[$_curline-$_firstline+1]}
- echo "${l} | egrep -s "*(${stringbp%\|})*" >/dev/null 2>&1
+ echo "${l}" | egrep "*(${_stringbp%\|})*" >/dev/null 2>&1
return $?
}
@@ -132,9 +134,9 @@ _setbp() {
# list brkpts and break condition.
_listbp() {
_msg "Breakpoints at lines:"
- _msg "$(echo $_linebp | tr '|' ' ')"
+ _msg "${_linebp//\|/ }"
_msg "Breakpoints at strings:"
- _msg "$(echo $_stringbp | tr '|' ' ')"
+ _msg "${_stringbp//\|/ }"
_msg "Break on condition:"
_msg "$_brcond"
}
diff --git a/examples/bashdb/bashdb.pre b/examples/bashdb/bashdb.pre
index e692727..c9cdb72 100644
--- a/examples/bashdb/bashdb.pre
+++ b/examples/bashdb/bashdb.pre
@@ -11,7 +11,7 @@ set -o history
set +H
# prompt for trace line
-PS4=$1
+PS4="${1}"
_dbgfile=$0
_guineapig=$1