Fix our getopt_long's behavior for a command line argument of just "-".
src/port/getopt_long.c failed on such an argument, always seeing it as an unrecognized switch. This is unhelpful; better is to treat such an item as a non-switch argument. That behavior is what we find in GNU's getopt_long(); it's what src/port/getopt.c does; and it is required by POSIX for getopt(), which getopt_long() ought to be generally a superset of. Moreover, it's expected by ecpg, which intends an argument of "-" to mean "read from stdin". So fix it. Also add some documentation about ecpg's behavior in this area, since that was miserably underdocumented. I had to reverse-engineer it from the code. Per bug #16304 from James Gray. Back-patch to all supported branches, since this has been broken forever. Discussion: https://postgr.es/m/[email protected] Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c0eb57dd989b7f4c2faf486a39c83dd8a4ae4189 Modified Files -------------- doc/src/sgml/ref/ecpg-ref.sgml | 31 ++++++++++++++++++++++++++----- src/port/getopt_long.c | 14 +++++++++++--- 2 files changed, 37 insertions(+), 8 deletions(-)
