getopt.js: follow 'man 3 getopt'; rename 'optnext' to 'optind'.

- Remove the var previously known as 'optind'. It's not part of the real
  'getopt' api, and its functionality can be easily implemented in user
  code.
expand-js-template.js: Update to match new 'optind' semantics.
getopt.js: add the ability to use abbreviations.
getopt.js: fix non-unique prefixes in 'addAbbrev'.

Basically, the earlier options were getting all the prefixes, even
those that weren't really unique, considering the full set of options
available.
getopt.js: add comments to 'addAbbrev'.
getopt.js: make min unique prefix length 4.

The min unique prefix should be common prefix + 1, so 'pre' should have
been 3, not 4.
getopt.js: make sure option prefixes map to the full names.