36 printf(
_(
"%s is the PostgreSQL embedded SQL preprocessor for C programs.\n\n"),
39 " %s [OPTION]... FILE...\n\n"),
42 printf(
_(
" -c automatically generate C code from embedded SQL code;\n"
43 " this affects EXEC SQL TYPE\n"));
44 printf(
_(
" -C MODE set compatibility mode; MODE can be one of\n"
45 " \"INFORMIX\", \"INFORMIX_SE\", \"ORACLE\"\n"));
47 printf(
_(
" -d generate parser debug output\n"));
49 printf(
_(
" -D SYMBOL define SYMBOL\n"));
50 printf(
_(
" -h parse a header file, this option includes option \"-c\"\n"));
51 printf(
_(
" -i parse system include files as well\n"));
52 printf(
_(
" -I DIRECTORY search DIRECTORY for include files\n"));
53 printf(
_(
" -o OUTFILE write result to OUTFILE\n"));
54 printf(
_(
" -r OPTION specify run-time behavior; OPTION can be:\n"
55 " \"no_indicator\", \"prepare\", \"questionmarks\"\n"));
56 printf(
_(
" --regression run in regression testing mode\n"));
57 printf(
_(
" -t turn on autocommit of transactions\n"));
58 printf(
_(
" -V, --version output version information, then exit\n"));
59 printf(
_(
" -?, --help show this help, then exit\n"));
60 printf(
_(
"\nIf no output file is specified, the name is formed by adding .c to the\n"
61 "input file name, after stripping off .pgc if present.\n"));
62 printf(
_(
"\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
63 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
80 for (; ip->
next != NULL; ip = ip->
next);
99 ptr = strchr(define_copy,
'=');
106 for (tmp = ptr - 1; tmp >= define_copy && *tmp ==
' '; tmp--);
120 newdef->
name = define_copy;
127 #define ECPG_GETOPT_LONG_REGRESSION 1
129 main(
int argc,
char *
const argv[])
131 static struct option ecpg_options[] = {
152 fprintf(stderr,
_(
"%s: could not locate my own executable path\n"), argv[0]);
158 if (strcmp(argv[1],
"--help") == 0 || strcmp(argv[1],
"-?") == 0)
163 if (strcmp(argv[1],
"--version") == 0 || strcmp(argv[1],
"-V") == 0)
165 printf(
"ecpg (PostgreSQL) %s\n", PG_VERSION);
171 while ((
c =
getopt_long(argc, argv,
"cC:dD:hiI:o:r:tv", ecpg_options, NULL)) != -1)
195 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
203 fprintf(stderr,
_(
"%s: parser debug support (-d) not available\n"),
230 fprintf(stderr,
_(
"%s: could not open file \"%s\": %m\n"),
246 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
260 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
274 _(
"%s, the PostgreSQL embedded C preprocessor, version %s\n"),
276 fprintf(stderr,
_(
"EXEC SQL INCLUDE ... search starts here:\n"));
279 fprintf(stderr,
_(
"end of search list\n"));
286 fprintf(stderr,
_(
"Try \"%s --help\" for more information.\n"), argv[0]);
292 for (fnr =
optind; fnr < argc; fnr++)
297 if (strcmp(argv[fnr],
"-") == 0)
310 ptr2ext = (ptr2ext ? strrchr(ptr2ext,
'.') : strrchr(
input_filename,
'.'));
321 ptr2ext[3] = (header_mode ==
true) ?
'h' :
'c';
339 ptr2ext[1] = (header_mode ==
true) ?
'h' :
'c';
345 fprintf(stderr,
_(
"%s: could not open file \"%s\": %m\n"),
356 fprintf(stderr,
_(
"%s: could not open file \"%s\": %m\n"),
368 for (ptr =
cur; ptr != NULL;)
370 struct cursor *
this = ptr;
403 for (defptr =
defines; defptr != NULL; defptr = nextdefptr)
405 nextdefptr = defptr->
next;
416 if (prevdefptr != NULL)
417 prevdefptr->
next = nextdefptr;
427 for (typeptr =
types; typeptr != NULL;)
434 typeptr = typeptr->
next;
440 memset(&when_error, 0,
sizeof(
struct when));
441 memset(&when_nf, 0,
sizeof(
struct when));
466 if (header_mode ==
false)
468 fprintf(
base_yyout,
"/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
472 fprintf(
base_yyout,
"/* Needed for informix compatibility */\n#include <ecpg_informix.h>\n");
489 for (ptr =
cur; ptr != NULL; ptr = ptr->
next)
#define PG_TEXTDOMAIN(domain)
int find_my_exec(const char *argv0, char *retpath)
void set_pglocale_pgservice(const char *argv0, const char *app)
struct _include_path * include_paths
static void help(const char *progname)
static void add_include_path(char *path)
struct _defines * defines
static void add_preprocessor_define(char *define)
#define ECPG_GETOPT_LONG_REGRESSION
struct declared_list * g_declared_list
int main(int argc, char *const argv[])
@ ECPG_COMPAT_INFORMIX_SE
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
char my_exec_path[MAXPGPATH]
int base_yyparse(core_yyscan_t yyscanner)
void output_line_number(void)
struct when when_error when_nf when_warn
PGDLLIMPORT char * optarg
char * last_dir_separator(const char *filename)
void get_include_path(const char *my_exec_path, char *ret_path)
int pg_strcasecmp(const char *s1, const char *s2)
const char * get_progname(const char *argv0)
void get_pkginclude_path(const char *my_exec_path, char *ret_path)
void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3
char * mm_strdup(const char *string)
struct ECPGstruct_member * struct_member_list[STRUCT_DEPTH]
void * mm_alloc(size_t size)
struct _include_path * next
struct arguments * argsinsert
struct arguments * argsresult
struct ECPGstruct_member * struct_member_list
void ECPGfree_struct_member(struct ECPGstruct_member *rm)