From f4f92be60c94fd4e0dd4b2b4b3101543eedb706a Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sun, 10 Aug 2003 06:53:22 +0000 Subject: the last round of pedantic compiler warnings git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@676 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_nagios.c | 106 +++++++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 48 deletions(-) (limited to 'plugins/check_nagios.c') diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index a678e2a4..5b21ba1d 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -25,48 +25,9 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "popen.h" #include "utils.h" -void -print_usage (void) -{ - printf (_("\ -Usage: %s -F -e -C \n"), - progname); -} - -void -print_help (void) -{ - print_revision (progname, revision); - - printf (_(COPYRIGHT), copyright, email); - - printf (_("\ -This plugin attempts to check the status of the Nagios process on the local\n\ -machine. The plugin will check to make sure the Nagios status log is no older\n\ -than the number of minutes specified by the option. It also\n\ -uses the /bin/ps command to check for a process matching whatever you specify\n\ -by the argument.\n")); - - print_usage (); - - printf (_(UT_HELP_VRSN)); - - printf (_("\ --F, --filename=FILE\n\ - Name of the log file to check\n\ --e, --expires=INTEGER\n\ - Seconds aging afterwhich logfile is condsidered stale\n\ --C, --command=STRING\n\ - Command to search for in process table\n")); - - printf (_("\ -Example:\n\ - ./check_nagios -e 5 \\\ - -F /usr/local/nagios/var/status.log \\\ - -C /usr/local/nagios/bin/nagios\n")); -} - int process_arguments (int, char **); +void print_help (void); +void print_usage (void); char *status_log = NULL; char *process_string = NULL; @@ -198,8 +159,8 @@ process_arguments (int argc, char **argv) { int c; - int option_index = 0; - static struct option long_options[] = { + int option = 0; + static struct option longopts[] = { {"filename", required_argument, 0, 'F'}, {"expires", required_argument, 0, 'e'}, {"command", required_argument, 0, 'C'}, @@ -225,7 +186,7 @@ process_arguments (int argc, char **argv) } while (1) { - c = getopt_long (argc, argv, "+hVvF:C:e:", long_options, &option_index); + c = getopt_long (argc, argv, "+hVvF:C:e:", longopts, &option); if (c == -1 || c == EOF || c == 1) break; @@ -252,8 +213,8 @@ process_arguments (int argc, char **argv) expire_minutes = atoi (optarg); else die (STATE_UNKNOWN, - _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"), - progname); + _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"), + progname); break; case 'v': verbose++; @@ -264,8 +225,8 @@ process_arguments (int argc, char **argv) if (status_log == NULL) die (STATE_UNKNOWN, - _("You must provide the status_log\nType '%s -h' for additional help\n"), - progname); + _("You must provide the status_log\nType '%s -h' for additional help\n"), + progname); else if (process_string == NULL) die (STATE_UNKNOWN, _("You must provide a process string\nType '%s -h' for additional help\n"), @@ -273,3 +234,52 @@ process_arguments (int argc, char **argv) return OK; } + + + + + + +void +print_help (void) +{ + print_revision (progname, revision); + + printf (_(COPYRIGHT), copyright, email); + + printf (_("\ +This plugin attempts to check the status of the Nagios process on the local\n\ +machine. The plugin will check to make sure the Nagios status log is no older\n\ +than the number of minutes specified by the option. It also\n\ +uses the /bin/ps command to check for a process matching whatever you specify\n\ +by the argument.\n")); + + print_usage (); + + printf (_(UT_HELP_VRSN)); + + printf (_("\ +-F, --filename=FILE\n\ + Name of the log file to check\n\ +-e, --expires=INTEGER\n\ + Seconds aging afterwhich logfile is condsidered stale\n\ +-C, --command=STRING\n\ + Command to search for in process table\n")); + + printf (_("\ +Example:\n\ + ./check_nagios -e 5 \\\ + -F /usr/local/nagios/var/status.log \\\ + -C /usr/local/nagios/bin/nagios\n")); +} + + + + +void +print_usage (void) +{ + printf (_("\ +Usage: %s -F -e -C \n"), + progname); +} -- cgit v1.2.3