From de253aab54995fb2d2ba9bc1882d3bb3acef6caf Mon Sep 17 00:00:00 2001 From: Stephane Bortzmeyer Date: Wed, 21 Jul 2004 08:52:39 +0000 Subject: [PATCH] Small user interface bugs --- SRC/plugins/postgresql/postgresql.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/SRC/plugins/postgresql/postgresql.c b/SRC/plugins/postgresql/postgresql.c index dbb4148..905f7e3 100644 --- a/SRC/plugins/postgresql/postgresql.c +++ b/SRC/plugins/postgresql/postgresql.c @@ -33,6 +33,7 @@ postgresql_usage (const char *msg) printf ("PostgreSQL plugin error: %s\n", msg); } poptPrintUsage (postgresql_poptcon, stdout, 0); + fprintf (stderr, " [SQL-request]\n"); exit (1); } @@ -42,6 +43,7 @@ init (const int argc, const char **argv, { int value; char *msg = malloc (256); + char *rest; char *hostname; /* popt variables */ struct poptOption options[] = { @@ -58,21 +60,24 @@ init (const int argc, const char **argv, err_quit ("UDP makes no sense for a PostgreSQL connection"); postgresql_poptcon = poptGetContext (NULL, argc, argv, options, - POPT_CONTEXT_KEEP_FIRST); + POPT_CONTEXT_POSIXMEHARDER); while ((value = poptGetNextOpt (postgresql_poptcon)) > 0) { - if (value < -1) - { - sprintf (msg, "%s: %s", - poptBadOption (postgresql_poptcon, POPT_BADOPTION_NOALIAS), - poptStrerror (value)); - postgresql_usage (msg); - } } - hostname = poptGetArg (postgresql_poptcon); /* Not used */ + if (value < -1) + { + sprintf (msg, "%s: %s", + poptBadOption (postgresql_poptcon, POPT_BADOPTION_NOALIAS), + poptStrerror (value)); + postgresql_usage (msg); + } + /* hostname = poptGetArg (postgresql_poptcon); /* Not used */ request = poptGetArg (postgresql_poptcon); if (request == NULL) request = "SELECT now()"; + rest = poptGetArg (postgresql_poptcon); + if (rest != NULL) + postgresql_usage ("Erroneous additional arguments"); if (conninfo == NULL) conninfo = ""; return NULL; /* We only use the conninfo, echoping does not see our hostname or port */