From d19edd4043c498626fe68308005947975ef0a697 Mon Sep 17 00:00:00 2001 From: Benoit Mortier Date: Wed, 1 Dec 2004 23:54:51 +0000 Subject: standardize localization string standardize unknow arguments git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_by_ssh.c | 17 ++++++++-------- plugins/check_dig.c | 21 ++++++++----------- plugins/check_disk.c | 19 +++++++++-------- plugins/check_dns.c | 16 +++++++++------ plugins/check_dummy.c | 2 ++ plugins/check_fping.c | 11 +++------- plugins/check_game.c | 10 ++++++--- plugins/check_hpjd.c | 19 +++++++---------- plugins/check_http.c | 39 +++++++++++++++++++---------------- plugins/check_ide-smart.c | 52 ++++++++++++++++++++++++++++++++++------------- plugins/check_ldap.c | 8 +++++--- plugins/check_load.c | 8 ++++++-- plugins/check_mrtg.c | 8 ++++++-- plugins/check_mrtgtraf.c | 12 +++++------ plugins/check_mysql.c | 18 ++++++---------- plugins/check_nagios.c | 12 ++++------- plugins/check_nt.c | 16 ++++----------- plugins/check_nwstat.c | 19 ++++++++--------- plugins/check_overcr.c | 12 +++++++---- plugins/check_pgsql.c | 40 +++++++++++++++++++----------------- plugins/check_ping.c | 40 ++++++++++++++++-------------------- plugins/check_procs.c | 23 +++++++-------------- plugins/check_radius.c | 16 +++++++-------- plugins/check_real.c | 28 +++++++++---------------- plugins/check_smtp.c | 36 +++++++++++--------------------- plugins/check_snmp.c | 35 +++++++++---------------------- plugins/check_ssh.c | 17 +++++++++++++--- plugins/check_swap.c | 12 ++++------- plugins/check_tcp.c | 29 +++++++++++++------------- plugins/check_time.c | 35 +++++++++++++++---------------- plugins/check_udp.c | 18 ++++++++-------- plugins/check_ups.c | 32 +++++++++++++---------------- plugins/check_users.c | 18 +++++++--------- plugins/common.h | 2 ++ plugins/getaddrinfo.c | 2 ++ plugins/getaddrinfo.h | 5 ++++- plugins/gethostbyname.c | 2 ++ plugins/gethostbyname.h | 2 ++ plugins/negate.c | 21 +++++++++++-------- plugins/netutils.c | 8 +++++--- plugins/netutils.h | 2 ++ plugins/popen.c | 2 ++ plugins/urlize.c | 11 +++++----- plugins/utils.c | 12 ----------- plugins/utils.h | 2 ++ 45 files changed, 370 insertions(+), 399 deletions(-) (limited to 'plugins') diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 6daa1a11..8f6cde99 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ const char *progname = "check_by_ssh"; @@ -67,7 +69,7 @@ main (int argc, char **argv) /* process arguments */ if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_by_ssh: could not parse arguments\n")); /* Set signal handling and alarm timeout */ @@ -214,10 +216,11 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); print_usage (); exit (STATE_UNKNOWN); case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); @@ -233,12 +236,12 @@ process_arguments (int argc, char **argv) break; case 'H': /* host */ if (!is_host (optarg)) - usage2 (_("Invalid hostname/adress"), optarg); + usage2 (_("Invalid hostname/address"), optarg); hostname = optarg; break; case 'p': /* port number */ if (!is_integer (optarg)) - usage2 (_("port must be a positive integer"), optarg); + usage2 (_("Port must be a positive integer"), optarg); asprintf (&comm,"%s -p %s", comm, optarg); break; case 'O': /* output file */ @@ -292,7 +295,7 @@ process_arguments (int argc, char **argv) if (c <= argc) { die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); } else if (!is_host (argv[c])) - die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid host name"), argv[c]); + die (STATE_UNKNOWN, "%s: %s %s\n", progname, _("Invalid hostname/address"), argv[c]); hostname = argv[c++]; } @@ -317,8 +320,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -408,8 +409,6 @@ $ cat /tmp/foo\n\ - - void print_usage (void) { diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 5b472eca..a500cdcf 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ #include "common.h" @@ -128,7 +130,6 @@ main (int argc, char **argv) asprintf (&output, _("Server not found in ANSWER SECTION")); result = STATE_WARNING; } - } } @@ -181,8 +182,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -215,7 +214,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ - usage3 (_("Unknown argument"), optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); @@ -227,7 +228,7 @@ process_arguments (int argc, char **argv) dns_server = optarg; } else { - usage2 (_("Invalid hostname/adress"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'p': /* server port */ @@ -235,7 +236,7 @@ process_arguments (int argc, char **argv) server_port = atoi (optarg); } else { - usage2 (_("port must be a positive integer"), optarg); + usage2 (_("Port must be a positive integer"), optarg); } break; case 'l': /* address to lookup */ @@ -284,7 +285,7 @@ process_arguments (int argc, char **argv) dns_server = argv[c]; } else { - usage2 (_("Invalid hostname/adress"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } } else { @@ -297,8 +298,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -307,9 +306,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -354,7 +350,6 @@ print_help (void) - void print_usage (void) { diff --git a/plugins/check_disk.c b/plugins/check_disk.c index c8239250..437bbbf2 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ const char *progname = "check_disk"; @@ -133,7 +135,7 @@ int display_mntp = FALSE; static struct mount_entry *mount_list; - + int main (int argc, char **argv) { @@ -162,7 +164,7 @@ main (int argc, char **argv) mount_list = read_filesystem_list (0); if (process_arguments (argc, argv) != OK) - usage (_("Could not parse arguments\n")); + usage (_("check_disk: could not parse arguments\n")); for (me = mount_list; me; me = me->me_next) { @@ -240,7 +242,6 @@ main (int argc, char **argv) - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -437,8 +438,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Unknow argument\n")); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -479,6 +481,7 @@ process_arguments (int argc, char **argv) } + void print_path (const char *mypath) { @@ -490,6 +493,8 @@ print_path (const char *mypath) return; } + + int validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath) { @@ -523,7 +528,6 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate - int check_disk (double usp, double free_disk) { @@ -564,8 +568,6 @@ walk_name_list (struct name_list *list, const char *name) - - void print_help (void) { @@ -631,7 +633,6 @@ and generates an alert if free space is less than one of the threshold values.") - void print_usage (void) { diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 6c08c277..fa7fbc1e 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -16,6 +16,8 @@ LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not be picked up by this plugin + + $Id$ ******************************************************************************/ @@ -71,7 +73,7 @@ main (int argc, char **argv) } if (process_arguments (argc, argv) != OK) { - print_usage (); + usage (_("check_dns: could not parse arguments\n")); return STATE_UNKNOWN; } @@ -213,6 +215,8 @@ main (int argc, char **argv) return result; } + + int error_scan (char *input_buffer) { @@ -261,6 +265,8 @@ error_scan (char *input_buffer) } + + /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -320,7 +326,7 @@ process_arguments (int argc, char **argv) /* TODO: this is_host check is probably unnecessary. */ /* Better to confirm nslookup response matches */ if (is_host (optarg) == FALSE) { - printf (_("Invalid server name/address\n\n")); + printf (_("Invalid hostname/address\n\n")); print_usage (); exit (STATE_UNKNOWN); } @@ -370,6 +376,8 @@ process_arguments (int argc, char **argv) return validate_arguments (); } + + int validate_arguments () { @@ -381,9 +389,6 @@ validate_arguments () - - - void print_help (void) { @@ -419,7 +424,6 @@ specified in /etc/resolv.conf will be used.\n")); - void print_usage (void) { diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 7f508349..a99e38a7 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ #include "common.h" diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 2dba2d58..8647330c 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_fping"; @@ -66,7 +68,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_fping: could not parse arguments\n")); server = strscpy (server, server_name); @@ -116,7 +118,6 @@ main (int argc, char **argv) - int textscan (char *buf) { @@ -195,7 +196,6 @@ textscan (char *buf) return status; } - @@ -308,8 +308,6 @@ process_arguments (int argc, char **argv) - - int get_threshold (char *arg, char *rv[2]) { @@ -352,8 +350,6 @@ get_threshold (char *arg, char *rv[2]) - - void print_help (void) { @@ -398,7 +394,6 @@ percentage of packet loss to trigger an alarm state.\n")); - void print_usage (void) { diff --git a/plugins/check_game.c b/plugins/check_game.c index 511e9617..8b2a6c42 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c @@ -14,6 +14,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * +* $Id$ *****************************************************************************/ const char *progname = "check_game"; @@ -64,9 +65,12 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - result = process_arguments (argc, argv); +// result = process_arguments (argc, argv); + + if (process_arguments (argc, argv) == ERROR) + usage (_("check_game: could not parse arguments\n")); - if (result != OK) { +/* if (result != OK) { printf (_("Incorrect arguments supplied\n")); printf ("\n"); print_revision (progname, revision); @@ -75,6 +79,7 @@ main (int argc, char **argv) printf ("\n"); return STATE_UNKNOWN; } +*/ result = STATE_OK; @@ -302,7 +307,6 @@ validate_arguments (void) - void print_help (void) { diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 5699570c..af6044a0 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -14,6 +14,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * +* $Id$ *****************************************************************************/ #include "common.h" @@ -84,7 +85,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_hpjd: could not parse arguments\n")); /* removed ' 2>1' at end of command 10/27/1999 - EG */ /* create the query string */ @@ -285,8 +286,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -321,7 +320,7 @@ process_arguments (int argc, char **argv) address = strscpy(address, optarg) ; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'C': /* community */ @@ -334,7 +333,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -344,7 +345,7 @@ process_arguments (int argc, char **argv) address = argv[c++]; } else { - usage2 (_("Invalid host name"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } } @@ -360,8 +361,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -370,9 +369,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -398,7 +394,6 @@ Net-snmp must be installed on the computer running the plugin.\n\n")); - void print_usage (void) { diff --git a/plugins/check_http.c b/plugins/check_http.c index 98005d02..748ca46e 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ /* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */ @@ -188,7 +190,7 @@ main (int argc, char **argv) #endif return result; } - + /* process command-line arguments */ @@ -249,7 +251,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage3 (_("unknown argument"), optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); break; case 'h': /* help */ print_help (); @@ -267,7 +271,7 @@ process_arguments (int argc, char **argv) break; case 'c': /* critical time threshold */ if (!is_nonnegative (optarg)) - usage2 (_("invalid critical threshold"), optarg); + usage2 (_("Critical threshold must be integer"), optarg); else { critical_time = strtod (optarg, NULL); check_critical_time = TRUE; @@ -275,7 +279,7 @@ process_arguments (int argc, char **argv) break; case 'w': /* warning time threshold */ if (!is_nonnegative (optarg)) - usage2 (_("invalid warning threshold"), optarg); + usage2 (_("Warning threshold must be integer"), optarg); else { warning_time = strtod (optarg, NULL); check_warning_time = TRUE; @@ -304,13 +308,13 @@ process_arguments (int argc, char **argv) case 'C': /* Check SSL cert validity */ #ifdef HAVE_SSL if (!is_intnonneg (optarg)) - usage2 (_("invalid certificate expiration period"), optarg); + usage2 (_("Invalid certificate expiration period"), optarg); else { days_till_exp = atoi (optarg); check_cert = TRUE; } #else - usage (_("check_http: invalid option - SSL is not available\n")); + usage (_("Invalid option - SSL is not available\n")); #endif break; case 'f': /* onredirect */ @@ -455,7 +459,7 @@ process_arguments (int argc, char **argv) return TRUE; } - + /* written by lauri alanko */ @@ -498,8 +502,6 @@ base64 (const char *bin, size_t len) buf[i] = '\0'; return buf; } - - @@ -613,6 +615,7 @@ parse_time_string (const char *string) } + static void check_document_dates (const char *headers) { @@ -818,12 +821,12 @@ check_http (void) if ( sslerr == SSL_ERROR_SSL ) { die (STATE_WARNING, _("Client Certificate Required\n")); } else { - die (STATE_CRITICAL, _("Error in recv()\n")); + die (STATE_CRITICAL, _("Error on receive\n")); } } else { #endif - die (STATE_CRITICAL, _("Error in recv()\n")); + die (STATE_CRITICAL, _("Error on receive\n")); #ifdef HAVE_SSL } #endif @@ -950,7 +953,7 @@ check_http (void) microsec = deltime (tv); elapsed_time = (double)microsec / 1.0e6; asprintf (&msg, - _("HTTP problem: %s - %.3f second response time %s%s|%s %s\n"), + _("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"), status_line, elapsed_time, timestamp, (display_html ? "" : ""), perfd_time (elapsed_time), perfd_size (pagesize)); @@ -1021,7 +1024,6 @@ check_http (void) - /* per RFC 2396 */ #define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: " #define URI_HTTP "%[HTPShtps]://" @@ -1223,6 +1225,8 @@ int connect_SSL (void) } #endif + + #ifdef HAVE_SSL int check_certificate (X509 ** certificate) @@ -1298,7 +1302,7 @@ check_certificate (X509 ** certificate) return STATE_OK; } #endif - + char *perfd_time (double elapsed_time) @@ -1310,6 +1314,7 @@ char *perfd_time (double elapsed_time) } + char *perfd_size (int page_len) { return perfdata ("size", page_len, "B", @@ -1319,6 +1324,7 @@ char *perfd_size (int page_len) } + int my_recv (void) { @@ -1337,6 +1343,7 @@ my_recv (void) } + int my_close (void) { @@ -1357,9 +1364,6 @@ my_close (void) - - - void print_help (void) { @@ -1483,7 +1487,6 @@ the certificate is expired.\n")); - void print_usage (void) { diff --git a/plugins/check_ide-smart.c b/plugins/check_ide-smart.c index 06deb12a..9d3c3160 100644 --- a/plugins/check_ide-smart.c +++ b/plugins/check_ide-smart.c @@ -2,7 +2,7 @@ * check_ide-smart v.1 - hacked version of ide-smart for Nagios * Copyright (C) 2000 Robert Dale * - * Net Saint - http://www.nagios.org + * Nagios - http://www.nagios.org * * Notes: * ide-smart has the same functionality as before. Some return @@ -33,6 +33,8 @@ * 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. + * + * $Id$ */ #include "common.h" @@ -137,6 +139,8 @@ enum SmartCommand SMART_CMD_AUTO_OFFLINE }; + + char * get_offline_text (int status) { @@ -146,9 +150,11 @@ get_offline_text (int status) return offline_status_text[i].text; } } - return "unknown"; + return "UNKNOW"; } + + int smart_read_values (int fd, values_t * values) { @@ -160,13 +166,15 @@ smart_read_values (int fd, values_t * values) args[3] = 1; if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { e = errno; - printf (_("CRITICAL: SMART_READ_VALUES: %s\n"), strerror (errno)); + printf (_("CRITICAL - SMART_READ_VALUES: %s\n"), strerror (errno)); return e; } memcpy (values, args + 4, 512); return 0; } + + int values_not_passed (values_t * p, thresholds_t * t) { @@ -190,6 +198,8 @@ values_not_passed (values_t * p, thresholds_t * t) return (passed ? -failed : 2); } + + int net_saint (values_t * p, thresholds_t * t) { @@ -225,24 +235,24 @@ net_saint (values_t * p, thresholds_t * t) } switch (status) { case PREFAILURE: - printf (_("CRITICAL: %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), + printf (_("CRITICAL - %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), prefailure, prefailure > 1 ? 's' : ' ', failed, total); break; case ADVISORY: - printf (_("WARNING: %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), + printf (_("WARNING - %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), advisory, advisory > 1 ? "ies" : "y", failed, total); break; case OPERATIONAL: - printf (_("Status: Operational (%d/%d tests passed)\n"), passed, total); + printf (_("STATUS - Operational (%d/%d tests passed)\n"), passed, total); break; default: - printf (_("Error: Status '%d' uknown. %d/%d tests passed\n"), status, + printf (_("ERROR - Status '%d' uknown. %d/%d tests passed\n"), status, passed, total); status = -1; break; @@ -250,6 +260,8 @@ net_saint (values_t * p, thresholds_t * t) return status; } + + void print_value (value_t * p, threshold_t * t) { @@ -259,6 +271,8 @@ print_value (value_t * p, threshold_t * t) p->value > t->threshold ? "Passed" : "Failed"); } + + void print_values (values_t * p, thresholds_t * t) { @@ -291,6 +305,8 @@ print_values (values_t * p, thresholds_t * t) p->smart_capability & 2 ? "AutoSave" : ""); } + + void print_thresholds (thresholds_t * p) { @@ -320,12 +336,14 @@ smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { e = errno; if (show_error) { - printf (_("CRITICAL: %s: %s\n"), smart_command[command].text, strerror (errno)); + printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno)); } } return e; } + + int smart_read_thresholds (int fd, thresholds_t * thresholds) { @@ -337,13 +355,15 @@ smart_read_thresholds (int fd, thresholds_t * thresholds) args[3] = 1; if (ioctl (fd, HDIO_DRIVE_CMD, &args)) { e = errno; - printf (_("CRITICAL: SMART_READ_THRESHOLDS: %s\n"), strerror (errno)); + printf (_("CRITICAL - SMART_READ_THRESHOLDS: %s\n"), strerror (errno)); return e; } memcpy (thresholds, args + 4, 512); return 0; } + + void show_version () { @@ -352,6 +372,8 @@ show_version () printf ("(C) 1999 Ragnar Hojland Espinosa \n"); } + + void show_help () { @@ -373,6 +395,8 @@ Usage: check_ide-smart [DEVICE] [OPTION]\n\ -V, --version\n")); } + + int main (int argc, char *argv[]) { @@ -433,8 +457,9 @@ main (int argc, char *argv[]) show_version (); return 0; default: - printf (_("Try `%s --help' for more information.\n"), argv[0]); - return 1; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } if (optind < argc) { @@ -450,12 +475,12 @@ main (int argc, char *argv[]) fd = open (device, O_RDONLY); if (fd < 0) { - printf (_("CRITICAL: Couldn't open device: %s\n"), strerror (errno)); + printf (_("CRITICAL - Couldn't open device: %s\n"), strerror (errno)); return 2; } if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) { - printf (_("CRITICAL: SMART_CMD_ENABLE\n")); + printf (_("CRITICAL - SMART_CMD_ENABLE\n")); return 2; } @@ -489,4 +514,3 @@ main (int argc, char *argv[]) } return retval; } - diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 69874117..0dc0380a 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_ldap"; @@ -242,8 +244,9 @@ process_arguments (int argc, char **argv) #endif break; default: - usage (_("check_ldap: could not parse unknown arguments\n")); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -274,7 +277,6 @@ validate_arguments () - void print_help (void) { diff --git a/plugins/check_load.c b/plugins/check_load.c index 956f9077..babe84bc 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -13,6 +13,8 @@ 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. + + $Id$ ******************************************************************************/ @@ -75,7 +77,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage ("failed processing arguments\n"); + usage (_("check_load: could not parse arguments\n")); #if HAVE_GETLOADAVG==1 result = getloadavg (la, 3); @@ -227,7 +229,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 5532389c..2badd4ab 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_mrtg"; @@ -58,7 +60,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_mrtg: could not parse arguments\n")); /* open the MRTG log file for reading */ fp = fopen (log_file, "r"); @@ -229,7 +231,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index a5455b04..0b0f49ef 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -13,6 +13,8 @@ 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. + + $Id$ ******************************************************************************/ @@ -38,9 +40,6 @@ unsigned long outgoing_warning_threshold = 0L; unsigned long outgoing_critical_threshold = 0L; - - - int main (int argc, char **argv) { @@ -64,7 +63,7 @@ main (int argc, char **argv) char outgoing_speed_rating[8]; if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_ldap: could not parse arguments\n")); /* open the MRTG log file for reading */ fp = fopen (log_file, "r"); @@ -259,7 +258,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -314,7 +315,6 @@ validate_arguments (void) - void print_help (void) { diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index deac37fc..ffd96ed4 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -54,7 +54,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_mysql: could not parse arguments\n")); /* initialize mysql */ mysql_init (&mysql); @@ -146,8 +146,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -183,7 +181,7 @@ process_arguments (int argc, char **argv) db_host = optarg; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'd': /* hostname */ @@ -208,7 +206,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -221,7 +221,7 @@ process_arguments (int argc, char **argv) db_host = argv[c++]; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } else if (strlen(db_user) == 0) db_user = argv[c++]; @@ -240,8 +240,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -262,9 +260,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -304,7 +299,6 @@ a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT); - void print_usage (void) { diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index d9d18d9b..4439251f 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_nagios"; @@ -64,7 +66,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_nagios: could not parse arguments\n")); /* Set signal handling and alarm */ if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { @@ -78,7 +80,7 @@ main (int argc, char **argv) /* open the status log */ fp = fopen (status_log, "r"); if (fp == NULL) { - printf (_("Error: Cannot open status log for reading!\n")); + printf (_("ERROR - Cannot open status log for reading!\n")); return STATE_CRITICAL; } @@ -178,8 +180,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -264,9 +264,6 @@ process_arguments (int argc, char **argv) - - - void print_help (void) { @@ -302,7 +299,6 @@ Example:\n\ - void print_usage (void) { diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 8d66092d..84b78bc5 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -26,6 +26,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * $Id$ + * *****************************************************************************/ #include "common.h" @@ -109,7 +111,7 @@ int main(int argc, char **argv){ textdomain (PACKAGE); if(process_arguments(argc,argv)==ERROR) - usage(_("Could not parse arguments\n")); + usage(_("check_nt: could not parse arguments\n")); /* initialize alarm signal handling */ signal(SIGALRM,socket_timeout_alarm_handler); @@ -188,7 +190,7 @@ int main(int argc, char **argv){ updays = uptime / 86400; uphours = (uptime % 86400) / 3600; upminutes = ((uptime % 86400) % 3600) / 60; - asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); + asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes); return_code=STATE_OK; break; @@ -427,9 +429,6 @@ int main(int argc, char **argv){ - - - /* process command-line arguments */ int process_arguments(int argc, char **argv){ int c; @@ -557,9 +556,6 @@ int process_arguments(int argc, char **argv){ - - - void fetch_data (const char *address, int port, const char *sendb) { int result; @@ -603,9 +599,6 @@ void preparelist(char *string) { - - - void print_help(void) { print_revision(progname,"$Revision$"); @@ -681,7 +674,6 @@ Windows NT/2000/XP server.\n\n")); - void print_usage(void) { printf(_("\ diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 46bc7e90..ec5d5d6c 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_nwstat"; @@ -80,9 +82,6 @@ void print_usage(void); - - - int main(int argc, char **argv) { int result; @@ -123,7 +122,7 @@ main(int argc, char **argv) { textdomain (PACKAGE); if (process_arguments(argc,argv)==ERROR) - usage(_("Could not parse arguments\n")); + usage(_("check_nwstat: could not parse arguments\n")); /* initialize alarm signal handling */ signal(SIGALRM,socket_timeout_alarm_handler); @@ -609,10 +608,10 @@ main(int argc, char **argv) { if (time_sync_status==0) { result=STATE_CRITICAL; - asprintf (&output_message,_("Critical: Time not in sync with network!")); + asprintf (&output_message,_("CRITICAL - Time not in sync with network!")); } else { - asprintf (&output_message,_("OK! Time in sync with network!")); + asprintf (&output_message,_("OK - Time in sync with network!")); } /* check LRU sitting time in secondss */ @@ -710,7 +709,9 @@ main(int argc, char **argv) { return result; } - + + + /* process command-line arguments */ int process_arguments(int argc, char **argv) { int c; @@ -896,9 +897,6 @@ int process_arguments(int argc, char **argv) { - - - void print_help(void) { char *myport; @@ -987,7 +985,6 @@ Notes:\n\ - void print_usage(void) { printf (_("\ diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 0b524ff7..6682d8e6 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_overcr"; @@ -84,7 +86,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage ("Could not parse arguments\n"); + usage (_("check_overcr: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -281,8 +283,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -401,7 +401,9 @@ process_arguments (int argc, char **argv) } return OK; } - + + + void print_usage (void) { @@ -412,6 +414,8 @@ Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical]\n\ printf (_(UT_HLP_VRS), progname, progname); } + + void print_help (void) { diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 07abd9c0..53ba2950 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ #define DEFAULT_DB "template1" @@ -55,7 +57,7 @@ const char *progname = "check_pgsql"; const char *revision = "$Revision$"; const char *copyright = "1999-2003"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; - + /****************************************************************************** @@ -110,8 +112,6 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. Functions -@@ ******************************************************************************/ - - @@ -133,7 +133,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage ("Could not parse arguments"); + usage (_("check_pgsql: could not parse arguments\n")); /* Set signal handling and alarm */ if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { @@ -151,7 +151,7 @@ main (int argc, char **argv) /* check to see that the backend connection was successfully made */ if (PQstatus (conn) == CONNECTION_BAD) { - printf (_("PGSQL: CRITICAL - no connection to '%s' (%s).\n"), + printf (_("CRITICAL - no connection to '%s' (%s).\n"), dbName, PQerrorMessage (conn)); PQfinish (conn); return STATE_CRITICAL; @@ -166,13 +166,13 @@ main (int argc, char **argv) status = STATE_OK; } PQfinish (conn); - printf (_("PGSQL: %s - database %s (%d sec.)|%s\n"), + printf (_(" %s - database %s (%d sec.)|%s\n"), state_text(status), dbName, elapsed_time, fperfdata("time", elapsed_time, "s", (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0)); return status; } - + /* process command-line arguments */ @@ -206,8 +206,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage3 (_("Unknown argument"), optopt); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); @@ -222,25 +223,25 @@ process_arguments (int argc, char **argv) break; case 'c': /* critical time threshold */ if (!is_nonnegative (optarg)) - usage2 (_("Invalid critical threshold"), optarg); + usage2 (_("Critical threshold must be a positive integer"), optarg); else tcrit = strtod (optarg, NULL); break; case 'w': /* warning time threshold */ if (!is_nonnegative (optarg)) - usage2 (_("Invalid critical threshold"), optarg); + usage2 (_("Critical threshold must be a positive integer"), optarg); else twarn = strtod (optarg, NULL); break; case 'H': /* host */ if (!is_host (optarg)) - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); else pghost = optarg; break; case 'P': /* port */ if (!is_integer (optarg)) - usage2 (_("Port must be an integer"), optarg); + usage2 (_("Port must be a positive integer"), optarg); else pgport = optarg; break; @@ -287,12 +288,13 @@ first character cannot be a number, however. -@@ ******************************************************************************/ + + int validate_arguments () { return OK; } - /****************************************************************************** @@ -315,6 +317,8 @@ first character cannot be a number, however. -@@ ******************************************************************************/ + + int is_pg_dbname (char *dbname) { @@ -355,6 +359,8 @@ should be added. -@@ ******************************************************************************/ + + int is_pg_logname (char *username) { @@ -370,8 +376,6 @@ is_pg_logname (char *username) -@@ ******************************************************************************/ - - @@ -386,7 +390,7 @@ print_help (void) printf (_(COPYRIGHT), copyright, email); - printf (_("Test whether a PostgreSQL DBMS is accepting connections.\n\n")); + printf (_("Test whether a PostgreSQL Database is accepting connections.\n\n")); print_usage (); @@ -431,7 +435,6 @@ a password, but no effort is made to obsure or encrypt the password.\n")); - void print_usage (void) { @@ -444,4 +447,3 @@ Usage:\n %s [-H ] [-P ] [-c ] [-w ]\n\ %s (-V | --version) for version information\n"), progname, progname); } - diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 074519d3..260e1b65 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_ping"; @@ -60,8 +62,6 @@ char *warn_text; - - int main (int argc, char **argv) { @@ -79,7 +79,7 @@ main (int argc, char **argv) addresses[0] = NULL; if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments")); + usage (_("check_ping: could not parse arguments\n")); /* Set signal handling and alarm */ if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { @@ -159,9 +159,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -198,8 +195,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage3 (_("Unknown argument"), optopt); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); @@ -270,7 +268,7 @@ process_arguments (int argc, char **argv) if (addresses[0] == NULL) { if (is_host (argv[c]) == FALSE) { - usage2 (_("Invalid host name/address"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } else { addresses[0] = argv[c++]; n_addresses++; @@ -335,6 +333,8 @@ process_arguments (int argc, char **argv) return validate_arguments (); } + + int get_threshold (char *arg, float *trta, int *tpl) { @@ -349,6 +349,8 @@ get_threshold (char *arg, float *trta, int *tpl) return STATE_UNKNOWN; } + + int validate_arguments () { @@ -389,7 +391,7 @@ validate_arguments () for (i=0; i= 2) printf (_("CMD: %s\n"), PS_COMMAND); @@ -296,9 +293,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -338,6 +332,7 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); print_usage (); exit (STATE_UNKNOWN); case 'h': /* help */ @@ -495,7 +490,6 @@ process_arguments (int argc, char **argv) - int validate_arguments () { @@ -543,9 +537,6 @@ validate_arguments () - - - /* Check thresholds against value */ int check_thresholds (int value) @@ -580,9 +571,6 @@ check_thresholds (int value) - - - void print_help (void) { @@ -671,6 +659,8 @@ Examples:\n\ printf (_(UT_SUPPORT)); } + + void print_usage (void) { @@ -681,3 +671,4 @@ Usage: %s -w -c [-m metric] [-s state] [-p ppid]\n\ printf (_(UT_HLP_VRS), progname, progname); } + diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 725cf9f8..3e6bdcae 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_radius"; @@ -94,6 +96,8 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. -@@ ******************************************************************************/ + + int main (int argc, char **argv) { @@ -109,7 +113,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_radius: could not parse arguments\n")); str = strdup ("dictionary"); if ((config_file && rc_read_config (config_file)) || @@ -199,7 +203,7 @@ process_arguments (int argc, char **argv) if (is_intpos (argv[7])) port = atoi (argv[7]); else - usage (_("Server port must be a positive integer")); + usage (_("Port must be a positive integer")); expect = argv[8]; return OK; } @@ -227,7 +231,7 @@ process_arguments (int argc, char **argv) break; case 'H': /* hostname */ if (is_host (optarg) == FALSE) { - usage2 (_("Invalid host name/address"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } server = optarg; break; @@ -235,7 +239,7 @@ process_arguments (int argc, char **argv) if (is_intnonneg (optarg)) port = atoi (optarg); else - usage (_("Server port must be a positive integer")); + usage (_("Port must be a positive integer")); break; case 'u': /* username */ username = optarg; @@ -271,9 +275,6 @@ process_arguments (int argc, char **argv) - - - void print_help (void) { @@ -329,7 +330,6 @@ otherwise compormise could occur.\n")); - void print_usage (void) { diff --git a/plugins/check_real.c b/plugins/check_real.c index 755f6eb2..3686ff4b 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_real"; @@ -50,9 +52,6 @@ int verbose = FALSE; - - - int main (int argc, char **argv) { @@ -66,7 +65,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_real: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -251,9 +250,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -303,7 +299,7 @@ process_arguments (int argc, char **argv) else if (is_host (optarg)) server_address = optarg; else - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); break; case 'e': /* string to expect in response header */ server_expect = optarg; @@ -316,7 +312,7 @@ process_arguments (int argc, char **argv) server_port = atoi (optarg); } else { - usage (_("Server port must be a positive integer\n")); + usage (_("Port must be a positive integer\n")); } break; case 'w': /* warning time threshold */ @@ -325,7 +321,7 @@ process_arguments (int argc, char **argv) check_warning_time = TRUE; } else { - usage (_("Warning time must be a nonnegative integer\n")); + usage (_("Warning time must be a positive integer\n")); } break; case 'c': /* critical time threshold */ @@ -355,7 +351,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* usage */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -365,7 +363,7 @@ process_arguments (int argc, char **argv) server_address = argv[c++]; } else { - usage2 (_("Invalid host name"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } } @@ -383,8 +381,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -393,8 +389,6 @@ validate_arguments (void) - - void print_help (void) { @@ -439,8 +433,6 @@ values.")); - - void print_usage (void) { diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index ae3f88b1..696af656 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_smtp"; @@ -69,9 +71,6 @@ int verbose = 0; - - - int main (int argc, char **argv) { @@ -90,7 +89,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_smtp: could not parse arguments\n")); /* initialize the HELO command with the localhostname */ #ifndef HOST_MAX_BYTES @@ -238,9 +237,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -292,14 +288,14 @@ process_arguments (int argc, char **argv) server_address = optarg; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'p': /* port */ if (is_intpos (optarg)) server_port = atoi (optarg); else - usage (_("Server port must be a positive integer\n")); + usage (_("Port must be a positive integer\n")); break; case 'f': /* from argument */ from_arg = optarg; @@ -334,7 +330,7 @@ process_arguments (int argc, char **argv) check_critical_time = TRUE; } else { - usage (_("Critical time must be a nonnegative integer\n")); + usage (_("Critical time must be a positive integer\n")); } break; case 'w': /* warning time threshold */ @@ -343,7 +339,7 @@ process_arguments (int argc, char **argv) check_warning_time = TRUE; } else { - usage (_("Warning time must be a nonnegative integer\n")); + usage (_("Warning time must be a positive integer\n")); } break; case 'v': /* verbose */ @@ -354,7 +350,7 @@ process_arguments (int argc, char **argv) socket_timeout = atoi (optarg); } else { - usage (_("Time interval must be a nonnegative integer\n")); + usage (_("Time interval must be a positive integer\n")); } break; case '4': @@ -374,7 +370,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -384,7 +382,7 @@ process_arguments (int argc, char **argv) if (is_host (argv[c])) server_address = argv[c]; else - usage2 (_("Invalid host name"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } else { asprintf (&server_address, "127.0.0.1"); @@ -405,8 +403,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -415,9 +411,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -470,8 +463,6 @@ STATE_WARNING return values.\n")); - - void print_usage (void) { @@ -480,6 +471,3 @@ Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); printf (_(UT_HLP_VRS), progname, progname); } - - - diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 11ea9559..7d0ebc92 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_snmp"; @@ -118,9 +120,6 @@ char *miblist; - - - int main (int argc, char **argv) { @@ -158,7 +157,7 @@ main (int argc, char **argv) miblist = strdup (DEFAULT_MIBLIST); if (process_arguments (argc, argv) == ERROR) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_snmp: could not parse arguments\n")); /* create the command line to execute */ asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", @@ -344,9 +343,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -402,7 +398,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* usage */ - usage3 ("Unknown argument", optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); @@ -601,8 +599,6 @@ process_arguments (int argc, char **argv) } - - /****************************************************************************** @@- @@ -623,6 +619,8 @@ first character cannot be a number, however. -@@ ******************************************************************************/ + + int validate_arguments () { @@ -665,7 +663,6 @@ validate_arguments () asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); } - } else { printf (_("Invalid SNMP version: %s\n"), proto); @@ -673,17 +670,11 @@ validate_arguments () exit (STATE_UNKNOWN); } - - - return OK; } - - - char * clarify_message (char *msg) { @@ -721,7 +712,6 @@ clarify_message (char *msg) - int check_num (int i) { @@ -766,7 +756,6 @@ check_num (int i) - int lu_getll (unsigned long *ll, char *str) { @@ -782,7 +771,6 @@ lu_getll (unsigned long *ll, char *str) - int lu_getul (unsigned long *ul, char *str) { @@ -798,7 +786,6 @@ lu_getul (unsigned long *ul, char *str) - /* trim leading whitespace if there is a leading quote, make sure it balances */ @@ -815,7 +802,6 @@ thisarg (char *str) - /* if there's a leading quote, advance to the trailing quote set the trailing quote to '\x0' if the string continues, advance beyond the comma */ @@ -851,9 +837,6 @@ nextarg (char *str) - - - void print_help (void) { @@ -960,6 +943,8 @@ Check status of remote machines and obtain sustem information via SNMP\n\n")); printf (_(UT_SUPPORT)); } + + void print_usage (void) { diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index ea74fa88..b78443fe 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ #include "common.h" @@ -44,6 +46,8 @@ void print_usage (void); int ssh_connect (char *haddr, int hport, char *remote_version); + + int main (int argc, char **argv) { @@ -54,7 +58,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_ssh: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -69,6 +73,7 @@ main (int argc, char **argv) } + /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -104,8 +109,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ - usage (_("Unknow argument\n")); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'V': /* version */ print_revision (progname, revision); exit (STATE_OK); @@ -188,6 +194,7 @@ validate_arguments (void) * *-----------------------------------------------------------------------*/ + int ssh_connect (char *haddr, int hport, char *remote_version) { @@ -240,6 +247,8 @@ ssh_connect (char *haddr, int hport, char *remote_version) } } + + void print_help (void) { @@ -272,6 +281,8 @@ print_help (void) printf (_(UT_SUPPORT)); } + + void print_usage (void) { diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 3016e1ad..064c65e4 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -326,7 +326,6 @@ main (int argc, char **argv) - int check_swap (int usp, long unsigned int free_swap) { @@ -346,6 +345,7 @@ check_swap (int usp, long unsigned int free_swap) } + /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -420,7 +420,9 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* error */ - usage (_("Invalid argument\n")); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -450,8 +452,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -472,9 +472,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -514,7 +511,6 @@ On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n")); - void print_usage (void) { diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 7cef8bb9..285932d5 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ /* progname "check_tcp" changes depending on symlink called */ @@ -100,9 +102,6 @@ char *buffer; - - - int main (int argc, char **argv) { @@ -241,7 +240,7 @@ main (int argc, char **argv) status = strdup (""); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_tcp: could not parse arguments\n")); /* use default expect if none listed in process_arguments() */ if (EXPECT && server_expect_count == 0) { @@ -389,7 +388,6 @@ main (int argc, char **argv) return result; } - @@ -481,12 +479,12 @@ process_arguments (int argc, char **argv) break; case 'H': /* hostname */ if (is_host (optarg) == FALSE) - usage2 (_("invalid host name or address"), optarg); + usage2 (_("invalid hostname/address"), optarg); server_address = optarg; break; case 'c': /* critical */ if (!is_intnonneg (optarg)) - usage (_("Critical threshold must be a nonnegative integer\n")); + usage (_("Critical threshold must be a positive integer\n")); else critical_time = strtod (optarg, NULL); check_critical_time = TRUE; @@ -496,7 +494,7 @@ process_arguments (int argc, char **argv) break; case 'w': /* warning */ if (!is_intnonneg (optarg)) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else warning_time = strtod (optarg, NULL); check_warning_time = TRUE; @@ -517,7 +515,7 @@ process_arguments (int argc, char **argv) break; case 'p': /* port */ if (!is_intpos (optarg)) - usage (_("Server port must be a positive integer\n")); + usage (_("Port must be a positive integer\n")); else server_port = atoi (optarg); break; @@ -548,7 +546,7 @@ process_arguments (int argc, char **argv) else if (!strncmp(optarg,"crit",4)) econn_refuse_state = STATE_CRITICAL; else - usage (_("Refuse mut be one of ok, warn, crit\n")); + usage (_("Refuse must be one of ok, warn, crit\n")); break; case 'd': if (is_intpos (optarg)) @@ -578,7 +576,8 @@ process_arguments (int argc, char **argv) return OK; } - + + #ifdef HAVE_SSL int @@ -634,6 +633,8 @@ connect_SSL (void) } #endif + + #ifdef HAVE_SSL int check_certificate (X509 ** certificate) @@ -710,6 +711,8 @@ check_certificate (X509 ** certificate) } #endif + + int my_recv (void) { @@ -731,9 +734,6 @@ my_recv (void) - - - void print_help (void) { @@ -790,7 +790,6 @@ print_help (void) - void print_usage (void) { diff --git a/plugins/check_time.c b/plugins/check_time.c index 314b7683..617b9e02 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ #include "common.h" @@ -61,7 +63,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + usage (_("check_time: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -168,9 +170,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -217,7 +216,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* print short usage statement if args not parsable */ - usage3 (_("Unknown argument"), optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); @@ -226,7 +227,7 @@ process_arguments (int argc, char **argv) exit (STATE_OK); case 'H': /* hostname */ if (is_host (optarg) == FALSE) - usage2 (_("Invalid host name/address"), optarg); + usage2 (_("Invalid hostname/address"), optarg); server_address = optarg; break; case 'w': /* warning-variance */ @@ -240,11 +241,11 @@ process_arguments (int argc, char **argv) check_warning_time = TRUE; } else { - usage (_("Warning thresholds must be a nonnegative integer\n")); + usage (_("Warning thresholds must be a positive integer\n")); } } else { - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); } break; case 'c': /* critical-variance */ @@ -259,30 +260,30 @@ process_arguments (int argc, char **argv) check_critical_time = TRUE; } else { - usage (_("Critical thresholds must be a nonnegative integer\n")); + usage (_("Critical thresholds must be a positive integer\n")); } } else { - usage (_("Critical threshold must be a nonnegative integer\n")); + usage (_("Critical threshold must be a positive integer\n")); } break; case 'W': /* warning-connect */ if (!is_intnonneg (optarg)) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else warning_time = atoi (optarg); check_warning_time = TRUE; break; case 'C': /* critical-connect */ if (!is_intnonneg (optarg)) - usage (_("Critical threshold must be a nonnegative integer\n")); + usage (_("Critical threshold must be a positive integer\n")); else critical_time = atoi (optarg); check_critical_time = TRUE; break; case 'p': /* port */ if (!is_intnonneg (optarg)) - usage (_("Server port must be a nonnegative integer\n")); + usage (_("Port must be a positive integer\n")); else server_port = atoi (optarg); break; @@ -301,11 +302,11 @@ process_arguments (int argc, char **argv) if (server_address == NULL) { if (argc > c) { if (is_host (argv[c]) == FALSE) - usage2 (_("Invalid host name/address"), optarg); + usage2 (_("Invalid hostname/address"), optarg); server_address = argv[c]; } else { - usage (_("Host name was not supplied\n")); + usage (_("Hostname was not supplied\n")); } } @@ -314,9 +315,6 @@ process_arguments (int argc, char **argv) - - - void print_help (void) { @@ -356,7 +354,6 @@ This plugin will check the time on the specified host.\n\n")); - void print_usage (void) { diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 05ade04e..64ab83a7 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ const char *progname = "check_udp"; @@ -50,7 +52,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage ("\n"); + usage (_("check_udp: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -102,7 +104,6 @@ main (int argc, char **argv) - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -158,19 +159,19 @@ process_arguments (int argc, char **argv) break; case 'H': /* hostname */ if (is_host (optarg) == FALSE) - usage2 (_("Invalid host name/address"), optarg); + usage2 (_("Invalid hostname/address"), optarg); server_address = optarg; break; case 'c': /* critical */ if (!is_intnonneg (optarg)) - usage (_("Critical threshold must be a nonnegative integer\n")); + usage (_("Critical threshold must be a positive integer\n")); else critical_time = atoi (optarg); check_critical_time = TRUE; break; case 'w': /* warning */ if (!is_intnonneg (optarg)) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else warning_time = atoi (optarg); check_warning_time = TRUE; @@ -183,7 +184,7 @@ process_arguments (int argc, char **argv) break; case 'p': /* port */ if (!is_intnonneg (optarg)) - usage (_("Server port must be a nonnegative integer\n")); + usage (_("Port must be a positive integer\n")); else server_port = atoi (optarg); break; @@ -199,7 +200,7 @@ process_arguments (int argc, char **argv) c = optind; if (server_address == NULL && c < argc && argv[c]) { if (is_host (argv[c]) == FALSE) - usage2 (_("Invalid host name/address"), optarg); + usage2 (_("Invalid hostname/address"), optarg); server_address = argv[c++]; } @@ -214,9 +215,6 @@ process_arguments (int argc, char **argv) - - - void print_help (void) { diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 33cba770..7f88ec30 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_ups"; @@ -90,7 +92,7 @@ main (int argc, char **argv) data = strdup (""); if (process_arguments (argc, argv) != OK) - usage ("Invalid command arguments supplied\n"); + usage (_("check_ups: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -287,7 +289,7 @@ determine_status (void) if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != STATE_OK) { - printf ("Invalid response received from hostn"); + printf ("Invalid response received from host\n"); return ERROR; } @@ -419,8 +421,6 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) - - /* Command line: CHECK_UPS [-u ups] [-p port] [-v variable] [-wv warn_value] [-cv crit_value] [-to to_sec] */ @@ -466,13 +466,15 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ - usage3 ("Unknown option", optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'H': /* hostname */ if (is_host (optarg)) { server_address = optarg; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'u': /* ups name */ @@ -483,7 +485,7 @@ process_arguments (int argc, char **argv) server_port = atoi (optarg); } else { - usage2 ("Server port must be a positive integer", optarg); + usage2 ("Port must be a positive integer", optarg); } break; case 'c': /* critical time threshold */ @@ -492,7 +494,7 @@ process_arguments (int argc, char **argv) check_crit = TRUE; } else { - usage2 ("Critical time must be a nonnegative integer", optarg); + usage2 ("Critical time must be a positive integer", optarg); } break; case 'w': /* warning time threshold */ @@ -501,7 +503,7 @@ process_arguments (int argc, char **argv) check_warn = TRUE; } else { - usage2 ("Warning time must be a nonnegative integer", optarg); + usage2 ("Warning time must be a positive integer", optarg); } break; case 'v': /* variable */ @@ -521,11 +523,11 @@ process_arguments (int argc, char **argv) socket_timeout = atoi (optarg); } else { - usage ("Time interval must be a nonnegative integer\n"); + usage ("Time interval must be a positive integer\n"); } break; case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); @@ -538,7 +540,7 @@ process_arguments (int argc, char **argv) if (is_host (argv[optind])) server_address = argv[optind++]; else - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } if (server_address == NULL) @@ -549,8 +551,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -559,9 +559,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -617,7 +614,6 @@ http://www.exploits.org/nut\n\n")); - void print_usage (void) { diff --git a/plugins/check_users.c b/plugins/check_users.c index 377a11a6..0417bad1 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + *****************************************************************************/ const char *progname = "check_users"; @@ -49,7 +51,7 @@ main (int argc, char **argv) perf = strdup(""); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("check_users: could not parse arguments\n")); /* run the command */ child_process = spopen (WHO_COMMAND); @@ -112,8 +114,6 @@ main (int argc, char **argv) - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -151,13 +151,13 @@ process_arguments (int argc, char **argv) exit (STATE_OK); case 'c': /* critical */ if (!is_intnonneg (optarg)) - usage (_("Critical threshold must be a nonnegative integer\n")); + usage (_("Critical threshold must be a positive integer\n")); else cusers = atoi (optarg); break; case 'w': /* warning */ if (!is_intnonneg (optarg)) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else wusers = atoi (optarg); break; @@ -167,14 +167,14 @@ process_arguments (int argc, char **argv) c = optind; if (wusers == -1 && argc > c) { if (is_intnonneg (argv[c]) == FALSE) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else wusers = atoi (argv[c++]); } if (cusers == -1 && argc > c) { if (is_intnonneg (argv[c]) == FALSE) - usage (_("Warning threshold must be a nonnegative integer\n")); + usage (_("Warning threshold must be a positive integer\n")); else cusers = atoi (argv[c]); } @@ -184,9 +184,6 @@ process_arguments (int argc, char **argv) - - - void print_help (void) { @@ -214,7 +211,6 @@ system and generates an error if the number exceeds the thresholds specified.\n" - void print_usage (void) { diff --git a/plugins/common.h b/plugins/common.h index fb8ca9c6..e3f150f9 100644 --- a/plugins/common.h +++ b/plugins/common.h @@ -28,6 +28,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * + * $Id$ + * *****************************************************************************/ #include "config.h" diff --git a/plugins/getaddrinfo.c b/plugins/getaddrinfo.c index 12ac67d6..56978208 100644 --- a/plugins/getaddrinfo.c +++ b/plugins/getaddrinfo.c @@ -22,6 +22,8 @@ */ /* An emulation of the RFC 2553 / Posix getaddrinfo resolver interface. + * + * $Id$ */ #ifdef HAVE_CONFIG_H diff --git a/plugins/getaddrinfo.h b/plugins/getaddrinfo.h index 5bcc8844..d4115245 100644 --- a/plugins/getaddrinfo.h +++ b/plugins/getaddrinfo.h @@ -23,7 +23,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Structure and prototypes aken from RFC 2553 */ +/* Structure and prototypes aken from RFC 2553 + * + * $Id$ + */ struct addrinfo { diff --git a/plugins/gethostbyname.c b/plugins/gethostbyname.c index d151606d..d1b768bc 100644 --- a/plugins/gethostbyname.c +++ b/plugins/gethostbyname.c @@ -17,6 +17,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ */ #ifdef HAVE_CONFIG_H diff --git a/plugins/gethostbyname.h b/plugins/gethostbyname.h index 2b963997..e420837d 100644 --- a/plugins/gethostbyname.h +++ b/plugins/gethostbyname.h @@ -17,6 +17,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ */ /************************************************************************* diff --git a/plugins/negate.c b/plugins/negate.c index a71f1b67..9e5cf46f 100644 --- a/plugins/negate.c +++ b/plugins/negate.c @@ -13,6 +13,8 @@ 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. + + $Id$ @@-
@@ -69,6 +71,8 @@ int validate_arguments (void); void print_help (void); void print_usage (void); + + int main (int argc, char **argv) { @@ -80,7 +84,7 @@ main (int argc, char **argv) textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) - usage (_("Could not parse arguments\n")); + usage (_("negate: could not parse arguments\n")); /* Set signal handling and alarm */ if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) @@ -125,8 +129,6 @@ main (int argc, char **argv) else exit (result); } - - /****************************************************************************** @@- @@ -146,6 +148,8 @@ is a only a 'timeout' option. -@@ ******************************************************************************/ + + /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -169,7 +173,9 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ - usage3 (_("Unknown argument"), optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); break; case 'h': /* help */ print_help (); @@ -207,6 +213,8 @@ process_arguments (int argc, char **argv) -@@ ******************************************************************************/ + + int validate_arguments () { @@ -225,9 +233,6 @@ validate_arguments () - - - void print_help (void) { @@ -265,8 +270,6 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n")); - - void print_usage (void) { diff --git a/plugins/netutils.c b/plugins/netutils.c index aee53d35..6702b13f 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c @@ -27,6 +27,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * +* $Id$ +* ****************************************************************************/ #include "common.h" @@ -104,7 +106,7 @@ process_tcp_request2 (const char *server_address, int server_port, send_result = send (sd, send_buffer, strlen (send_buffer), 0); if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { - printf ("send() failed\n"); + printf ("Send failed\n"); result = STATE_WARNING; } @@ -313,7 +315,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int send_result = send (sd, send_buffer, strlen (send_buffer), 0); if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { - printf ("send() failed\n"); + printf ("Send failed\n"); result = STATE_WARNING; } @@ -337,7 +339,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int if (recv_result == -1) { strcpy (recv_buffer, ""); if (proto != IPPROTO_TCP) - printf ("recv() failed\n"); + printf ("Receive failed\n"); result = STATE_WARNING; } else diff --git a/plugins/netutils.h b/plugins/netutils.h index b2c2a2f5..2f31bdc8 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h @@ -28,6 +28,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * +* $Id$ +* ******************************************************************************/ #include "config.h" diff --git a/plugins/popen.c b/plugins/popen.c index 05fd0ab9..d527c222 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -16,6 +16,8 @@ int spclose(FILE *); * path passed to the exec'd program are esstially empty. (popen create a shell * and passes the environment to it). * + * $Id$ + * ******************************************************************************/ #include "common.h" diff --git a/plugins/urlize.c b/plugins/urlize.c index d3d97b5a..9973c1a3 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "urlize"; @@ -69,8 +71,9 @@ main (int argc, char **argv) break; case '?': default: - usage3 (_("Unknown argument"), optopt); - break; + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); } } @@ -121,9 +124,6 @@ main (int argc, char **argv) - - - void print_help (void) { @@ -159,7 +159,6 @@ You probably want:\n\ - void print_usage (void) { diff --git a/plugins/utils.c b/plugins/utils.c index bb380301..460ff824 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -315,9 +315,6 @@ strip (char *buffer) } - - - /****************************************************************************** * * Copies one string to another. Any previously existing data in @@ -343,8 +340,6 @@ strscpy (char *dest, const char *src) - - /****************************************************************************** * * Returns a pointer to the next line of a multiline string buffer @@ -414,9 +409,6 @@ strnl (char *str) } - - - /****************************************************************************** * * Like strscpy, except only the portion of the source string up to @@ -456,8 +448,6 @@ strpcpy (char *dest, const char *src, const char *str) - - /****************************************************************************** * * Like strscat, except only the portion of the source string up to @@ -499,8 +489,6 @@ strpcat (char *dest, const char *src, const char *str) } - - /****************************************************************************** * * Print perfdata in a standard format diff --git a/plugins/utils.h b/plugins/utils.h index 35e62ab4..a3ddc0a2 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -13,6 +13,8 @@ suite of plugins. */ /* Standardize version information, termination */ +/* $Id$ */ + void support (void); char *clean_revstring (const char *revstring); void print_revision (const char *, const char *); -- cgit v1.2.3