[Nagiosplug-checkins] CVS: nagiosplug/plugins check_udp.c,1.1.1.1,1.2

Karl DeBisschop kdebisschop at users.sourceforge.net
Wed Oct 30 10:47:01 CET 2002


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

Modified Files:
	check_udp.c 
Log Message:
forgot to remove call_getopt

Index: check_udp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_udp.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** check_udp.c	28 Feb 2002 06:42:59 -0000	1.1.1.1
--- check_udp.c	30 Oct 2002 18:46:01 -0000	1.2
***************
*** 50,54 ****
  
  int process_arguments (int, char **);
- int call_getopt (int, char **);
  void print_usage (void);
  void print_help (void);
--- 50,53 ----
***************
*** 58,62 ****
  char *server_address = NULL;
  char *server_expect = NULL;
! char *server_send = NULL;
  
  int
--- 57,61 ----
  char *server_address = NULL;
  char *server_expect = NULL;
! char *server_send = "";
  
  int
***************
*** 127,175 ****
  	int c;
  
- 	if (argc < 2)
- 		usage ("\n");
- 
- 	for (c = 1; c < argc; c++) {
- 		if (strcmp ("-to", argv[c]) == 0)
- 			strcpy (argv[c], "-t");
- 		else if (strcmp ("-wt", argv[c]) == 0)
- 			strcpy (argv[c], "-w");
- 		else if (strcmp ("-ct", argv[c]) == 0)
- 			strcpy (argv[c], "-c");
- 	}
- 
- 	c = 0;
- 	while ((c += call_getopt (argc - c, &argv[c])) < argc) {
- 
- 		if (is_option (argv[c]))
- 			continue;
- 
- 		if (server_address == NULL) {
- 			if (argc > c) {
- 				if (is_host (argv[c]) == FALSE)
- 					usage ("Invalid host name/address\n");
- 				server_address = argv[c];
- 			}
- 			else {
- 				usage ("Host name was not supplied\n");
- 			}
- 		}
- 	}
- 
- 	if (server_send == NULL)
- 		server_send = strscpy (server_send, "");
- 
- 	return OK;
- }
- 
- 
- 
- 
- 
- int
- call_getopt (int argc, char **argv)
- {
- 	int c, i = 0;
- 
  #ifdef HAVE_GETOPT_H
  	int option_index = 0;
--- 126,129 ----
***************
*** 189,217 ****
  #endif
  
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c =
! 			getopt_long (argc, argv, "+hVvH:e:s:c:w:t:p:", long_options,
! 									 &option_index);
  #else
  		c = getopt (argc, argv, "+hVvH:e:s:c:w:t:p:");
  #endif
  
- 		i++;
- 
- 		if (c == -1 || c == EOF || c == 1)
- 			break;
- 
- 		switch (c) {
- 		case 'H':
- 		case 'c':
- 		case 'w':
- 		case 't':
- 		case 'p':
- 		case 'e':
- 		case 's':
- 			i++;
- 		}
- 
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
--- 143,165 ----
  #endif
  
+ 	if (argc < 2)
+ 		usage ("\n");
+ 
+ 	for (c = 1; c < argc; c++) {
+ 		if (strcmp ("-to", argv[c]) == 0)
+ 			strcpy (argv[c], "-t");
+ 		else if (strcmp ("-wt", argv[c]) == 0)
+ 			strcpy (argv[c], "-w");
+ 		else if (strcmp ("-ct", argv[c]) == 0)
+ 			strcpy (argv[c], "-c");
+ 	}
+ 
  	while (1) {
  #ifdef HAVE_GETOPT_H
! 		c =	getopt_long (argc, argv, "+hVvH:e:s:c:w:t:p:", long_options, &option_index);
  #else
  		c = getopt (argc, argv, "+hVvH:e:s:c:w:t:p:");
  #endif
  
  		switch (c) {
  		case '?':									/* print short usage statement if args not parsable */
***************
*** 263,267 ****
  		}
  	}
! 	return i;
  }
  
--- 211,226 ----
  		}
  	}
! 
! 	c = optind;
! 	if (server_address == NULL && argv[c]) {
! 		if (is_host (argv[c]) == FALSE)
! 			usage ("Invalid host name/address\n");
! 		server_address = argv[c++];
! 	}
! 	else {
! 		usage ("Host name was not supplied\n");
! 	}
! 
! 	return c;
  }
  





More information about the Commits mailing list