Skip to content

Commit bd5ea42

Browse files
author
Michael Meskes
committed
*** empty log message ***
1 parent e80ade5 commit bd5ea42

File tree

4 files changed

+31
-51
lines changed

4 files changed

+31
-51
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,3 +749,9 @@ Wed Dec 15 08:10:52 CET 1999
749749
- Some cleanup in libecpg.
750750
- Set library version to 3.0.9.
751751
- Set ecpg version to 2.6.12.
752+
753+
Thu Dec 23 13:25:05 CET 1999
754+
755+
- Fixed command line parsing.
756+
- Set ecpg version to 2.6.13.
757+

src/interfaces/ecpg/TODO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ indicator-error?
2424

2525
Add a semantic check level, e.g. check if a table really exists.
2626

27-
How can on insert arrays from c variables?
27+
How can one insert arrays from c variables?
2828

2929
Missing statements:
3030
- exec sql ifdef

src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
55
MINOR_VERSION=6
6-
PATCHLEVEL=12
6+
PATCHLEVEL=13
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
99
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
#include "extern.h"
1313

1414
struct _include_path *include_paths;
15-
struct _defines *defines = NULL;
16-
int autocommit = 0;
17-
int ret_value = OK;
15+
int ret_value = OK, autocommit = 0;
1816
struct cursor *cur = NULL;
1917
struct typedefs *types = NULL;
2018

2119
static void
2220
usage(char *progname)
2321
{
2422
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
25-
fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname);
23+
fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] file1 [file2] ...\n", progname);
2624
}
2725

2826
static void
@@ -35,23 +33,12 @@ add_include_path(char *path)
3533
include_paths->next = ip;
3634
}
3735

38-
static void
39-
add_preprocessor_define(char *define)
40-
{
41-
struct _defines *pd = defines;
42-
43-
defines = mm_alloc(sizeof(struct _defines));
44-
defines->old = strdup(define);
45-
defines->new = strdup("");
46-
defines->pertinent = true;
47-
defines->next = pd;
48-
}
49-
5036
int
5137
main(int argc, char *const argv[])
5238
{
5339
int fnr,
5440
c,
41+
verbose = false,
5542
out_option = 0;
5643
struct _include_path *ip;
5744

@@ -60,7 +47,7 @@ main(int argc, char *const argv[])
6047
add_include_path("/usr/local/include");
6148
add_include_path(".");
6249

63-
while ((c = getopt(argc, argv, "vo:I:tD:")) != EOF)
50+
while ((c = getopt(argc, argv, "vo:I:t")) != EOF)
6451
{
6552
switch (c)
6653
{
@@ -82,21 +69,24 @@ main(int argc, char *const argv[])
8269
autocommit = 1;
8370
break;
8471
case 'v':
85-
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
86-
fprintf(stderr, "exec sql include ... search starts here:\n");
87-
for (ip = include_paths; ip != NULL; ip = ip->next)
88-
fprintf(stderr, " %s\n", ip->path);
89-
fprintf(stderr, "End of search list.\n");
90-
return OK;
91-
case 'D':
92-
add_preprocessor_define(optarg);
72+
verbose = true;
9373
break;
9474
default:
9575
usage(argv[0]);
9676
return ILLEGAL_OPTION;
9777
}
9878
}
9979

80+
if (verbose)
81+
{
82+
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
83+
fprintf(stderr, "exec sql include ... search starts here:\n");
84+
for (ip = include_paths; ip != NULL; ip = ip->next)
85+
fprintf(stderr, " %s\n", ip->path);
86+
fprintf(stderr, "End of search list.\n");
87+
return OK;
88+
}
89+
10090
if (optind >= argc) /* no files specified */
10191
{
10292
usage(argv[0]);
@@ -114,9 +104,7 @@ main(int argc, char *const argv[])
114104

115105
strcpy(input_filename, argv[fnr]);
116106

117-
/* take care of relative paths */
118-
ptr2ext = strrchr(input_filename, '/');
119-
ptr2ext = (ptr2ext ? strrchr(ptr2ext, '.') : strrchr(input_filename, '.'));
107+
ptr2ext = strrchr(input_filename, '.');
120108
/* no extension? */
121109
if (ptr2ext == NULL)
122110
{
@@ -189,29 +177,16 @@ main(int argc, char *const argv[])
189177
ptr = ptr->next;
190178
free(this);
191179
}
192-
cur = NULL;
193-
194-
/* remove non-pertinent old defines as well */
195-
while ( defines && !defines->pertinent ) {
196-
defptr = defines;
197-
defines = defines->next;
198-
199-
free(defptr->new);
200-
free(defptr->old);
201-
free(defptr);
202-
}
203180

204-
for (defptr = defines; defptr != NULL; defptr = defptr->next )
181+
/* remove old defines as well */
182+
for (defptr = defines; defptr != NULL;)
205183
{
206-
struct _defines *this = defptr->next;
207-
208-
if ( this && !this->pertinent ) {
209-
defptr->next = this->next;
184+
struct _defines *this = defptr;
210185

211-
free(this->new);
212-
free(this->old);
186+
free(defptr->new);
187+
free(defptr->old);
188+
defptr = defptr->next;
213189
free(this);
214-
}
215190
}
216191

217192
/* and old typedefs */
@@ -225,13 +200,12 @@ main(int argc, char *const argv[])
225200
typeptr = typeptr->next;
226201
free(this);
227202
}
228-
types = NULL;
229203

230204
/* initialize lex */
231205
lex_init();
232206

233207
/* we need two includes */
234-
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These two include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#line 1 \"%s\"\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL, input_filename);
208+
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n/* These two include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
235209

236210
/* and parse the source */
237211
yyparse();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy