Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q9CdS-0005cO-9t for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2023 22:37:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9CdP-0007VC-6N for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2023 22:37:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q9CdO-0007V3-PX for pgsql-hackers@lists.postgresql.org; Tue, 13 Jun 2023 22:37:06 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q9CdJ-0022xc-1q for pgsql-hackers@postgresql.org; Tue, 13 Jun 2023 22:37:05 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b4fef08cfdso86065ad.1 for ; Tue, 13 Jun 2023 15:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686695820; x=1689287820; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Q6eTvAyEIcSnvqZ39PyRzUVxGvXW4cqqbZOzmkar5h0=; b=d85QTBrTvos7dutnLxadAWflubKe9bfOTb0Cw69nZYzQQGFnlv9w+ynLsjwG5TFl+M ep526qLSY5xWIRwQ57iGxcEyiSr1qWzetuYrMruem7F4Ks0uKx3sAH8N21nFD6dNcsGw NXfTXA8PkMxhM1QBgKzJgAQ7IDz7A0nhFhHv8EFGjXGndL7gjsUjzQQbQYkA70HNZyqH wXtbVfuWaxe3eEAdvu0ay5SuYfgQbZCCSIohZ6g6oGfPD0UNrdcDX2+TcIfgd4+cD9dU qlJLuQb4OUkWdHNoJh87yWzCHlMrxxHoptOzEnECRURgJEBf1qvud09RGuKWD53SMw2V Ki3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686695820; x=1689287820; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Q6eTvAyEIcSnvqZ39PyRzUVxGvXW4cqqbZOzmkar5h0=; b=SFR2d5Rwzyy06goUQtTzUnCLw9NRjWuO3O4EhEBm8Xkk76WrprT/WOYqmtvyY1VtuP 7P+HAX2DptOE6/Xxmw4LqNDw+65xTefx3Fhto3jolN+AOxs9ZjWA2hqJHdQQpgtXsnpt Cu/EBlIs/kHOBFeMKphCCChY4U0hImtZS7GpS6Apb6VgSowSbKCtI7TPaKoRjqDpZ+0U fxZ98ne9hT472FTtM+T91uByY15Fh1/wAMX91TFIvELI9uC1Niqwk3tixMTOQK4Nkpu2 /UuXWH6cOcRGK4892/Wi9oItkCtu457E1xmiNBJeulmozEOgtr51u4PsZQEo26nK4r0w I2Pw== X-Gm-Message-State: AC+VfDwIpqPKguN4mLgZ3/m6BTeXNhiHmaHWFpAbABRLzQIUiKDmN+VA bQQ95Pod6E1TH91SIANB4/c= X-Google-Smtp-Source: ACHHUZ4LK14hWaVtRceMQNZdlPZOF7TB7Pk1N+IUco0ZlKSi23+VGLTSTj9Y3QxKoO5oUkCDRt5QaQ== X-Received: by 2002:a17:902:f683:b0:1b4:5699:aab8 with SMTP id l3-20020a170902f68300b001b45699aab8mr1135668plg.29.1686695819805; Tue, 13 Jun 2023 15:36:59 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id u5-20020a170902e5c500b001b1a2663e9bsm10819129plf.77.2023.06.13.15.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 15:36:59 -0700 (PDT) Date: Tue, 13 Jun 2023 15:36:57 -0700 From: Nathan Bossart To: Kyotaro Horiguchi Cc: pgsql-hackers@postgresql.org Subject: Re: add non-option reordering to in-tree getopt_long Message-ID: <20230613223657.GC219055@nathanxps13> References: <20230609232257.GA121461@nathanxps13> <20230613.120001.2091320520660271559.horikyota.ntt@gmail.com> <20230613051343.GA211254@nathanxps13> <20230613.160201.833376179512503274.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230613.160201.833376179512503274.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 13, 2023 at 04:02:01PM +0900, Kyotaro Horiguchi wrote: > Hmm. from the initial mail, I got the impression that AIX and Windows > allow this, so I thought that we can do that for them. While there > could be other platforms that allow it, perhaps we don't need to go as > far as extending this until we come across another platform that does. 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. >> > As far as I can see, getopt_long on Rocky9 does *not* rearrange argv >> > until it reaches the end of the array. But it won't matter much. >> >> Do you mean that it rearranges argv once all the options have been >> returned, or that it doesn't rearrange argv at all? > > I meant the former. argv remains unaltered until getopt_long returns > -1. Once it does, non-optional arguments are being collected at the > end of argv. (But in my opinion, that behavior isn't very significant > in this context..) Got it. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com