mirror of https://github.com/leahneukirchen/mblaze
add contrib/malternative
parent
8228619e05
commit
09f3f66eb9
@ -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
|
||||||
|
}'
|
Loading…
Reference in New Issue