From 915766c624880ead34a80796a80f014822db3d96 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Thu, 1 Mar 2012 03:36:48 +0000 Subject: unposted (users/16697): use a better output file name when the DISPLAY variable refers to a socket file (MacOS); fix problem with writing the output file when the user overrides the default value of TERM. --- Functions/Misc/zkbd | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Functions') diff --git a/Functions/Misc/zkbd b/Functions/Misc/zkbd index a28354b07..1065a84f1 100644 --- a/Functions/Misc/zkbd +++ b/Functions/Misc/zkbd @@ -14,8 +14,7 @@ local zkbd term key seq zkbd=${ZDOTDIR:-$HOME}/.zkbd [[ -d $zkbd ]] || mkdir $zkbd || return 1 -print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1 -trap "unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp" 0 +trap 'unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp' 0 trap "return 1" 1 2 15 getmbkey () { @@ -57,6 +56,7 @@ getseq () { read term"?Enter current terminal type: [$TERM] " [[ -n $term ]] && TERM=$term +print 'typeset -g -A key\n' > $zkbd/$TERM.tmp || return 1 cat <<\EOF @@ -251,21 +251,22 @@ else fi fi -local termID=${DISPLAY:-$VENDOR-$OSTYPE} -command mv $zkbd/$TERM.tmp $zkbd/$TERM-$termID +local termID=${${DISPLAY:t}:-$VENDOR-$OSTYPE} termFile=$zkbd/$TERM.tmp +command mv $termFile $zkbd/$TERM-$termID && termFile=$zkbd/$TERM-$termID cat <