]> git.madduck.net Git - etc/mutt.git/blob - .config/mutt/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:

Do not set attach_save_dir but default to PWD
[etc/mutt.git] / .config / mutt / 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/zip)                unzip /dev/stdin;;
31 esac
32
33 nfiles=$(ls -1 | wc -l)
34 if [ $nfiles -eq 1 ]; then
35
36   set -x
37   setsid run-mailcap * &
38   PID=$!
39   ZSH_PREFILL_CMD="mv '$(echo -n *)' " x-terminal-emulator
40   perl -e "kill '-TERM', $PID"
41
42 else
43
44   ZSH_RUN_ON_LOAD="ls -l" x-terminal-emulator
45
46 fi