CVSROOT:        /cvs
Module name:    src
Changes by:     schwa...@cvs.openbsd.org        2025/05/08 18:50:29

Modified files:
        usr.bin/grep   : grep.c 

Log message:
POSIX requires in chapter 12.2, Utility Syntax Guideline 9:
"All options should precede operands on the command line."
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html#tag_1202
and grep(1) is explicitly required to conform right below OPTIONS:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/grep.html

Consequently, that our grep(1) treated operands starting with dashes
after other operands as options was a standard-violating bug.
Fix this bug as documented for "optstring" in the getopt_long(3) manual.

Issue reported by Petr Rockai <m dot v0adgys6 at fixp dot eu> on tech@.

OK miod@ tedu@ espie@ tb@
and tested in a bulk build by tb@ with no fallout.

Reply via email to