summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Cline2011-07-12 23:37:49 -0700
committerMatthew Cline2011-07-12 23:37:49 -0700
commitfed916bf8d774e0f1c678f18dc7e5e2cb8242162 (patch)
treea8fcbec851460264cc8b43d1abd551a12c23df72
parent1b011cdf6ce4331d731fd361fd82f367a9484435 (diff)
downloaddfhack-fed916bf8d774e0f1c678f18dc7e5e2cb8242162.tar.gz
dfhack-fed916bf8d774e0f1c678f18dc7e5e2cb8242162.tar.bz2
dfhack-fed916bf8d774e0f1c678f18dc7e5e2cb8242162.tar.xz
Linux launch script: gdb and terminal reset
1) Giving "-g" or "--gdb" as the first argument to the dfhack script will launch DF under gdb. 2) "reset -I" is called after DF finishes, to return the terminal to a sane state in case DF crashed or was killed.
-rwxr-xr-xpackage/linux/dfhack19
1 files changed, 18 insertions, 1 deletions
diff --git a/package/linux/dfhack b/package/linux/dfhack
index 8484a3e5..35e9cfeb 100755
--- a/package/linux/dfhack
+++ b/package/linux/dfhack
@@ -2,6 +2,8 @@
# NOTE: This is dfhack's modification of the normal invocation script,
# changed to properly set LD_PRELOAD so as to run DFHACK.
+#
+# You can run DF under gdb by passing -g or --gdb as the first argument.
DF_DIR=$(dirname "$0")
cd "${DF_DIR}"
@@ -10,4 +12,19 @@ export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch.
export LD_PRELOAD=./libdfhack.so
-./libs/Dwarf_Fortress $* # Go, go, go! :)
+case "$1" in
+ -g | --gdb)
+ shift
+ gdb ./libs/Dwarf_Fortress $*
+ ret=$?
+ ;;
+ *)
+ ./libs/Dwarf_Fortress $*
+ ret=$?
+ ;;
+esac
+
+# Reset terminal to sane state in case of a crash
+reset -I
+
+exit $ret