Re: add non-option reordering to in-tree getopt_long

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-06-13T23:52:27Z
Lists: pgsql-hackers
On Tue, Jun 13, 2023 at 03:36:57PM -0700, Nathan Bossart wrote:
> Windows seems to allow rearranging argv, based upon cfbot's results.  I do
> not know about AIX.  In any case, C99 explicitly mentions that argv should
> be modifiable.

Few people have AIX machines around these days, but looking around it
seems like the answer to this question would be no:
https://github.com/nodejs/node/pull/10633

Noah, do you have an idea?

> Got it.

Making the internal implementation of getopt_long more flexible would
be really nice in the long-term.  This is something that people have
stepped on for many years, like ffd3980.

(TBH, I think that there is little value in spending resources on AIX
these days.  For one, few have an access to it, and getopt is not the
only tweak in the tree related to it.  On top of that, C99 is required
since v12.)
--
Michael

Commits

  1. Simplify option handling in pg_ctl.

  2. Teach in-tree getopt_long() to move non-options to the end of argv.