fix Issue 9829

- getting program and arguments before calling getopt
  on the shortended args avoids the need for the '--'
  getopt separator in the first place