At Mon, 10 Jul 2023 13:06:58 -0700, Nathan Bossart <nathandbossart@gmail.com> wrote in
> Here's a new version of the patch with the latest feedback addressed.
Thanks!
+ * An argument is a non-option if it meets any of the following
+ * criteria: it follows an argument that is equivalent to the string
+ * "--", it is equivalent to the string "-", or it does not start with
+ * '-'. When we encounter a non-option, we move it to the end of argv
+ * (after shifting all remaining arguments over to make room), and
+ * then we try again with the next argument.
+ */
+ if (force_nonopt || strcmp("-", place) == 0 || place[0] != '-')
...
+ else if (strcmp("--", place) == 0)
I like it. We don't need to overcomplicate things just for the sake of
speed here. Plus, this version looks the most simple to me. That being
said, it might be better if the last term is positioned in the second
place. This is mainly because a lone hyphen is less common than words
that starts with characters other than a pyphen.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center