Add getopt and getopt_long (libc) support

This pull request also includes test code (from the functions' man pages).