title: How to allow non-option arguments in any order to getopt?
body: <p>I have a C program which expects to be called with several options and 1 non-option argument (i.e. with no associated option letter), and uses getopt to parse these options.  For example, it could be called with:</p>
  
  <p>Example1:
      <code>myProgram -a "aParam" -b "bParam" "xParam"</code></p>
  
  <p>I have been using SLES10, and the options worked in any order.  For example, the non-option argument, "xParam" could come first:</p>
  
  <p>Example2:
      <code>myProgram "xParam" -a "aParam" -b "bParam"</code></p>
  
  <p>However, when testing in SLES11, it seems that getopt stops processing as soon as it reaches a non-option parameter, so example 2 above does not work. </p>
  
  <p>I've read the getopt man pages and seen that this may be relevant:</p>
  
  <blockquote>
    <p>If the first character of optstring is '+' or the environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a nonoption argument is encountered.</p>
  </blockquote>
  
  <p>I'm not sure if SLES11 sets POSIXLY_CORRECT by default.
  What is the best way to get the old SLES10 getopt behaviour in SLES11?</p>