diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-08 05:09:40 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-08 05:09:40 +0000 |
commit | a9f992033fc32c0cca125e80d3d96aacfc78b802 (patch) | |
tree | bad34ea7077716b4b074ee66ba3259097a4f3108 /plugins/check_dig.c | |
parent | 65ca899d2c98b6342783922a5709c4b61e6b2b1f (diff) | |
download | monitoring-plugins-a9f992033fc32c0cca125e80d3d96aacfc78b802.tar.gz |
fix a variety of compiler warnings about qualifier discards and other pedantic stuff
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@663 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_dig.c')
-rw-r--r-- | plugins/check_dig.c | 141 |
1 files changed, 79 insertions, 62 deletions
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 3d82298f..7c39a243 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -1,22 +1,21 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * | 2 | |
3 | * This program is free software; you can redistribute it and/or modify | 3 | This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by | 4 | it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or | 5 | the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. | 6 | (at your option) any later version. |
7 | * | 7 | |
8 | * This program is distributed in the hope that it will be useful, | 8 | This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. | 11 | GNU General Public License for more details. |
12 | * | 12 | |
13 | * You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software | 14 | along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | * | 16 | |
17 | *****************************************************************************/ | 17 | *****************************************************************************/ |
18 | 18 | ||
19 | #include "config.h" | ||
20 | #include "common.h" | 19 | #include "common.h" |
21 | #include "netutils.h" | 20 | #include "netutils.h" |
22 | #include "utils.h" | 21 | #include "utils.h" |
@@ -36,50 +35,6 @@ enum { | |||
36 | DEFAULT_PORT = 53 | 35 | DEFAULT_PORT = 53 |
37 | }; | 36 | }; |
38 | 37 | ||
39 | void | ||
40 | print_usage (void) | ||
41 | { | ||
42 | printf (_("\ | ||
43 | Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\ | ||
44 | [-c <critical interval>] [-t <timeout>] [-v]\n"), | ||
45 | progname); | ||
46 | printf (" %s (-h|--help)\n", progname); | ||
47 | printf (" %s (-V|--version)\n", progname); | ||
48 | } | ||
49 | |||
50 | void | ||
51 | print_help (void) | ||
52 | { | ||
53 | char *myport; | ||
54 | |||
55 | asprintf (&myport, "%d", DEFAULT_PORT); | ||
56 | |||
57 | print_revision (progname, revision); | ||
58 | |||
59 | printf (_(COPYRIGHT), copyright, email); | ||
60 | |||
61 | printf (_("Test the DNS service on the specified host using dig\n\n")); | ||
62 | |||
63 | print_usage (); | ||
64 | |||
65 | printf (_(UT_HELP_VRSN)); | ||
66 | |||
67 | printf (_(UT_HOST_PORT), 'P', myport); | ||
68 | |||
69 | printf (_("\ | ||
70 | -l, --lookup=STRING\n\ | ||
71 | machine name to lookup\n")); | ||
72 | |||
73 | printf (_(UT_WARN_CRIT)); | ||
74 | |||
75 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
76 | |||
77 | printf (_(UT_VERBOSE)); | ||
78 | |||
79 | support (); | ||
80 | } | ||
81 | |||
82 | |||
83 | char *query_address = NULL; | 38 | char *query_address = NULL; |
84 | char *dns_server = NULL; | 39 | char *dns_server = NULL; |
85 | int verbose = FALSE; | 40 | int verbose = FALSE; |
@@ -88,14 +43,20 @@ int warning_interval = -1; | |||
88 | int critical_interval = -1; | 43 | int critical_interval = -1; |
89 | 44 | ||
90 | 45 | ||
46 | |||
47 | |||
48 | |||
49 | |||
91 | int | 50 | int |
92 | main (int argc, char **argv) | 51 | main (int argc, char **argv) |
93 | { | 52 | { |
94 | char input_buffer[MAX_INPUT_BUFFER]; | 53 | char input_buffer[MAX_INPUT_BUFFER]; |
95 | char *command_line = NULL; | 54 | char *command_line; |
96 | char *output = ""; | 55 | char *output; |
97 | int result = STATE_UNKNOWN; | 56 | int result = STATE_UNKNOWN; |
98 | 57 | ||
58 | output = strdup (""); | ||
59 | |||
99 | /* Set signal handling and alarm */ | 60 | /* Set signal handling and alarm */ |
100 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) | 61 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) |
101 | usage (_("Cannot catch SIGALRM\n")); | 62 | usage (_("Cannot catch SIGALRM\n")); |
@@ -188,6 +149,11 @@ main (int argc, char **argv) | |||
188 | return result; | 149 | return result; |
189 | } | 150 | } |
190 | 151 | ||
152 | |||
153 | |||
154 | |||
155 | |||
156 | |||
191 | /* process command-line arguments */ | 157 | /* process command-line arguments */ |
192 | int | 158 | int |
193 | process_arguments (int argc, char **argv) | 159 | process_arguments (int argc, char **argv) |
@@ -298,4 +264,55 @@ validate_arguments (void) | |||
298 | { | 264 | { |
299 | return OK; | 265 | return OK; |
300 | } | 266 | } |
267 | |||
268 | |||
269 | |||
270 | |||
271 | |||
272 | |||
301 | 273 | ||
274 | void | ||
275 | print_help (void) | ||
276 | { | ||
277 | char *myport; | ||
278 | |||
279 | asprintf (&myport, "%d", DEFAULT_PORT); | ||
280 | |||
281 | print_revision (progname, revision); | ||
282 | |||
283 | printf (_(COPYRIGHT), copyright, email); | ||
284 | |||
285 | printf (_("Test the DNS service on the specified host using dig\n\n")); | ||
286 | |||
287 | print_usage (); | ||
288 | |||
289 | printf (_(UT_HELP_VRSN)); | ||
290 | |||
291 | printf (_(UT_HOST_PORT), 'P', myport); | ||
292 | |||
293 | printf (_("\ | ||
294 | -l, --lookup=STRING\n\ | ||
295 | machine name to lookup\n")); | ||
296 | |||
297 | printf (_(UT_WARN_CRIT)); | ||
298 | |||
299 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
300 | |||
301 | printf (_(UT_VERBOSE)); | ||
302 | |||
303 | support (); | ||
304 | } | ||
305 | |||
306 | |||
307 | |||
308 | |||
309 | void | ||
310 | print_usage (void) | ||
311 | { | ||
312 | printf (_("\ | ||
313 | Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\ | ||
314 | [-c <critical interval>] [-t <timeout>] [-v]\n"), | ||
315 | progname); | ||
316 | printf (" %s (-h|--help)\n", progname); | ||
317 | printf (" %s (-V|--version)\n", progname); | ||
318 | } | ||