title: what's the portable way to reset getopt()?
body: <p>i'm aiming the <code>getopt()</code> machinery at my own argv-like array, after having used it on the real argv. the interface is non-reentrant (holds state), and various implementations are reset in different ways.</p>
  
  <ul>
  <li>in XPG3/SVID it's <code>optreset = 1;</code> (freebsd, macosx)</li>
  <li>in XPG4/POSIX/SUS it's <code>optind = 1;</code> (suse tumbleweed)</li>
  <li>in Linux/GLIBC it's also <code>optind = 0;</code> (debian)</li>
  </ul>
  
  <p>i don't want to autoconf just for this.</p>
  
  <p>what's a reliable set of <code>#ifdef</code>'s?</p>