[Nagiosplug-checkins] CVS: nagiosplug/plugins check_pgsql.c,1.2,1.3 check_ping.c,1.7,1.8 check_snmp.c,1.10,1.11 negate.c,1.2,1.3 utils.h.in,1.6,1.7

Karl DeBisschop kdebisschop at users.sourceforge.net
Fri Nov 8 19:40:02 CET 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv875

Modified Files:
	check_pgsql.c check_ping.c check_snmp.c negate.c utils.h.in 
Log Message:
define and use usage3 where second part of message is a an int/char

Index: check_pgsql.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_pgsql.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** check_pgsql.c	21 Oct 2002 03:40:06 -0000	1.2
--- check_pgsql.c	9 Nov 2002 03:39:35 -0000	1.3
***************
*** 267,274 ****
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		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:");
  #endif
  		if (c == EOF)
--- 267,274 ----
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		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:");
  #endif
  		if (c == EOF)
***************
*** 277,281 ****
  		switch (c) {
  		case '?':     /* usage */
! 			usage2 ("Unknown argument", optarg);
  		case 'h':     /* help */
  			print_help ();
--- 277,281 ----
  		switch (c) {
  		case '?':     /* usage */
! 			usage3 ("Unknown argument", optopt);
  		case 'h':     /* help */
  			print_help ();

Index: check_ping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ping.c	8 Nov 2002 07:18:49 -0000	1.7
--- check_ping.c	9 Nov 2002 03:39:35 -0000	1.8
***************
*** 188,192 ****
  		switch (c) {
  		case '?':	/* usage */
! 			usage2 ("Unknown argument", optarg);
  		case 'h':	/* help */
  			print_help ();
--- 188,192 ----
  		switch (c) {
  		case '?':	/* usage */
! 			usage3 ("Unknown argument", optopt);
  		case 'h':	/* help */
  			print_help ();

Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** check_snmp.c	8 Nov 2002 08:07:37 -0000	1.10
--- check_snmp.c	9 Nov 2002 03:39:35 -0000	1.11
***************
*** 419,426 ****
  #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:",
  									 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:");
  #endif
  
--- 419,426 ----
  #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:",
  									 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:");
  #endif
  
***************
*** 430,434 ****
  		switch (c) {
  		case '?':	/* usage */
! 			usage2 ("Unknown argument", optarg);
  		case 'h':	/* help */
  			print_help ();
--- 430,434 ----
  		switch (c) {
  		case '?':	/* usage */
! 			usage3 ("Unknown argument", optopt);
  		case 'h':	/* help */
  			print_help ();

Index: negate.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/negate.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** negate.c	7 Oct 2002 01:19:36 -0000	1.2
--- negate.c	9 Nov 2002 03:39:35 -0000	1.3
***************
*** 235,242 ****
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c = getopt_long (argc, argv, "+?hVt:",
  		                 long_options, &option_index);
  #else
! 		c = getopt (argc, argv, "+?hVt:");
  #endif
  		if (c == -1 || c == EOF)
--- 235,242 ----
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c = getopt_long (argc, argv, "hVt:",
  		                 long_options, &option_index);
  #else
! 		c = getopt (argc, argv, "hVt:");
  #endif
  		if (c == -1 || c == EOF)
***************
*** 245,249 ****
  		switch (c) {
  		case '?':     /* help */
! 			usage2 ("Unknown argument", optarg);
  		case 'h':     /* help */
  			print_help ();
--- 245,249 ----
  		switch (c) {
  		case '?':     /* help */
! 			usage3 ("Unknown argument", optopt);
  		case 'h':     /* help */
  			print_help ();

Index: utils.h.in
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** utils.h.in	8 Nov 2002 07:20:05 -0000	1.6
--- utils.h.in	9 Nov 2002 03:39:35 -0000	1.7
***************
*** 87,90 ****
--- 87,96 ----
  }
  
+ #define usage3(msg,arg) {\
+  printf("%s: %s - %c\n",PROGNAME,msg,arg);\
+  print_usage();\
+  exit(STATE_UNKNOWN);\
+ }
+ 
  #define state_text(a) \
  (a)==0?"OK":\





More information about the Commits mailing list