shithub: rc

Download patch

ref: f07569f5b3e61db3641d01c45c77a3e749e0763f
parent: ee9dadb57f8f07fa22c389cdb953fc7fe3f44be8
author: sl <sl@x1yg3>
date: Sun Jul 6 18:56:11 EDT 2025

add nml

--- a/INDEX
+++ b/INDEX
@@ -42,6 +42,7 @@
 netproc - "netstat -p"
 nipmux - Drop packets for IP addresses of aggressive crawlers.
 nk - Install new kernel for Intel/AMD machines.
+nml - Mailing list script called from /mail/box/$list/pipeto.
 nn - run webcookies/webfs, populate factotum from secstore, perform some binds, run plumber.
 osuny - rcpu to or rimport from osuny.bell-labs.co
 r - setup environment and run rio.
--- /dev/null
+++ b/nml
@@ -1,0 +1,33 @@
+#!/bin/rc
+# Mailing list script called from /mail/box/$list/pipeto.
+# 2023-05-13T19:01:43-04:00
+rfork en
+fn fixheader{
+	{
+		sed 1q $D/rawunix
+		cat $D/rawheader
+		echo 'List-ID: <'$LIST.$DOMAIN'>'
+		echo 'List-Help: <http://lists.9front.org>'
+		echo X-Glyph: ➈
+		echo -n 'X-Bullshit: '
+		bullshit
+		echo
+	} >>$TMP.header >>[2]$TMP.errors
+}
+fn fixmsg{ cat $TMP.header $D/rawbody >$TMP.med >>[2]$TMP.errors }
+fn index{ awk -v fileid'='$2^: '{print fileid $0}' >>/mail/box/$1/index >>[2]$TMP.errors }
+fn blingdex{ <$TMP.med index $LIST `{sed -n 19p $D/info} >>[2]$TMP.errors }
+fn try{ <$TMP.med /bin/upas/ml -p -r $REPLY /mail/box/$LIST/address-list $LIST >>[2]$TMP.errors }
+fn die{ {echo 'ACHTUNG! This list does not accept HTML messages. See: https://useplaintext.email'; echo $status; echo; echo errors:; cat $TMP.errors; echo; echo message:; cat $TMP.raw} | mail -s $LIST^@^$DOMAIN^' '^FAILED $*; cleanup; exit }
+fn cleanup{ rm -f $TMP $TMP.* }
+@{
+	rfork en	
+	{<$TMP.raw sed '/^$/,$ s/^From / From /'; echo} >$TMP
+	/bin/upas/fs -f $TMP
+	D=/mail/fs/mbox/1	
+#	if(~ `{file $D/body} *HTML* && ! ~ `{cat $D/from} *code.9front.org sl@stanleylieber.com)	# sorry, but fuck you
+#		die `{cat $D/from}
+	fixheader && fixmsg && try 
+	cleanup
+	exit
+} >/dev/null >[2=1] &
--