#!/bin/sh

apptty 2> /dev/null

if [ "x$1" = "x--" ]; then
  shift
  exec env LC_MESSAGES=$(locale -a | grep '^fr_FR' | head -n 1) mutt ${@+"$@"}
  exit
fi

screenrc="$HOME/.screenrc"
muttscrc="$screenrc-mutt"
cp "$screenrc" "$muttscrc"
cat >> "$muttscrc" <<EOF

# Special screen configuration for Mutt
setenv LC_CTYPE C.UTF-8
defutf8 on
hardstatus string "Mutt (%n) - %H"
EOF

case $TERM in
  screen*)
    exec screen -t mutt "$0" -- ${@+"$@"} ;;
  *)
    exec escreen -c "$muttscrc" -T screen-256color-bce-s -dRR \
      mutt -t mutt "$0" -- ${@+"$@"} ;;
esac

# $Id: smutt 139609 2021-07-25 18:17:37Z vinc17/zira $