summaryrefslogtreecommitdiffstats
path: root/plugins/check_smtp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r--plugins/check_smtp.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index ae3f88b..696af65 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -14,6 +14,8 @@
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 $Id$
18
17******************************************************************************/ 19******************************************************************************/
18 20
19const char *progname = "check_smtp"; 21const char *progname = "check_smtp";
@@ -69,9 +71,6 @@ int verbose = 0;
69 71
70 72
71 73
72
73
74
75int 74int
76main (int argc, char **argv) 75main (int argc, char **argv)
77{ 76{
@@ -90,7 +89,7 @@ main (int argc, char **argv)
90 textdomain (PACKAGE); 89 textdomain (PACKAGE);
91 90
92 if (process_arguments (argc, argv) != OK) 91 if (process_arguments (argc, argv) != OK)
93 usage (_("Incorrect arguments supplied\n")); 92 usage (_("check_smtp: could not parse arguments\n"));
94 93
95 /* initialize the HELO command with the localhostname */ 94 /* initialize the HELO command with the localhostname */
96#ifndef HOST_MAX_BYTES 95#ifndef HOST_MAX_BYTES
@@ -238,9 +237,6 @@ main (int argc, char **argv)
238 237
239 238
240 239
241
242
243
244/* process command-line arguments */ 240/* process command-line arguments */
245int 241int
246process_arguments (int argc, char **argv) 242process_arguments (int argc, char **argv)
@@ -292,14 +288,14 @@ process_arguments (int argc, char **argv)
292 server_address = optarg; 288 server_address = optarg;
293 } 289 }
294 else { 290 else {
295 usage2 (_("Invalid host name"), optarg); 291 usage2 (_("Invalid hostname/address"), optarg);
296 } 292 }
297 break; 293 break;
298 case 'p': /* port */ 294 case 'p': /* port */
299 if (is_intpos (optarg)) 295 if (is_intpos (optarg))
300 server_port = atoi (optarg); 296 server_port = atoi (optarg);
301 else 297 else
302 usage (_("Server port must be a positive integer\n")); 298 usage (_("Port must be a positive integer\n"));
303 break; 299 break;
304 case 'f': /* from argument */ 300 case 'f': /* from argument */
305 from_arg = optarg; 301 from_arg = optarg;
@@ -334,7 +330,7 @@ process_arguments (int argc, char **argv)
334 check_critical_time = TRUE; 330 check_critical_time = TRUE;
335 } 331 }
336 else { 332 else {
337 usage (_("Critical time must be a nonnegative integer\n")); 333 usage (_("Critical time must be a positive integer\n"));
338 } 334 }
339 break; 335 break;
340 case 'w': /* warning time threshold */ 336 case 'w': /* warning time threshold */
@@ -343,7 +339,7 @@ process_arguments (int argc, char **argv)
343 check_warning_time = TRUE; 339 check_warning_time = TRUE;
344 } 340 }
345 else { 341 else {
346 usage (_("Warning time must be a nonnegative integer\n")); 342 usage (_("Warning time must be a positive integer\n"));
347 } 343 }
348 break; 344 break;
349 case 'v': /* verbose */ 345 case 'v': /* verbose */
@@ -354,7 +350,7 @@ process_arguments (int argc, char **argv)
354 socket_timeout = atoi (optarg); 350 socket_timeout = atoi (optarg);
355 } 351 }
356 else { 352 else {
357 usage (_("Time interval must be a nonnegative integer\n")); 353 usage (_("Time interval must be a positive integer\n"));
358 } 354 }
359 break; 355 break;
360 case '4': 356 case '4':
@@ -374,7 +370,9 @@ process_arguments (int argc, char **argv)
374 print_help (); 370 print_help ();
375 exit (STATE_OK); 371 exit (STATE_OK);
376 case '?': /* help */ 372 case '?': /* help */
377 usage (_("Invalid argument\n")); 373 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
374 print_usage ();
375 exit (STATE_UNKNOWN);
378 } 376 }
379 } 377 }
380 378
@@ -384,7 +382,7 @@ process_arguments (int argc, char **argv)
384 if (is_host (argv[c])) 382 if (is_host (argv[c]))
385 server_address = argv[c]; 383 server_address = argv[c];
386 else 384 else
387 usage2 (_("Invalid host name"), argv[c]); 385 usage2 (_("Invalid hostname/address"), argv[c]);
388 } 386 }
389 else { 387 else {
390 asprintf (&server_address, "127.0.0.1"); 388 asprintf (&server_address, "127.0.0.1");
@@ -405,8 +403,6 @@ process_arguments (int argc, char **argv)
405 403
406 404
407 405
408
409
410int 406int
411validate_arguments (void) 407validate_arguments (void)
412{ 408{
@@ -415,9 +411,6 @@ validate_arguments (void)
415 411
416 412
417 413
418
419
420
421void 414void
422print_help (void) 415print_help (void)
423{ 416{
@@ -470,8 +463,6 @@ STATE_WARNING return values.\n"));
470 463
471 464
472 465
473
474
475void 466void
476print_usage (void) 467print_usage (void)
477{ 468{
@@ -480,6 +471,3 @@ Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
480 [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); 471 [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname);
481 printf (_(UT_HLP_VRS), progname, progname); 472 printf (_(UT_HLP_VRS), progname, progname);
482} 473}
483
484
485