add a function to show appointments, callable from .profile
[shellsnippets/shellsnippets.git] / mksh / profile-funcs
1 # XHTML validator
2 xv() {
3         local i rv=0 s
4
5         for i in "$@"; do
6                 s=$(sed \
7                     -e 's!http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd!file:///usr/src/www/mk/xhtml11.dtd!g' \
8                     <"$i" | xmlstarlet val -e -d file:///usr/src/www/mk/xhtml11.dtd -)
9                 (( rv |= $? ))
10                 print -r -- "$i ${s#- }"
11         done
12         return $rv
13 }
14
15 # show appointments
16 function showtermine {
17         [[ -s ~/.etc/Termine ]] || return 0
18         calendar -f ~/.etc/Termine | while IFS='        ' read a b; do
19                 typeset -L8 a
20                 b=$(fold -sw 70 <<<"$b")
21                 print -r -- "‣ $a${b//$'\n'/$'\n\t  '}"
22         done
23 }