Portable environments files and scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
975B

  1. #!/bin/sh
  2. # mblaze.env
  3. # Written in 2020 by Lucas
  4. # CC0 1.0 Universal/Public domain - No rights reserved
  5. #
  6. # To the extent possible under law, the author(s) have dedicated all
  7. # copyright and related and neighboring rights to this software to the
  8. # public domain worldwide. This software is distributed without any
  9. # warranty. You should have received a copy of the CC0 Public Domain
  10. # Dedication along with this software. If not, see
  11. # <http://creativecommons.org/publicdomain/zero/1.0/>.
  12. keyhandler()
  13. {
  14. case "$1" in
  15. 0|1)
  16. exit $1
  17. ;;
  18. 70) # F flag
  19. mflag -F .
  20. mseq -f : | mseq -S
  21. mseq -C +
  22. ;;
  23. 82) # R mark read
  24. mflag -S .
  25. mseq -f : | mseq -S
  26. mseq -C +
  27. ;;
  28. 94) # ^ goto parent
  29. mseq -C '.^' 2>/dev/null
  30. ;;
  31. 123) # { prev thread
  32. prev=$(mseq .-1 | sed 's/^ *//')
  33. prev_root=$(mseq -c "$prev" = | head -n 1 | sed 's/^ *//')
  34. mseq -C "$prev_root" 2>/dev/null
  35. ;;
  36. 125) # } next thread
  37. mseq -C "$(mseq .+1: | sed -n '/^[^ <]/{p;q;}')"
  38. ;;
  39. esac
  40. }