#!/bin/sh
# Wrapper for Midnight Commander on the N900: redraw after the terminal has settled, then run the real binary (mc.bin).
me=$$
( for d in 1 2; do sleep $d; kill -0 $me 2>/dev/null && kill -WINCH $me 2>/dev/null; done ) </dev/null >/dev/null 2>&1 &
case "${0##*/}" in
    mcedit) exec /opt/mc/bin/mc.bin -e "$@" ;;
    mcview) exec /opt/mc/bin/mc.bin -v "$@" ;;
    mcdiff) exec /opt/mc/bin/mc.bin -d "$@" ;;
    *)      exec /opt/mc/bin/mc.bin "$@" ;;
esac
