[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cvs-buildpackage with fakeroot



joost witteveen <joostje@cistron.nl> writes:

   The problem is that getopt doesn't seem to have an option to cause it
   to do what our `taste' wants it. 
   Does anyone have a simple way to make getopt act the way we want it?

Pass `+' as the first character of the optstring argument to getopt().
(I'm assuming that this is a C or C++ program.)

>From getopt.c:

   If OPTSTRING starts with `-' or `+', it requests different methods
   of handling the non-option ARGV-elements.  See the comments about
   RETURN_IN_ORDER and REQUIRE_ORDER, above.

...

  else if (optstring[0] == '+')
    {
      ordering = REQUIRE_ORDER;
      ++optstring;
    }

...

/* Describe how to deal with options that follow non-option
   ARGV-elements.

   If the caller did not specify anything, the default is
   REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is
   defined, PERMUTE otherwise.

   REQUIRE_ORDER means don't recognize them as options; stop option
   processing when the first non-option is seen.  This is what Unix
   does.  This mode of operation is selected by either setting the
   environment variable POSIXLY_CORRECT, or using `+' as the first
   character of the list of option characters.


Reply to: