35 printf(
_(
"%s is the PostgreSQL embedded SQL preprocessor for C programs.\n\n"),
38 " %s [OPTION]... FILE...\n\n"),
41 printf(
_(
" -c automatically generate C code from embedded SQL code;\n" 42 " this affects EXEC SQL TYPE\n"));
43 printf(
_(
" -C MODE set compatibility mode; MODE can be one of\n" 44 " \"INFORMIX\", \"INFORMIX_SE\", \"ORACLE\"\n"));
46 printf(
_(
" -d generate parser debug output\n"));
48 printf(
_(
" -D SYMBOL define SYMBOL\n"));
49 printf(
_(
" -h parse a header file, this option includes option \"-c\"\n"));
50 printf(
_(
" -i parse system include files as well\n"));
51 printf(
_(
" -I DIRECTORY search DIRECTORY for include files\n"));
52 printf(
_(
" -o OUTFILE write result to OUTFILE\n"));
53 printf(
_(
" -r OPTION specify run-time behavior; OPTION can be:\n" 54 " \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
55 printf(
_(
" --regression run in regression testing mode\n"));
56 printf(
_(
" -t turn on autocommit of transactions\n"));
57 printf(
_(
" -V, --version output version information, then exit\n"));
58 printf(
_(
" -?, --help show this help, then exit\n"));
59 printf(
_(
"\nIf no output file is specified, the name is formed by adding .c to the\n" 60 "input file name, after stripping off .pgc if present.\n"));
61 printf(
_(
"\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
62 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
79 for (; ip->
next != NULL; ip = ip->
next);
94 ptr = strchr(define_copy,
'=');
100 for (tmp = ptr - 1; *tmp ==
' '; tmp--);
102 defines->
olddef = define_copy;
103 defines->
newdef = ptr + 1;
107 defines->
olddef = define_copy;
111 defines->
used = NULL;
115 #define ECPG_GETOPT_LONG_REGRESSION 1 117 main(
int argc,
char *
const argv[])
119 static struct option ecpg_options[] = {
140 fprintf(stderr,
_(
"%s: could not locate my own executable path\n"), argv[0]);
146 if (strcmp(argv[1],
"--help") == 0 || strcmp(argv[1],
"-?") == 0)
151 if (strcmp(argv[1],
"--version") == 0 || strcmp(argv[1],
"-V") == 0)
153 printf(
"ecpg (PostgreSQL) %s\n", PG_VERSION);
159 while ((c =
getopt_long(argc, argv,
"vcio:I:tD:dC:r:h", ecpg_options, NULL)) != -1)
175 fprintf(stderr,
_(
"%s: could not open file \"%s\": %s\n"),
218 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
231 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
242 fprintf(stderr,
_(
"%s: parser debug support (-d) not available\n"),
247 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
261 _(
"%s, the PostgreSQL embedded C preprocessor, version %s\n"),
262 progname, PG_VERSION);
263 fprintf(stderr,
_(
"EXEC SQL INCLUDE ... search starts here:\n"));
264 for (ip = include_paths; ip != NULL; ip = ip->
next)
266 fprintf(stderr,
_(
"end of search list\n"));
272 fprintf(stderr,
_(
"%s: no input files specified\n"), progname);
273 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
279 for (fnr =
optind; fnr < argc; fnr++)
284 if (strcmp(argv[fnr],
"-") == 0)
297 ptr2ext = (ptr2ext ? strrchr(ptr2ext,
'.') : strrchr(
input_filename,
'.'));
308 ptr2ext[3] = (header_mode ==
true) ?
'h' :
'c';
326 ptr2ext[1] = (header_mode ==
true) ?
'h' :
'c';
332 fprintf(stderr,
_(
"%s: could not open file \"%s\": %s\n"),
343 fprintf(stderr,
_(
"%s: could not open file \"%s\": %s\n"),
344 progname, argv[fnr],
strerror(errno));
352 for (ptr = cur; ptr != NULL;)
354 struct cursor *
this = ptr;
380 defines = defines->
next;
387 for (defptr = defines; defptr != NULL; defptr = defptr->
next)
402 for (typeptr = types; typeptr != NULL;)
409 typeptr = typeptr->
next;
415 memset(&when_error, 0,
sizeof(
struct when));
416 memset(&when_nf, 0,
sizeof(
struct when));
441 if (header_mode ==
false)
443 fprintf(
base_yyout,
"/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
447 fprintf(
base_yyout,
"/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
464 for (ptr = cur; ptr != NULL; ptr = ptr->
next)
#define ECPG_GETOPT_LONG_REGRESSION
int base_yyparse(core_yyscan_t yyscanner)
struct ECPGstruct_member * struct_member_list[STRUCT_DEPTH]
const char * get_progname(const char *argv0)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
static void help(const char *progname)
void output_line_number(void)
struct _include_path * include_paths
int pg_strcasecmp(const char *s1, const char *s2)
static void add_include_path(char *path)
char * mm_strdup(const char *)
static void add_preprocessor_define(char *define)
void get_pkginclude_path(const char *my_exec_path, char *ret_path)
struct arguments * argsinsert
int find_my_exec(const char *argv0, char *retpath)
void ECPGfree_struct_member(struct ECPGstruct_member *rm)
char my_exec_path[MAXPGPATH]
#define PG_TEXTDOMAIN(domain)
int main(int argc, char *const argv[])
char * last_dir_separator(const char *filename)
struct arguments * argsresult
void mmerror(int errorcode, enum errortype type, const char *error,...) pg_attribute_printf(3
struct _defines * defines
void get_include_path(const char *my_exec_path, char *ret_path)
void set_pglocale_pgservice(const char *argv0, const char *app)
struct ECPGstruct_member * struct_member_list
struct _include_path * next
struct when when_error when_nf when_warn