#!/bin/sh

BASEDIR=".."
LIB="$BASEDIR/tmp/usr/lib"
BIN="$BASEDIR/tmp/usr/bin"

case "$1" in
  "--help")
    LD_LIBRARY_PATH="$LIB" $BIN/swfmill 2>&1 | tee help.log | \
      grep --extended-regexp --regexp="^<command>|^$|^ |^<option>" | \
      grep -v "XML-based SWF" | awk '(p<2){if(NF==0){p++;next;}}{print}'
    ;;
   "--version")
    LD_LIBRARY_PATH="$LIB" $BIN/swfmill 2>&1 | tee version.log| \
      grep --extended-regexp --regexp="^swfmill " | \
      head -n 1 | awk '{ print $2 }'
    ;;
esac
exit 0
