From 54c9381f104d98b183c24408d5a3430076a6f36b Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Thu, 17 Apr 2003 05:55:25 +0000 Subject: code cleanup to clear strict compiler warnings git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@496 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_dig.c | 17 ++++--- plugins/check_tcp.c | 16 ++++--- plugins/check_users.c | 123 ++++++++++++++++++++++---------------------------- 3 files changed, 73 insertions(+), 83 deletions(-) (limited to 'plugins') diff --git a/plugins/check_dig.c b/plugins/check_dig.c index f80a9dc2..6e040874 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -21,6 +21,7 @@ const char *revision = "$Revision$"; const char *copyright = "2002-2003"; const char *authors = "Nagios Plugin Development Team"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; + const char *summary = "Test the DNS service on the specified host using dig\n"; const char *option_summary = "-H host -l lookup [-t timeout] [-v]"; @@ -33,11 +34,13 @@ const char *options = "\ -t, --timeout=INTEGER\n\ Seconds before connection attempt times out (default: %d)\n\ -v, --verbose\n\ - Print extra information (command-line use only)\n\ + Print extra information (command-line use only)\n"; + +const char *standard_options = "\ -h, --help\n\ - Print detailed help screen\n\ + Print detailed help screen\n\ -V, --version\n\ - Print version information\n\n"; + Print version information\n\n"; #include "config.h" #include "common.h" @@ -238,7 +241,7 @@ validate_arguments (void) { return OK; } - + @@ -247,12 +250,12 @@ void print_help (void) { print_revision (progname, revision); - printf - ("Copyright (c) %s %s <%s>\n\n%s\n", - copyright, authors, email, summary); + printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email); + printf (summary); print_usage (); printf ("\nOptions:\n"); printf (options, DEFAULT_SOCKET_TIMEOUT); + printf (standard_options); support (); } diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 62efc8c7..1057fdc6 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -57,7 +57,7 @@ const char *standard_options = "\ -h, --help\n\ Print detailed help screen\n\ -V, --version\n\ - Print version information"; + Print version information\n\n"; #include "config.h" #include "common.h" @@ -358,10 +358,7 @@ main (int argc, char **argv) return result; } - - - - + @@ -513,13 +510,15 @@ process_arguments (int argc, char **argv) return OK; } + + + void print_help (void) { print_revision (progname, revision); - printf ("Copyright (c) %s %s\n\t<%s>\n\n", - copyright, authors, email); + printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email); printf (summary, SERVICE); print_usage (); printf ("\nOptions:\n"); @@ -535,6 +534,9 @@ print_usage (void) printf (" %s (-h|--help)\n", progname); printf (" %s (-V|--version)\n", progname); } + + + #ifdef HAVE_SSL int diff --git a/plugins/check_users.c b/plugins/check_users.c index 58e8c13b..50851075 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -1,58 +1,48 @@ -/****************************************************************************** - * - * CHECK_USERS.C - * - * Program: Current users plugin for Nagios - * License: GPL - * Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) - * - * Last Modified: $Date$ - * Modifications: - * - * 1999-11-17 Karl DeBisschop - * - check stderr and status from spoen/spclose - * - reformat commenst to fit 80-cahr screen - * - set default result to STATE_UNKNOWN - * - initialize users at -1, eliminate 'found' variable - * - * Command line: CHECK_USERS - * - * Description: - * - * This plugin will use the /usr/bin/who command to check the number - * of users currently logged into the system. If number of logged in - * user exceeds the number specified by the option, a - * STATE_CRITICAL is return. It it exceeds , a STATE_WARNING - * is returned. Errors reading the output from the who command result - * in a STATE_UNKNOWN error. - * - * License Information: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - *****************************************************************************/ +/***************************************************************************** +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*****************************************************************************/ #include "common.h" #include "popen.h" #include "utils.h" const char *progname = "check_users"; -#define REVISION "$Revision$" -#define COPYRIGHT "1999-2002" -#define AUTHOR "Ethan Galstad" -#define EMAIL "nagios@nagios.org" +const char *revision = "$Revision$"; +const char *copyright = "2002-2003"; +const char *authors = "Nagios Plugin Development Team"; +const char *email = "nagiosplug-devel@lists.sourceforge.net"; + +const char *summary = "\ +This plugin checks the number of users currently logged in on the local\n\ +system and generates an error if the number exceeds the thresholds specified.\n"; + +const char *option_summary = "-w -c "; + +const char *options = "\ + -w, --warning=INTEGER\n\ + Set WARNING status if more than INTEGER users are logged in\n\ + -c, --critical=INTEGER\n\ + Set CRITICAL status if more than INTEGER users are logged in\n"; + +const char *standard_options = "\ + -h, --help\n\ + Print detailed help screen\n\ + -V, --version\n\ + Print version information\n\n"; #define possibly_set(a,b) ((a) == 0 ? (b) : 0) @@ -163,7 +153,7 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case 'V': /* version */ - print_revision (progname, REVISION); + print_revision (progname, revision); exit (STATE_OK); case 'c': /* critical */ if (!is_intnonneg (optarg)) @@ -193,15 +183,22 @@ process_arguments (int argc, char **argv) return OK; } - + void -print_usage (void) +print_help (void) { - printf ("Usage: %s -w -c \n", progname); + print_revision (progname, revision); + printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email); + printf (summary); + print_usage (); + printf ("\nOptions:\n"); + printf (options); + printf (standard_options); + support (); } @@ -209,21 +206,9 @@ print_usage (void) void -print_help (void) +print_usage (void) { - print_revision (progname, REVISION); - printf - ("Copyright (c) " COPYRIGHT " " AUTHOR "(" EMAIL ")\n\n" - "This plugin checks the number of users currently logged in on the local\n" - "system and generates an error if the number exceeds the thresholds specified.\n"); - print_usage (); - printf - ("Options:\n" - " -w, --warning=INTEGER\n" - " Set WARNING status if more than INTEGER users are logged in\n" - " -c, --critical=INTEGER\n" - " Set CRITICAL status if more than INTEGER users are logged in\n" - " -h, --help\n" - " Print detailed help screen\n" - " -V, --version\n" " Print version information\n"); + printf ("Usage: %s %s\n", progname, option_summary); + printf (" %s (-h|--help)\n", progname); + printf (" %s (-V|--version)\n", progname); } -- cgit v1.2.3-74-g34f1