|
|
@ -33,6 +33,7 @@ postgresql_usage (const char *msg)
|
|
|
|
printf ("PostgreSQL plugin error: %s\n", msg);
|
|
|
|
printf ("PostgreSQL plugin error: %s\n", msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
poptPrintUsage (postgresql_poptcon, stdout, 0);
|
|
|
|
poptPrintUsage (postgresql_poptcon, stdout, 0);
|
|
|
|
|
|
|
|
fprintf (stderr, " [SQL-request]\n");
|
|
|
|
exit (1);
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -42,6 +43,7 @@ init (const int argc, const char **argv,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
int value;
|
|
|
|
char *msg = malloc (256);
|
|
|
|
char *msg = malloc (256);
|
|
|
|
|
|
|
|
char *rest;
|
|
|
|
char *hostname;
|
|
|
|
char *hostname;
|
|
|
|
/* popt variables */
|
|
|
|
/* popt variables */
|
|
|
|
struct poptOption options[] = {
|
|
|
|
struct poptOption options[] = {
|
|
|
@ -58,9 +60,10 @@ init (const int argc, const char **argv,
|
|
|
|
err_quit ("UDP makes no sense for a PostgreSQL connection");
|
|
|
|
err_quit ("UDP makes no sense for a PostgreSQL connection");
|
|
|
|
postgresql_poptcon = poptGetContext (NULL, argc,
|
|
|
|
postgresql_poptcon = poptGetContext (NULL, argc,
|
|
|
|
argv, options,
|
|
|
|
argv, options,
|
|
|
|
POPT_CONTEXT_KEEP_FIRST);
|
|
|
|
POPT_CONTEXT_POSIXMEHARDER);
|
|
|
|
while ((value = poptGetNextOpt (postgresql_poptcon)) > 0)
|
|
|
|
while ((value = poptGetNextOpt (postgresql_poptcon)) > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
if (value < -1)
|
|
|
|
if (value < -1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sprintf (msg, "%s: %s",
|
|
|
|
sprintf (msg, "%s: %s",
|
|
|
@ -68,11 +71,13 @@ init (const int argc, const char **argv,
|
|
|
|
poptStrerror (value));
|
|
|
|
poptStrerror (value));
|
|
|
|
postgresql_usage (msg);
|
|
|
|
postgresql_usage (msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* hostname = poptGetArg (postgresql_poptcon); /* Not used */
|
|
|
|
hostname = poptGetArg (postgresql_poptcon); /* Not used */
|
|
|
|
|
|
|
|
request = poptGetArg (postgresql_poptcon);
|
|
|
|
request = poptGetArg (postgresql_poptcon);
|
|
|
|
if (request == NULL)
|
|
|
|
if (request == NULL)
|
|
|
|
request = "SELECT now()";
|
|
|
|
request = "SELECT now()";
|
|
|
|
|
|
|
|
rest = poptGetArg (postgresql_poptcon);
|
|
|
|
|
|
|
|
if (rest != NULL)
|
|
|
|
|
|
|
|
postgresql_usage ("Erroneous additional arguments");
|
|
|
|
if (conninfo == NULL)
|
|
|
|
if (conninfo == NULL)
|
|
|
|
conninfo = "";
|
|
|
|
conninfo = "";
|
|
|
|
return NULL; /* We only use the conninfo, echoping does not see our hostname or port */
|
|
|
|
return NULL; /* We only use the conninfo, echoping does not see our hostname or port */
|
|
|
|