summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/ecpg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-12-11 18:04:28 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-12-11 18:04:28 -0500
commit15b3722700ca043494804dfd1fe7556c50d4f9e9 (patch)
tree9e9535882d47c4a2255e4f09990183286c86d813 /src/interfaces/ecpg/preproc/ecpg.c
parent4262c5b1eecc63f12f86daa293428009eee54b5c (diff)
Use "%option prefix" to set API names in ecpg's lexer.
Back-patch commit 92fb64983 into the pre-9.6 branches. Without this, ecpg fails to build with the latest version of flex. It's not unreasonable that people would want to compile our old branches with recent tools. Per report from Дилян Палаузов. Discussion: https://postgr.es/m/d845c1af-e18d-6651-178f-9f08cdf37e10@aegee.org
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.c')
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index ed01ef7f01e..d8647b3c9d0 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -166,11 +166,11 @@ main(int argc, char *const argv[])
case 'o':
output_filename = mm_strdup(optarg);
if (strcmp(output_filename, "-") == 0)
- yyout = stdout;
+ base_yyout = stdout;
else
- yyout = fopen(output_filename, PG_BINARY_W);
+ base_yyout = fopen(output_filename, PG_BINARY_W);
- if (yyout == NULL)
+ if (base_yyout == NULL)
{
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, output_filename, strerror(errno));
@@ -233,7 +233,7 @@ main(int argc, char *const argv[])
break;
case 'd':
#ifdef YYDEBUG
- yydebug = 1;
+ base_yydebug = 1;
#else
fprintf(stderr, _("%s: parser debug support (-d) not available\n"),
progname);
@@ -280,7 +280,7 @@ main(int argc, char *const argv[])
{
input_filename = mm_alloc(strlen("stdin") + 1);
strcpy(input_filename, "stdin");
- yyin = stdin;
+ base_yyin = stdin;
}
else
{
@@ -304,13 +304,13 @@ main(int argc, char *const argv[])
ptr2ext[4] = '\0';
}
- yyin = fopen(input_filename, PG_BINARY_R);
+ base_yyin = fopen(input_filename, PG_BINARY_R);
}
if (out_option == 0) /* calculate the output name */
{
if (strcmp(input_filename, "stdin") == 0)
- yyout = stdout;
+ base_yyout = stdout;
else
{
output_filename = mm_strdup(input_filename);
@@ -320,8 +320,8 @@ main(int argc, char *const argv[])
ptr2ext[1] = (header_mode == true) ? 'h' : 'c';
ptr2ext[2] = '\0';
- yyout = fopen(output_filename, PG_BINARY_W);
- if (yyout == NULL)
+ base_yyout = fopen(output_filename, PG_BINARY_W);
+ if (base_yyout == NULL)
{
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, output_filename, strerror(errno));
@@ -332,7 +332,7 @@ main(int argc, char *const argv[])
}
}
- if (yyin == NULL)
+ if (base_yyin == NULL)
fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
progname, argv[fnr], strerror(errno));
else
@@ -427,23 +427,23 @@ main(int argc, char *const argv[])
/* we need several includes */
/* but not if we are in header mode */
if (regression_mode)
- fprintf(yyout, "/* Processed by ecpg (regression mode) */\n");
+ fprintf(base_yyout, "/* Processed by ecpg (regression mode) */\n");
else
- fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
+ fprintf(base_yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
if (header_mode == false)
{
- fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
+ fprintf(base_yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
/* add some compatibility headers */
if (INFORMIX_MODE)
- fprintf(yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
+ fprintf(base_yyout, "/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
- fprintf(yyout, "/* End of automatic include section */\n");
+ fprintf(base_yyout, "/* End of automatic include section */\n");
}
if (regression_mode)
- fprintf(yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n");
+ fprintf(base_yyout, "#define ECPGdebug(X,Y) ECPGdebug((X)+100,(Y))\n");
output_line_number();
@@ -458,10 +458,10 @@ main(int argc, char *const argv[])
if (!(ptr->opened))
mmerror(PARSE_ERROR, ET_WARNING, "cursor \"%s\" has been declared but not opened", ptr->name);
- if (yyin != NULL && yyin != stdin)
- fclose(yyin);
- if (out_option == 0 && yyout != stdout)
- fclose(yyout);
+ if (base_yyin != NULL && base_yyin != stdin)
+ fclose(base_yyin);
+ if (out_option == 0 && base_yyout != stdout)
+ fclose(base_yyout);
/*
* If there was an error, delete the output file.