]> git.madduck.net Git - etc/neomutt.git/blob - .config/neomutt/container-extractor

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

buildmimetree.py: allow multipart/related instead of relative
[etc/neomutt.git] / .config / neomutt / container-extractor
1 #!/bin/sh
2 set -eu
3
4 SELF="${0##*/}"
5
6 if [ -z "${TMPDIR:-}" ]; then
7   TMPDIR=/tmp
8 fi
9 for i in $LOGNAME volatile; do
10   if [ -d "${TMPDIR}/$i" ]; then
11     TMPDIR="${TMPDIR}/$i"
12     break
13   fi
14 done
15 export TMPDIR
16 TMPDIR=$(mktemp -dp "$TMPDIR" cont.XXXXXXXXXX)
17 cleanup()
18 {
19   cd / && rm -r "$TMPDIR"
20   [ ! -t 0 ] || stty echo
21   trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15
22 }
23 trap cleanup 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15
24
25 cd "$TMPDIR"
26
27 case "$1" in
28   (application/ms-tnef)            tnef;;
29   (application/x-zip-compressed)   unzip /dev/stdin;;
30   (application/x-7z-compressed)    z7 e /dev/stdin;;
31   (application/zip)                unzip /dev/stdin;;
32 esac
33
34 nfiles=$(ls -1 | wc -l)
35 if [ $nfiles -eq 1 ]; then
36
37   set -x
38   setsid run-mailcap * &
39   PID=$!
40   ZSH_PREFILL_CMD="mv '$(echo -n *)' " x-terminal-emulator
41   perl -e "kill '-TERM', $PID"
42
43 else
44
45   ZSH_RUN_ON_LOAD="ls -l" x-terminal-emulator
46
47 fi