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

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: michael@paquier.xyz
Cc: nathandbossart@gmail.com, noah@leadboat.com, pgsql-hackers@postgresql.org
Date: 2023-07-13T08:25:48Z
Lists: pgsql-hackers
At Thu, 13 Jul 2023 14:39:32 +0900, Michael Paquier <michael@paquier.xyz> wrote in 
> [04:56:07.404] pg_ctl: too many command-line arguments (first is "-D")

Mmm. It checks, for example, for "pg_ctl initdb -D $tempdir/data -o
-N".  This version of getopt_long() returns -1 as soon as it meets the
first non-option "initdb". This is somewhat different from the last
time what I saw the patch and looks strange at a glance..

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Commits

  1. Simplify option handling in pg_ctl.

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