summary refs log tree commit diff
path: root/mcom
diff options
context:
space:
mode:
authorIvy Foster <ivy.foster@gmail.com>2016-09-01 18:50:20 -0500
committerIvy Foster <ivy.foster@gmail.com>2016-09-01 18:50:20 -0500
commitca8cef1660ad89ab488a22dc50eeb7cd77222c6e (patch)
tree625d716bafdf3a46c16dffbf4dfddc2a2ef02d03 /mcom
parent8d3fa82d8246a08d2c7899963ad7cf61b7a4563c (diff)
downloadmblaze-ca8cef1660ad89ab488a22dc50eeb7cd77222c6e.tar.gz
mblaze-ca8cef1660ad89ab488a22dc50eeb7cd77222c6e.tar.xz
mblaze-ca8cef1660ad89ab488a22dc50eeb7cd77222c6e.zip
Add $MBLAZE environment variable to set profile location
As a side benefit, all callers of blaze822_home_file need only pass
the filename, so the base directory is set in only one place.
Diffstat (limited to 'mcom')
-rwxr-xr-xmcom21
1 files changed, 15 insertions, 6 deletions
diff --git a/mcom b/mcom
index f720c2b..1be4da0 100755
--- a/mcom
+++ b/mcom
@@ -18,7 +18,8 @@ msgdate() {
 	mdate
 }
 
-outbox=$(mhdr -h outbox ~/.mblaze/profile)
+MBLAZE=${MBLAZE:-$HOME/.mblaze}
+outbox=$(mhdr -h outbox $MBLAZE/profile)
 if [ -z "$outbox" ]; then
 	i=0
 	while [ -f "snd.$i" ]; do
@@ -43,9 +44,9 @@ fi
 		echo "Cc: "
 		echo "Bcc: "
 		echo "Subject: "
-		from=$(mhdr -h local-mailbox ~/.mblaze/profile)
+		from=$(mhdr -h local-mailbox $MBLAZE/profile)
 		[ "$from" ] && echo "From: $from"
-		cat ~/.mblaze/headers 2>/dev/null
+		cat $MBLAZE/headers 2>/dev/null
 		msgid
 		msgdate
 		echo
@@ -59,7 +60,7 @@ fi
 		echo "Cc: $(mhdr -d -A -h to:cc: "$1" | commajoin)"
 		echo "Bcc: "
 		echo "Subject: Re: $(mscan -f '%S' "$1")"
-		cat ~/.mblaze/headers 2>/dev/null
+		cat $MBLAZE/headers 2>/dev/null
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then
 			echo -n "References:"
@@ -77,9 +78,17 @@ fi
 		echo
 	esac
 
-	if [ -f ~/.signature ]; then
+	if [ -f $MBLAZE/signature ]; then
+		SIGNATURE=$MBLAZE/signature
+	elif [ -f $HOME/.mblaze/signature ]; then
+		SIGNATURE=$HOME/.mblaze/signature
+	elif [ -f ~/.signature ]; then
+		SIGNATURE=$HOME/.signature
+	fi
+
+	if [ ! -z $SIGNATURE ]; then
 		printf '%s\n' '-- '
-		cat ~/.signature
+		cat $SIGNATURE
 	fi
 } >$draft