From 09f3f66eb9e5006a66e4364ad20763cc2fd8161c Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 29 Jul 2016 15:57:02 +0200 Subject: add contrib/malternative --- contrib/malternative | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 contrib/malternative (limited to 'contrib/malternative') diff --git a/contrib/malternative b/contrib/malternative new file mode 100755 index 0000000..db54841 --- /dev/null +++ b/contrib/malternative @@ -0,0 +1,16 @@ +#!/bin/sh +# malternative - multipart/alternative decoding policy + +{ + echo "Content-Type: $PIPE_CONTENTTYPE" + echo + cat +} | mshow -t /dev/stdin | awk ' + BEGIN { split("", ct) } + /^ [0-9]/ { ct[++n] = $2 } + function prefer(t) { for (i in ct) if (ct[i] == t) exit(64+i) } + END { + prefer("text/plain") + prefer("text/html") + exit 64+1 # default to first part + }' -- cgit 1.4.1