#!/bin/sh
#
# This is the high level driver script for the host side of KGDB
#
# We quickly check to see if the user is passing the no windows
# argument (can be both --nw and -nw)
#
window=0
for i in $*
do
  if test "$i" = --nw
  then
    window=1
  fi
  if test "$i" = -nw
  then
    window=1
  fi
done
#
# based upon what the argument checking reveals, we execute gdb with or
# without ddd. Note that we pass ALL arguments passed to this script
# directly to kgdb.
#
dir=`dirname "$0"`
scripts_dir=$dir
bin_dir=$dir
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/dt/lib"; export LD_LIBRARY_PATH
cmd="$bin_dir/kgdb_gdb $* --command=$scripts_dir/kgdb_init"
if test "$window" -eq 0
then
  exec "$bin_dir"/ddd --gdb --debugger $cmd
else
  exec $cmd
fi
