graudeejs/zfSnap — pull request #24 by Alexqw (2014-02-17 15:11:53+00:00)
Title: Use getopts to parse script options

This patch set uses the more standard getopts functionality to parse scripting options and makes a few fixes to behavior. The main advantages (over current functionality) of this patch set are:

1) option argument requirements are enforced
2) unknown options exit, rather than being ignored and continued (which was dangerous IMO)
3) more concise
4) more standard
5) comes with (a few) tests

I was concerned about the portability of getopts, but apparently that was unfounded. It is POSIX compliant and support extends all the way back to SVR4.

Please note that getopts only supports short options. This means that I did not port zpool28fix. However, issue #17 is about removing that option and just detecting the situation. If this patch set is merged, that issue should be resolved before the next release is tagged. I have looked at Issue #17, but I am unsure if the bad behavior is specific to all v28 pools, just some v28 pools on FreeBSD, all v28 pools on all OSs, or some other combination thereof. I also do not have access to a FreeBSD box to test.

---Alex