summaryrefslogtreecommitdiffstats
path: root/web/attachments/357353-interdiff.txt
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/357353-interdiff.txt')
-rw-r--r--web/attachments/357353-interdiff.txt107
1 files changed, 107 insertions, 0 deletions
diff --git a/web/attachments/357353-interdiff.txt b/web/attachments/357353-interdiff.txt
new file mode 100644
index 0000000..aaf3299
--- /dev/null
+++ b/web/attachments/357353-interdiff.txt
@@ -0,0 +1,107 @@
1--- nagios-plugins-1.4.13+git200906171200.orig/plugins/check_disk.c
2+++ nagios-plugins-1.4.13+git200906171200/plugins/check_disk.c
3@@ -3,7 +3,7 @@
4 * Nagios check_disk plugin
5 *
6 * License: GPL
7-* Copyright (c) 1999-2008 Nagios Plugins Development Team
8+* Copyright (c) 1999-2010 Nagios Plugins Development Team
9 *
10 * Description:
11 *
12@@ -28,7 +28,7 @@
13
14 const char *progname = "check_disk";
15 const char *program_name = "check_disk"; /* Required for coreutils libs */
16-const char *copyright = "1999-2008";
17+const char *copyright = "1999-2010";
18 const char *email = "nagiosplug-devel@lists.sourceforge.net";
19
20
21@@ -51,6 +51,7 @@
22 # include <limits.h>
23 #endif
24 #include "regex.h"
25+#include "human.h"
26
27
28 /* If nonzero, show inode information. */
29@@ -129,6 +130,7 @@
30 char *exclude_device;
31 char *units;
32 uintmax_t mult = 1024 * 1024;
33+int human_readable_units = FALSE;
34 int verbose = 0;
35 int erronly = FALSE;
36 int display_mntp = FALSE;
37@@ -167,6 +169,8 @@
38 double warning_high_tide;
39 double critical_high_tide;
40 int temp_result;
41+ char buf[LONGEST_HUMAN_READABLE];
42+ int human_opts = human_suppress_point_zero | human_autoscale | human_SI | human_group_digits | human_base_1024;
43
44 struct mount_entry *me;
45 struct fs_usage fsp, tmpfsp;
46@@ -389,12 +393,19 @@
47 if (disk_result==STATE_OK && erronly && !verbose)
48 continue;
49
50- asprintf (&output, "%s %s %.0f %s (%.0f%%",
51- output,
52- (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
53- dfree_units,
54- units,
55- dfree_pct);
56+ if (human_readable_units)
57+ asprintf (&output, "%s %s %s (%.0f%%",
58+ output,
59+ (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
60+ human_readable (available, buf, human_opts, fsp.fsu_blocksize, 1),
61+ dfree_pct);
62+ else
63+ asprintf (&output, "%s %s %.0f %s (%.0f%%",
64+ output,
65+ (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
66+ dfree_units,
67+ units,
68+ dfree_pct);
69 if (dused_inodes_percent < 0) {
70 asprintf(&output, "%s inode=-);", output);
71 } else {
72@@ -473,6 +484,7 @@
73 {"kilobytes", no_argument, 0, 'k'},
74 {"megabytes", no_argument, 0, 'm'},
75 {"units", required_argument, 0, 'u'},
76+ {"human-readable", no_argument, 0, 'Z'},
77 {"path", required_argument, 0, 'p'},
78 {"partition", required_argument, 0, 'p'},
79 {"exclude_device", required_argument, 0, 'x'},
80@@ -601,6 +613,9 @@
81 if (units == NULL)
82 die (STATE_UNKNOWN, _("failed allocating storage for '%s'\n"), "units");
83 break;
84+ case 'Z': /* human readable */
85+ human_readable_units = TRUE;
86+ break;
87 case 'k': /* display mountpoint */
88 mult = 1024;
89 if (units)
90@@ -958,6 +973,8 @@
91 printf (_(UT_VERBOSE));
92 printf (" %s\n", "-X, --exclude-type=TYPE");
93 printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
94+ printf (" %s\n", "--human-readable");
95+ printf (" %s\n", _("Print sizes in human readable format (e.g., 1K 234M 2G)"));
96
97 #ifdef NP_EXTRA_OPTS
98 printf ("\n");
99@@ -986,7 +1003,7 @@
100 printf (_("Usage:"));
101 printf (" %s -w limit -c limit [-W limit] [-K limit] {-p path | -x device}\n", progname);
102 printf ("[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]\n");
103- printf ("[-t timeout] [-u unit] [-v] [-X type]\n");
104+ printf ("[-t timeout] [-u unit] [-v] [-X type] [--human-readable]\n");
105 }
106
107 void