<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>dbg-opts.sh</filename>
    </added>
    <added>
      <filename>getopt-test.sh</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,7 +8,7 @@ pkgdata_DATA =      \
 # Set up the install target 
 bin_SCRIPTS = kshdb
 
-EXTRA_DIST = $(pkgdata_DATA) THANKS
+EXTRA_DIST = $(pkgdata_DATA) THANKS getopt-test.sh
 
 # cvs2cl
 MAINTAINERCLEANFILES = ChangeLog</diff>
      <filename>Makefile.am</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!/bin/zsh
+#!/bin/ksh
 autoreconf -i &amp;&amp; \
 autoconf &amp;&amp; {
   print &quot;Running configure with $@&quot;</diff>
      <filename>autogen.sh</filename>
    </modified>
    <modified>
      <diff>@@ -4,6 +4,26 @@ AM_PATH_LISPDIR
 AM_MAINTAINER_MODE
 AM_INIT_AUTOMAKE([no-define])
 
+AC_SUBST(TRY_GETOPT)
+
+AC_ARG_ENABLE([gnugetopt],
+	AC_HELP_STRING([--enable-getopt], 
+	[Allow GNU-style long options (default enabled)]))
+
+if test &quot;${enable_getopt}&quot; != &quot;no&quot; ; then
+  $SH_PROG ./getopt-test.sh
+  if test $? -eq 0 ; then
+    AC_MSG_RESULT([Good! Your long options seem to be working okay.])
+    TRY_GETOPT=1
+  else
+    AC_MSG_WARN([getopt doesn't seem to handle long options correctly.])
+    AC_MSG_WARN([Disabling long-options in bashdb.])
+    TRY_GETOPT=0
+  fi  
+else
+  TRY_GETOPT=0
+fi
+
 AC_CONFIG_SRCDIR(kshdb.in)
 if test x$srcdir = x ; then
   srcdir=$ac_pwd
@@ -13,14 +33,14 @@ fi
 ## test which ksh to run. It can be omitted too in which case we'll
 ## look for a ksh binary.
 AC_ARG_WITH(ksh, AC_HELP_STRING([--with-ksh], 
-		  [location of ksh OK_KSH_VERS program]), KSH_PROG=$withval)
+		  [location of ksh OK_KSH_VERS program]), SH_PROG=$withval)
 
-if test &quot;$KSH_PROG&quot; = &quot;yes&quot; || test &quot;$KSH_PROG&quot; = &quot;no&quot; || test -z &quot;$KSH_PROG&quot;
+if test &quot;$SH_PROG&quot; = &quot;yes&quot; || test &quot;$SH_PROG&quot; = &quot;no&quot; || test -z &quot;$SH_PROG&quot;
 then
-  AC_PATH_PROG(KSH_PROG, ksh93, no)
+  AC_PATH_PROG(SH_PROG, ksh93, no)
 fi
 
-if test &quot;$KSH_PROG&quot; = no; then
+if test &quot;$SH_PROG&quot; = no; then
   AC_MSG_ERROR([I didn't find the ksh executable.\
   You might want to use the --with-ksh option.])
 fi
@@ -45,7 +65,7 @@ fi
 # Get the fully expanded name of pkgdatadir. This is used in kshdb.in
 # and dbg-main.sh.in and for installing debugger files.
 
-pkgdatadir=$datadir/zshdb
+pkgdatadir=$datadir/kshdb
 AC_SUBST_DIR(PKGDATADIR, $pkgdatadir)
 
 AM_MISSING_PROG(GIT2CL, git2cl, $missing_dir)</diff>
      <filename>configure.ac</filename>
    </modified>
    <modified>
      <diff>@@ -38,5 +38,5 @@ done
 
 # # Run the user's debugger startup file
 # if [[ -z $KSHDB_RESTART_FILE &amp;&amp; -r ~/.kshdbrc ]] ; then
-#   _Dbg_do_source ~/.zshbrc
+#   _Dbg_do_source ~/.kshbrc
 # fi</diff>
      <filename>dbg-main.sh</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,23 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
+# kshdb - top-level debugger program.
+#
+#   Copyright (C) 2008 Rocky Bernstein rocky@gnu.org
+#
+#   kshdb is free software; you can redistribute it and/or modify it under
+#   the terms of the GNU General Public License as published by the Free
+#   Software Foundation; either version 2, or (at your option) any later
+#   version.
+#
+#   kshdb is distributed in the hope that it will be useful, but WITHOUT ANY
+#   WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#   for more details.
+#   
+#   You should have received a copy of the GNU General Public License along
+#   with kshdb; see the file COPYING.  If not, write to the Free Software
+#   Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
 # Are we using a debugger-enabled ksh? If not let's stop right here.
 if [[ -z &quot;$.sh.level}&quot; ]] ; then 
   echo &quot;Sorry, your ksh just isn't modern enough.&quot; 2&gt;&amp;1
@@ -9,12 +27,15 @@ fi
 # This routine gets called via the -c or --command option and its sole
 # purpose is to capture the command string such as via &quot;x $*&quot; or 
 # in a traceback (&quot;where&quot;).
-function bashdb_eval {
+function _Dbg_eval {
   eval $*  # Type: &quot;x $*&quot; to see what's being run.
 }
 
 typeset -a _Dbg_script_args=(&quot;$@&quot;)
 
+# Original $0. Note we can't set this in an include.
+typeset -r _Dbg_orig_0=$0
+
 # Equivalent to basename $0; the short program name
 typeset _Dbg_pname=${0##*/}  
 
@@ -39,6 +60,25 @@ if [[ ! -d $_Dbg_libdir ]] &amp;&amp; [[ ! -d $_Dbg_libdir ]] ; then
   exit 1
 fi
 
+. $_Dbg_libdir/dbg-opts.sh
+
+# [[ $# == 0 &amp;&amp; -z $show_version &amp;&amp; -z $_Dbg_cmd ]] &amp;&amp; {
+#   echo &quot;${_Dbg_pname}: Need to give a script name to debug.&quot;
+#   exit 1
+# }
+
+if [[ ! -d $_Dbg_tmpdir ]] &amp;&amp; [[ ! -w $_Dbg_tmpdir ]] ; then
+  echo &quot;${_Dbg_pname}: cannot write to temp directory $_Dbg_tmpdir.&quot; &gt;&amp;2
+  echo &quot;${_Dbg_pname}: Use -T try directory location.&quot; &gt;&amp;2
+  exit 1
+fi
+
+[[ -r $_Dbg_libdir/$_Dbg_main ]] || {
+  echo &quot;${_Dbg_pname}: cannot read debugger file $_Dbg_libdir/$_Dbg_main.&quot; &gt;&amp;2
+  echo &quot;${_Dbg_pname}: Perhaps bashdb is installed incorrectly.&quot; &gt;&amp;2
+  exit 1
+}
+
 . ${_Dbg_libdir}/dbg-main.sh
 
 # Note that this is called via kshdb rather than &quot;ksh --debugger&quot; or kshdb-trace</diff>
      <filename>kshdb.in</filename>
    </modified>
    <modified>
      <diff>@@ -19,14 +19,14 @@
 typeset -A _Dbg_aliases
 
 # Add an new alias in the alias table
-function _Dbg_alias_add {
+_Dbg_alias_add() {
     (( $# != 2 )) &amp;&amp; return 1
     _Dbg_aliases[$1]=$2
     return 0
 }
 
 # Remove alias $1 from our list of command aliases.
-function _Dbg_alias_remove {
+_Dbg_alias_remove() {
     (( $# != 1 )) &amp;&amp; return 1
     unset &quot;_Dbg_aliases[$1]&quot;
     return 0
@@ -34,7 +34,7 @@ function _Dbg_alias_remove {
 
 # Expand alias $1. The result is set in variable expanded_alias which
 # could be declared local in the caller.
-function _Dbg_alias_expand {
+_Dbg_alias_expand() {
     (( $# != 1 )) &amp;&amp; return 1
     expanded_alias=$1
     [[ -n ${_Dbg_aliases[$1]} ]] &amp;&amp; expanded_alias=${_Dbg_aliases[$1]}</diff>
      <filename>lib/alias.sh</filename>
    </modified>
    <modified>
      <diff>@@ -179,11 +179,9 @@ function _Dbg_parse_linespec {
     # Function name or error
     * )
       if _Dbg_is_function $linespec ${_Dbg_debug_debugger} ; then 
-	set -x
 	typeset -a word==( $(typeset -p +f $linespec) )
 	typeset -r fn=${word[1]%\(\)}
 	echo &quot;${word[3]} 1 ${word[4]}&quot;
-	set +x
       else
 	echo ''
       fi</diff>
      <filename>lib/fns.sh</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,18 @@
-#!@BASH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
+PS4='(${.sh.file}:${LINENO}): ${.sh.fun} - [${.sh.subshell}] 
+'
 
 test_alias()
 {
     _Dbg_alias_add q quit
-    _Dbg_alias_expand q expanded_alias
-    assertEquals 'quit' $expanded_alias
+    unset expanded_alias
+    _Dbg_alias_expand q
+    assertEquals 'quit' &quot;$expanded_alias&quot;
     _Dbg_alias_remove q
-    _Dbg_alias_expand q expanded_alias
-    assertEquals 'q' $expanded_alias
+    unset expanded_alias
+    _Dbg_alias_expand q
+    assertEquals 'q' &quot;$expanded_alias&quot;
 }
 
 # Make sure @top_builddir@ has a trailing slash</diff>
      <filename>test/unit/test-alias.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 PS4='(${.sh.file}:${LINENO}): ${.sh.fun} - [${.sh.subshell}] </diff>
      <filename>test/unit/test-columns.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 test_copies()</diff>
      <filename>test/unit/test-fns.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 test_undefined()</diff>
      <filename>test/unit/test-io.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 test_msg()</diff>
      <filename>test/unit/test-msg.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 do_test() </diff>
      <filename>test/unit/test-pre.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 test_not_running()</diff>
      <filename>test/unit/test-run.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-#!@KSH_PROG@
+#!@SH_PROG@
 # -*- shell-script -*-
 
 test_set_debugger_internal()</diff>
      <filename>test/unit/test-save-restore.sh.in</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5ac06bd8524051597b1232069a96d71e322b99bf</id>
    </parent>
  </parents>
  <author>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </author>
  <url>http://github.com/rocky/kshdb/commit/d85b9939fe2ddd1c67e24a5e93c99d72a5efd1f2</url>
  <id>d85b9939fe2ddd1c67e24a5e93c99d72a5efd1f2</id>
  <committed-date>2008-08-16T09:53:42-07:00</committed-date>
  <authored-date>2008-08-16T09:53:42-07:00</authored-date>
  <message>Add options processing. KSH_PROG-&gt;SH_PROG.</message>
  <tree>26ee0541a5ec9ea1e062938fb8ca54351a98d4e9</tree>
  <committer>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </committer>
</commit>
