X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/fa194d6d12bd0d4d2196508cbb0e5bfddb6efe37..3cdc1087054ab41df63c54f0f9da6a646fca0847:/docs/contrib/ml?ds=inline diff --git a/docs/contrib/ml b/docs/contrib/ml index f5796c4e..042cc1c8 100755 --- a/docs/contrib/ml +++ b/docs/contrib/ml @@ -1,4 +1,5 @@ #!/bin/bash +# see several paragraphs below for more on the choice of shell interpreter. # ml is a mail reading interface for mh(1). the design is that of # a thin wrapper (this script) which uses 'less' for message @@ -25,6 +26,13 @@ # this script uses the sequences 'ml', 'mldel', 'mlspam', 'mlunr', # 'mlkeep', and 'mlrepl'. it also manipulates the user's Unseen-sequence. # +# the shell dialect used is very conservative. dash (debian's +# /bin/sh), bash, ksh, and solaris /bin/sh will all work, and probably +# the current bsd /bin/sh variants as well, with very slightly +# improved function in bash or ksh. the only non-posix shell feature +# used is an argument to "read". search for the function ask_init() +# for more detail. +# # paul fox, pgf@foxharp.boston.ma.us, february 2012 # ------------ @@ -117,7 +125,7 @@ do_viewhtml() > /tmp/ml-mhshow-html$$ MHSHOW=/tmp/ml-mhshow-html$$ \ - MM_CHARSET=us-ascii \ + LC_ALL=C \ mhshow -type text/html "$@" rm -f /tmp/ml-mhshow-html$$ @@ -229,18 +237,26 @@ normal_quit() exit } +ask_init() +{ + # if "read -n 1" gives an error message, it's unsupported, + # so don't use it -- the user will need to hit . + # this test works on dash, bash, ksh, and a recent solaris + # /bin/sh, but fails on zsh. + no_immed=$(read -n 1 < /dev/null 2>&1) +} + ask() { immed=; if [ "$1" = -i ] then - immed="-n 1" + test "$no_immed" || immed="-n 1" shift fi echo -n "${1}? [N/y] " read $immed a - #read a case $a in [Yy]*) return 0 ;; *) return 1 ;; @@ -694,6 +710,8 @@ mark -zero -sequence mlkeep ml # save a copy of the unseen sequence, for restore if 'X' is used to quit. mark -zero -sequence saveunseen $ml_unseen_seq +ask_init + char_init color_init