Hack for BSD from fnj to fix no long option support in bsd getopt

Adapted by me to only apply to bsd and to fall back to short options only if required, original patch in comment at http://simotek.net/tech/hiset-multiple-history-files-and-sessions-for-bash-and-other-tinkering/