copy of https://gitorious.org/trollop/mainline/raw/43d5a92971f41079c77f4b0b13bcc8d25dcba197:lib/trollop.rb