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

From: Noah Misch <noah(at)leadboat(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: add non-option reordering to in-tree getopt_long
Date: 2023-06-14 22:11:54
Message-ID: 20230614221154.GA1656253@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 14, 2023 at 02:28:16PM -0700, Nathan Bossart wrote:
> On Tue, Jun 13, 2023 at 05:17:37PM -0700, Noah Misch wrote:
> > If you have a test program to be run, I can run it on AIX.
>
> Thanks. The patch above [0] adjusts 040_createuser.pl to test modifying
> argv, so that's one test program. And here's a few lines for reversing
> argv:
>
> #include <stdio.h>
>
> int
> main(int argc, char *argv[])
> {
> for (int i = 0; i < argc / 2; i++)
> {
> char *tmp = argv[i];
>
> argv[i] = argv[argc - i - 1];
> argv[argc - i - 1] = tmp;
> }
>
> for (int i = 0; i < argc; i++)
> printf("%s ", argv[i]);
> printf("\n");
> }

Here's some output from this program (on AIX 7.1, same output when compiled
32-bit or 64-bit):

$ ./a.out a b c d e f
f e d c b a ./a.out

Interesting discussion here, too:
https://github.com/libuv/libuv/pull/1187

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message James Addison 2023-06-14 22:14:01 Re: Let's make PostgreSQL multi-threaded
Previous Message Nathan Bossart 2023-06-14 21:28:16 Re: add non-option reordering to in-tree getopt_long