Definition at line 23 of file pg_isready.c.
31 const char *pguser = NULL;
32 const char *pgdbname = NULL;
35 const char *pghost_str = NULL;
36 const char *pghostaddr_str = NULL;
37 const char *pgport_str = NULL;
39 #define PARAMS_ARRAY_SIZE 7
58 static struct option long_options[] = {
73 while ((
c =
getopt_long(argc, argv,
"d:h:p:qt:U:", long_options, NULL)) != -1)
109 pg_log_error(
"too many command-line arguments (first is \"%s\")",
120 keywords[0] =
"host";
122 keywords[1] =
"port";
124 keywords[2] =
"user";
126 keywords[3] =
"dbname";
128 keywords[4] =
"connect_timeout";
129 values[4] = connect_timeout;
130 keywords[5] =
"fallback_application_name";
139 (strncmp(pgdbname,
"postgresql://", 13) == 0 ||
140 strncmp(pgdbname,
"postgres://", 11) == 0 ||
141 strchr(pgdbname,
'=') != NULL))
160 if (strcmp(def->
keyword,
"host") == 0)
163 pghost_str = opt->
val;
167 pghost_str = def->
val;
171 else if (strcmp(def->
keyword,
"hostaddr") == 0)
174 pghostaddr_str = opt->
val;
176 pghostaddr_str = def->
val;
178 else if (strcmp(def->
keyword,
"port") == 0)
181 pgport_str = opt->
val;
185 pgport_str = def->
val;
197 pghostaddr_str != NULL ? pghostaddr_str : pghost_str,
203 printf(
_(
"accepting connections\n"));
206 printf(
_(
"rejecting connections\n"));
static Datum values[MAXATTR]
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
int errmsg(const char *fmt,...)
PQconninfoOption * PQconninfoParse(const char *conninfo, char **errmsg)
PQconninfoOption * PQconndefaults(void)
PGPing PQpingParams(const char *const *keywords, const char *const *values, int expand_dbname)
char * pg_strdup(const char *in)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp)
static AmcheckOptions opts
#define DEFAULT_PGSOCKET_DIR
PGDLLIMPORT char * optarg
static void help(const char *progname)
#define PARAMS_ARRAY_SIZE
static const char * pghost
static const char * pgport
const char * get_progname(const char *argv0)
References _, DEFAULT_CONNECT_TIMEOUT, DEFAULT_PGSOCKET_DIR, errmsg(), exit(), get_progname(), getopt_long(), handle_help_version_opts(), help(), _PQconninfoOption::keyword, no_argument, optarg, optind, opts, PARAMS_ARRAY_SIZE, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_strdup(), PG_TEXTDOMAIN, pghost, pgport, PQconndefaults(), PQconninfoParse(), PQPING_NO_ATTEMPT, PQPING_NO_RESPONSE, PQPING_OK, PQPING_REJECT, PQpingParams(), printf, progname, required_argument, set_pglocale_pgservice(), _PQconninfoOption::val, and values.