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

new ack rcpt (ti.kr.)
[etc/mutt.git] / .mutt / tnef-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" tnef.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 tnef -v
27
28 nfiles=$(ls -1 | wc -l)
29 if [ $nfiles -eq 1 ]; then
30
31   set -x
32   setsid run-mailcap * &
33   PID=$!
34   ZSH_PREFILL_CMD="mv '$(echo -n *)' " x-terminal-emulator
35   perl -e "kill '-TERM', $PID"
36
37 else
38
39   ZSH_RUN_ON_LOAD="ls -l" x-terminal-emulator
40
41 fi