#!/bin/sh

sleep 1

size=$(stty size)
set -- $size
h=$(expr $1 - 12)
shift
w=$(expr $@ - 4)

# edit this to point to where you store your IF zcode story files (*.z5 etc)
export ZCODE_PATH=/mnt/us/if/zcode
# edit this to point to the dialog rc file
export DIALOGRC=/mnt/us/bin/.dialogrc

FILE=$(dialog --stdout --title "Select Interactive Fiction File:" --fselect $ZCODE_PATH/ $h $w )

clear

if [ "$FILE" != "" ]; then
frotz -d "$FILE"
fi
