From 28553e8d1cc56de12e4c9f7705a92f0e0e86d9d9 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:15:49 +0100 Subject: Fix unknown escape sequence error output --- plugins/check_apt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/check_apt.c') diff --git a/plugins/check_apt.c b/plugins/check_apt.c index d7be5750..f70fec16 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -530,7 +530,7 @@ print_help (void) printf (" %s\n", _("this REGEXP, the plugin will return CRITICAL status. Can be specified")); printf (" %s\n", _("multiple times like above. Default is a regexp matching security")); printf (" %s\n", _("upgrades for Debian and Ubuntu:")); - printf (" \t\%s\n", SECURITY_RE); + printf (" \t%s\n", SECURITY_RE); printf (" %s\n", _("Note that the package must first match the include list before its")); printf (" %s\n", _("information is compared against the critical list.")); printf (" %s\n", "-o, --only-critical"); -- cgit v1.2.3-74-g34f1 From 0551151a578dd5da1dbf0ae2e5c5224c491bf0c9 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:16:00 +0100 Subject: Remove trailing whitespaces --- plugins/check_apt.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'plugins/check_apt.c') diff --git a/plugins/check_apt.c b/plugins/check_apt.c index f70fec16..af3563a1 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -1,32 +1,32 @@ /***************************************************************************** -* +* * Monitoring check_apt plugin -* +* * License: GPL * Copyright (c) 2006-2008 Monitoring Plugins Development Team -* +* * Original author: Sean Finney -* +* * Description: -* +* * This file contains the check_apt plugin -* +* * Check for available updates in apt package management systems -* -* +* +* * 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 3 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, see . -* +* *****************************************************************************/ const char *progname = "check_apt"; @@ -269,7 +269,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkg die(STATE_UNKNOWN, _("%s: Error compiling regexp: %s"), progname, rerrbuf); } } - + if(do_exclude!=NULL){ regres=regcomp(&ereg, do_exclude, REG_EXTENDED); if(regres!=0) { @@ -278,7 +278,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkg progname, rerrbuf); } } - + const char *crit_ptr = (do_critical != NULL) ? do_critical : SECURITY_RE; regres=regcomp(&sreg, crit_ptr, REG_EXTENDED); if(regres!=0) { @@ -295,7 +295,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount, char ***pkglist, char ***secpkg /* run the upgrade */ result = np_runcmd(cmdline, &chld_out, &chld_err, 0); } - + /* apt-get upgrade only changes exit status if there is an * internal error when run in dry-run mode. therefore we will * treat such an error as UNKNOWN */ -- cgit v1.2.3-74-g34f1 From 0899e41f5075d661153eb2c77ace1734a8f66bfa Mon Sep 17 00:00:00 2001 From: Lorenz <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 8 Jan 2023 17:23:53 +0100 Subject: Check apt usage (#1793) * Remove trailing whitespaces * Use real booleans * Fix comment * Put upgrade options in the root sections Co-authored-by: waja --- plugins/check_apt.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'plugins/check_apt.c') diff --git a/plugins/check_apt.c b/plugins/check_apt.c index af3563a1..312909b7 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -76,9 +76,9 @@ int cmpstringp(const void *p1, const void *p2); /* configuration variables */ static int verbose = 0; /* -v */ -static int list = 0; /* list packages available for upgrade */ -static int do_update = 0; /* whether to call apt-get update */ -static int only_critical = 0; /* whether to warn about non-critical updates */ +static bool list = false; /* list packages available for upgrade */ +static bool do_update = false; /* whether to call apt-get update */ +static bool only_critical = false; /* whether to warn about non-critical updates */ static upgrade_type upgrade = UPGRADE; /* which type of upgrade to do */ static char *upgrade_opts = NULL; /* options to override defaults for upgrade */ static char *update_opts = NULL; /* options to override defaults for update */ @@ -119,7 +119,7 @@ int main (int argc, char **argv) { if(sec_count > 0){ result = max_state(result, STATE_CRITICAL); - } else if(packages_available >= packages_warning && only_critical == 0){ + } else if(packages_available >= packages_warning && only_critical == false){ result = max_state(result, STATE_WARNING); } else if(result > STATE_UNKNOWN){ result = STATE_UNKNOWN; @@ -144,7 +144,7 @@ int main (int argc, char **argv) { for(i = 0; i < sec_count; i++) printf("%s (security)\n", secpackages_list[i]); - if (only_critical == 0) { + if (only_critical == false) { for(i = 0; i < packages_available - sec_count; i++) printf("%s\n", packages_list[i]); } @@ -166,7 +166,7 @@ int process_arguments (int argc, char **argv) { {"upgrade", optional_argument, 0, 'U'}, {"no-upgrade", no_argument, 0, 'n'}, {"dist-upgrade", optional_argument, 0, 'd'}, - {"list", no_argument, 0, 'l'}, + {"list", no_argument, false, 'l'}, {"include", required_argument, 0, 'i'}, {"exclude", required_argument, 0, 'e'}, {"critical", required_argument, 0, 'c'}, @@ -212,14 +212,14 @@ int process_arguments (int argc, char **argv) { upgrade=NO_UPGRADE; break; case 'u': - do_update=1; + do_update=true; if(optarg!=NULL){ update_opts=strdup(optarg); if(update_opts==NULL) die(STATE_UNKNOWN, "strdup failed"); } break; case 'l': - list=1; + list=true; break; case 'i': do_include=add_to_regexp(do_include, optarg); @@ -231,7 +231,7 @@ int process_arguments (int argc, char **argv) { do_critical=add_to_regexp(do_critical, optarg); break; case 'o': - only_critical=1; + only_critical=true; break; case INPUT_FILE_OPT: input_filename = optarg; @@ -371,7 +371,7 @@ int run_update(void){ struct output chld_out, chld_err; char *cmdline; - /* run the upgrade */ + /* run the update */ cmdline = construct_cmdline(NO_UPGRADE, update_opts); result = np_runcmd(cmdline, &chld_out, &chld_err, 0); /* apt-get update changes exit status if it can't fetch packages. @@ -501,16 +501,6 @@ print_help (void) printf(UT_PLUG_TIMEOUT, timeout_interval); - printf (" %s\n", "-U, --upgrade=OPTS"); - printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,")); - printf (" %s\n", _("apt-get will be run with these command line options instead of the")); - printf (" %s", _("default ")); - printf ("(%s).\n", UPGRADE_DEFAULT_OPTS); - printf (" %s\n", _("Note that you may be required to have root privileges if you do not use")); - printf (" %s\n", _("the default options.")); - printf (" %s\n", "-d, --dist-upgrade=OPTS"); - printf (" %s\n", _("Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS")); - printf (" %s\n", _("can be provided to override the default options.")); printf (" %s\n", "-n, --no-upgrade"); printf (" %s\n", _("Do not run the upgrade. Probably not useful (without -u at least).")); printf (" %s\n", "-l, --list"); @@ -547,6 +537,16 @@ print_help (void) printf (" %s\n", _("the default options. Note: you may also need to adjust the global")); printf (" %s\n", _("timeout (with -t) to prevent the plugin from timing out if apt-get")); printf (" %s\n", _("upgrade is expected to take longer than the default timeout.")); + printf (" %s\n", "-U, --upgrade=OPTS"); + printf (" %s\n", _("Perform an upgrade. If an optional OPTS argument is provided,")); + printf (" %s\n", _("apt-get will be run with these command line options instead of the")); + printf (" %s", _("default ")); + printf ("(%s).\n", UPGRADE_DEFAULT_OPTS); + printf (" %s\n", _("Note that you may be required to have root privileges if you do not use")); + printf (" %s\n", _("the default options, which will only run a simulation and NOT perform the upgrade")); + printf (" %s\n", "-d, --dist-upgrade=OPTS"); + printf (" %s\n", _("Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS")); + printf (" %s\n", _("can be provided to override the default options.")); printf(UT_SUPPORT); } -- cgit v1.2.3-74-g34f1 From 72147140ed6c9a06db722930e893c90a230e6da9 Mon Sep 17 00:00:00 2001 From: waja Date: Tue, 17 Jan 2023 15:42:54 +0100 Subject: Fixing spelling errors (#1826) --- plugins/check_apt.c | 2 +- plugins/check_curl.c | 2 +- plugins/check_fping.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/check_apt.c') diff --git a/plugins/check_apt.c b/plugins/check_apt.c index 312909b7..fa982ae3 100644 --- a/plugins/check_apt.c +++ b/plugins/check_apt.c @@ -528,7 +528,7 @@ print_help (void) printf (" %s\n", _("of upgrades will be printed, but any non-critical upgrades will not cause")); printf (" %s\n", _("the plugin to return WARNING status.")); printf (" %s\n", "-w, --packages-warning"); - printf (" %s\n", _("Minumum number of packages available for upgrade to return WARNING status.")); + printf (" %s\n", _("Minimum number of packages available for upgrade to return WARNING status.")); printf (" %s\n\n", _("Default is 1 package.")); printf ("%s\n\n", _("The following options require root privileges and should be used with care:")); diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 55de22fd..c6593df1 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -1680,7 +1680,7 @@ process_arguments (int argc, char **argv) curl_http_version = CURL_HTTP_VERSION_NONE; #endif /* LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 33, 0) */ } else { - fprintf (stderr, "unkown http-version parameter: %s\n", optarg); + fprintf (stderr, "unknown http-version parameter: %s\n", optarg); exit (STATE_WARNING); } break; diff --git a/plugins/check_fping.c b/plugins/check_fping.c index be9362ad..db433162 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -492,7 +492,7 @@ void print_help (void) { printf (" %s\n", "-c, --critical=THRESHOLD"); printf (" %s\n", _("critical threshold pair")); printf (" %s\n", "-a, --alive"); - printf (" %s\n", _("Return OK after first successfull reply")); + printf (" %s\n", _("Return OK after first successful reply")); printf (" %s\n", "-b, --bytes=INTEGER"); printf (" %s (default: %d)\n", _("size of ICMP packet"),PACKET_SIZE); printf (" %s\n", "-n, --number=INTEGER"); -- cgit v1.2.3-74-g34f1