commit 3c852bbfda61f3e73624d36c179dd473730ed148
parent d3e1121c4b7c2e47d2067cd76bcb9c99a52e9afd
Author: parazyd <parazyd@dyne.org>
Date: Thu, 1 Mar 2018 02:31:09 +0100
Add rpcomp.
Diffstat:
3 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/bin/rpcomp b/bin/rpcomp
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+profile="${RPPROFILE:-$HOME/.rp/default}"
+. "$HOME"/.rp/rplib/common.sh
+
+to=""
+[ $# -gt 0 ] && to="$1"
+
+tmpfile=$(mktemp /tmp/rpcomp.XXXXXX.eml)
+signalh() {
+ rm -f "$tmpfile"
+}
+trap 'signalh' 3 6 9 15
+
+sh "$profile/../rplib/compose.sh" "$to" > "$tmpfile"
+
+"$EDITOR" "$tmpfile"
+mv "$tmpfile" "$profile/tmp/outbox"
+echo "$profile/tmp/outbox/$(basename $tmpfile)"
+signalh
+
diff --git a/config.mk b/config.mk
@@ -2,7 +2,7 @@ NAME = rohrpost
# paths
PREFIX = /usr/local
-SHAREPREFIX = $(PREFIX)/share/$(NAME)
+SHAREPREFIX = $(PREFIX)/share/rp
MANPREFIX = $(PREFIX)/share/man
CFLAGS = -O2 -Wall -pedantic
diff --git a/rplib/compose.sh b/rplib/compose.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+to=""
+[ $# -gt 0 ] && to="$1"
+
+printf "Date: %s
+From: %s
+Subject: Subject
+To: %s
+Cc:
+Bcc:
+User-Agent: rp
+MIME-Version: 1.0
+Content-Type: text/plain; charset=\"utf-8\"
+Content-Transfer-Encoding: 8bit\n" \
+ "$(LANG=C date "+%a, %d %b %Y %T %Z")" \
+ "$(rpcfg -v defaultfrom)" \
+ "$to"
+
+printf "\nText\n\n"
+
+[ -e "$HOME/.signature" ] && {
+ printf -- "-- \n"
+ cat "$HOME/.signature"
+}