#!/bin/sh

tmpdir=`mktemp -td tracker.msword_filter.XXXXXXXXXX` || exit 1

tmpfile="$tmpdir"/tmpfile

cp "$1" "$tmpfile"

# Change the working directory to $tmpdir which we can safely delete later.
# Some distributions ship a version of wvText which extracts the image files
# from the word document and places them in the current working directory.

cd "$tmpdir"

nice -n19 wvText "$tmpfile" "$2"

rm -rf "$tmpdir"
