Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / miscellany / mtrenv / bin / wsh
1 : run this script through /bin/sh
2
3 M="`basename $0`"
4
5 case "$mhaltmsg" in
6     "")     ;;
7
8     *)      editalt="$mhaltmsg" ; export editalt ;;
9 esac
10
11 case "$mheditor" in
12     "")     ;;
13
14     *)      trap "" 1 2 3 15
15             if $mheditor $mhdraft
16             then
17                 trap 1 2 3 15
18             else
19                 case "$mhuse" in
20                     0)     echo $M: removing $mhdraft 1>&2; rm -f $mhdraft ;;
21                 esac
22                 exit 1
23             fi ;;
24 esac
25
26 PS1="`rprompt %U\("$M:"\`expr $mhdraft : '.*/\(.*/.*\)'\`\)%U%b`"
27
28 while :
29 do
30     echo -n "$PS1"; read C
31     case "$?$C" in 1) C="quit" ; esac
32     set x $C ; shift
33     case "$1" in
34         quit)     case "$2" in
35                       -d*|d*)     rm $mhdraft ;;
36                       "")         echo $M: draft left on $mhdraft 1>&2 ;;
37                   esac
38                   exit 1 ;;
39
40         push|send|refile)
41                   if eval "$@"; then exit 0; fi ;;
42
43         *)        eval "$@" ;;
44     esac
45 done