From 980a70b9763e330dab6d0eb994c96a007876e40e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Mar 2020 11:58:00 -0400 Subject: 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/16304-c662b00a1322db7f@postgresql.org --- doc/src/sgml/ref/ecpg-ref.sgml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/ecpg-ref.sgml b/doc/src/sgml/ref/ecpg-ref.sgml index df3c1054f0f..f3b6034f42a 100644 --- a/doc/src/sgml/ref/ecpg-ref.sgml +++ b/doc/src/sgml/ref/ecpg-ref.sgml @@ -41,14 +41,21 @@ PostgreSQL documentation ecpg will convert each input file given on the - command line to the corresponding C output file. Input files - preferably have the extension .pgc. - The extension will be replaced by .c to - determine the output file name. - The output file name can also be overridden using the + command line to the corresponding C output file. If an input file + name does not have any extension, .pgc is + assumed. The file's extension will be replaced + by .c to construct the output file name. + But the output file name can be overridden using the option. + + If an input file name is just -, + ecpg reads the program from standard input + (and writes to standard output, unless that is overridden + with ). + + This reference page does not describe the embedded SQL language. See for more information on that topic. @@ -94,6 +101,19 @@ PostgreSQL documentation + + + + + Process header files. When this option is specified, the output file + extension becomes .h not .c, + and the default input file extension is .pgh + not .pgc. Also, the option is + forced on. + + + + @@ -125,6 +145,7 @@ PostgreSQL documentation Specifies that ecpg should write all its output to the given filename. + Write -o - to send all output to standard output. -- cgit v1.2.3