summaryrefslogtreecommitdiffstats
path: root/web/attachments/86257-patch-check_tcp-quiet
blob: b085f62977da5e629faa0fcda54aef45683a1b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
*** check_tcp.c.original	Thu May  6 09:25:56 2004
--- check_tcp.c	Thu May  6 09:31:52 2004
***************
*** 84,89 ****
--- 84,90 ----
  int check_warning_time = FALSE;
  double critical_time = 0;
  int check_critical_time = FALSE;
+ int hide_output = FALSE;
  double elapsed_time = 0;
  long microsec;
  int verbose = FALSE;
***************
*** 329,335 ****
  		 (was_refused) ? " (refused)" : "",
  		 elapsed_time, server_port);
  
! 	if (status && strlen(status) > 0)
  		printf (" [%s]", status);
  
  	printf (" |%s\n", perfdata ("time", microsec, "us",
--- 330,336 ----
  		 (was_refused) ? " (refused)" : "",
  		 elapsed_time, server_port);
  
! 	if (hide_output == FALSE && status && strlen(status) > 0)
  		printf (" [%s]", status);
  
  	printf (" |%s\n", perfdata ("time", microsec, "us",
***************
*** 364,369 ****
--- 365,371 ----
  		{"expect", required_argument, 0, 'e'},
  		{"maxbytes", required_argument, 0, 'm'},
  		{"quit", required_argument, 0, 'q'},
+ 		{"jail", required_argument, 0, 'j'},
  		{"delay", required_argument, 0, 'd'},
  		{"refuse", required_argument, 0, 'r'},
  		{"use-ipv4", no_argument, 0, '4'},
***************
*** 395,401 ****
  	}
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:",
  		                 longopts, &option);
  
  		if (c == -1 || c == EOF || c == 1)
--- 397,403 ----
  	}
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:j",
  		                 longopts, &option);
  
  		if (c == -1 || c == EOF || c == 1)
***************
*** 437,442 ****
--- 439,447 ----
  				critical_time = strtod (optarg, NULL);
  			check_critical_time = TRUE;
  			break;
+ 		case 'j':		  /* hide output */
+ 			hide_output = TRUE;
+ 			break;
  		case 'w':                 /* warning */
  			if (!is_intnonneg (optarg))
  				usage (_("Warning threshold must be a nonnegative integer\n"));
***************
*** 622,627 ****
--- 627,634 ----
  	printf (_("\
   -r, --refuse=ok|warn|crit\n\
      Accept tcp refusals with states ok, warn, crit (default: crit)\n\
+  -j, --jail\n\
+     Hide output from TCP socket\n\
   -m, --maxbytes=INTEGER\n\
      Close connection once more than this number of bytes are received\n\
   -d, --delay=INTEGER\n\
***************
*** 646,652 ****
  Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
    [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
    [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
!   [-r <refuse state>] [-v] [-4|-6]\n"), progname);
  	printf ("       %s (-h|--help)\n", progname);
  	printf ("       %s (-V|--version)\n", progname);
  }
--- 653,659 ----
  Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
    [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
    [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
!   [-r <refuse state>] [-v] [-4|-6] [-j]\n"), progname);
  	printf ("       %s (-h|--help)\n", progname);
  	printf ("       %s (-V|--version)\n", progname);
  }