Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/stripmail

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

# Given a upas/fs message, print the simplest
# representation we reasonably can.

D=$1

fn findalt {
	switch(`{cat $D^/type}){
		case multipart/*
			D=$D^/1
	}
	if(~ `{cat $D^/type} multipart/*)
		findalt $D
}

fn prpart {
	part=$1
	parttype=`{cat $part^/type}
	switch($parttype){
		case text/plain
			cat $part^/body
		case text/html
			htmlfmt $part^/body
		case text/texmacs
			`{doctype -n $part/body}
		case application/pdf
			pdf2ps $part/body | ps2txt
		case *
			cat $part^/body
	}
}

findalt $D

prpart $D

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.