summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d3af657)
raw | patch | inline | side by side (parent: d3af657)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 9 Nov 2002 03:39:35 +0000 (03:39 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 9 Nov 2002 03:39:35 +0000 (03:39 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@178 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index a2fd90e01b2f4c250950766d51a2d1179c8626b6..98c504faff1d7f1147514d2afde2a7ffc1f4944f 100644 (file)
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
while (1) {
#ifdef HAVE_GETOPT_H
- c = getopt_long (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:",
+ c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:",
long_options, &option_index);
#else
- c = getopt (argc, argv, "+?hVt:c:w:H:P:d:l:p:a:");
+ c = getopt (argc, argv, "hVt:c:w:H:P:d:l:p:a:");
#endif
if (c == EOF)
break;
switch (c) {
case '?': /* usage */
- usage2 ("Unknown argument", optarg);
+ usage3 ("Unknown argument", optopt);
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index 7ff7f28467be600d3aae7091bcf76052834c5f9a..74aa3b7c6a03f3b7a6992649026214ee8b477a8e 100644 (file)
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
switch (c) {
case '?': /* usage */
- usage2 ("Unknown argument", optarg);
+ usage3 ("Unknown argument", optopt);
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index de019bac0e93133b772d6de0e09985368d76d520..4e447a451839f1be81eeae0205c30052b31ae786 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
while (1) {
#ifdef HAVE_GETOPT_H
c =
- getopt_long (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:",
+ getopt_long (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:",
long_options, &option_index);
#else
- c = getopt (argc, argv, "+?hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:");
+ c = getopt (argc, argv, "hVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:");
#endif
if (c == -1 || c == EOF)
switch (c) {
case '?': /* usage */
- usage2 ("Unknown argument", optarg);
+ usage3 ("Unknown argument", optopt);
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/negate.c b/plugins/negate.c
index a11558d58a80a96f0c27d8b844d50fe9ca99c6ca..c76f5ca08cddddddc6bd50fdeb48c1cc0dc24741 100644 (file)
--- a/plugins/negate.c
+++ b/plugins/negate.c
while (1) {
#ifdef HAVE_GETOPT_H
- c = getopt_long (argc, argv, "+?hVt:",
+ c = getopt_long (argc, argv, "hVt:",
long_options, &option_index);
#else
- c = getopt (argc, argv, "+?hVt:");
+ c = getopt (argc, argv, "hVt:");
#endif
if (c == -1 || c == EOF)
break;
switch (c) {
case '?': /* help */
- usage2 ("Unknown argument", optarg);
+ usage3 ("Unknown argument", optopt);
case 'h': /* help */
print_help ();
exit (EXIT_SUCCESS);
diff --git a/plugins/utils.h.in b/plugins/utils.h.in
index 2b668f3c0a9a07cde6789f90c13332814b9363de..96bf9b2f3b6d95dbea0a720680e756867116dda4 100644 (file)
--- a/plugins/utils.h.in
+++ b/plugins/utils.h.in
exit(STATE_UNKNOWN);\
}
+#define usage3(msg,arg) {\
+ printf("%s: %s - %c\n",PROGNAME,msg,arg);\
+ print_usage();\
+ exit(STATE_UNKNOWN);\
+}
+
#define state_text(a) \
(a)==0?"OK":\
(a)==1?"WARNING":\