#!/bin/sh

CURRENT_CHARSET="`locale charmap 2>/dev/null`"
CURRENT_TTY=`tty 2>/dev/null`
mkdir -p ~/.mc/$CURRENT_TTY
if [ -x /usr/bin/lynx ]; then
  unzip -p $1 content.xml | o3tohtml | sed -e 's/>/> /g' > ~/.mc/$CURRENT_TTY/oocache.html && lynx -force_html -assume_local_charset=UTF-8 -display_charset=$CURRENT_CHARSET ~/.mc/$CURRENT_TTY/oocache.html
else
  unzip -p $1 content.xml | o3totxt | recode utf8..$CURRENT_CHARSET | less
fi
