Use descriptive const for readline history filename

This commit is contained in:
Derek Parker
2014-09-30 08:50:12 -05:00
parent a712a86074
commit 551f19531d

View File

@ -20,6 +20,8 @@ type term struct {
stdin *bufio.Reader stdin *bufio.Reader
} }
const historyFile string = ".dbg_history"
func main() { func main() {
// We must ensure here that we are running on the same thread during // We must ensure here that we are running on the same thread during
// the execution of dbg. This is due to the fact that ptrace(2) expects // the execution of dbg. This is due to the fact that ptrace(2) expects
@ -43,8 +45,7 @@ func main() {
} }
dbgproc := beginTrace(pid, proc) dbgproc := beginTrace(pid, proc)
history := ".dbg_history" goreadline.LoadHistoryFromFile(historyFile)
goreadline.LoadHistoryFromFile(history)
for { for {
cmdstr, err := t.promptForInput() cmdstr, err := t.promptForInput()
@ -55,7 +56,7 @@ func main() {
cmdstr, args := parseCommand(cmdstr) cmdstr, args := parseCommand(cmdstr)
if cmdstr == "exit" { if cmdstr == "exit" {
err := goreadline.WriteHistoryToFile(history) err := goreadline.WriteHistoryToFile(historyFile)
fmt.Println(err) fmt.Println(err)
handleExit(t, dbgproc, 0) handleExit(t, dbgproc, 0)
} }