summaryrefslogtreecommitdiffstats
path: root/web/attachments/156798-check_dhcp--standardize.diff
blob: 00cfc4c269fa5409e5b335c5dca1ae9a671bbd23 (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
--- check_dhcp.c.orig	2005-11-18 13:47:21.000000000 -0500
+++ check_dhcp.c	2005-11-18 13:55:21.000000000 -0500
@@ -27,8 +27,8 @@
 *****************************************************************************/
 
 const char *progname = "check_dhcp";
-const char *revision = "$Revision: 1.7 $";
-const char *copyright = "2001-2004";
+const char *revision = "$Revision: 1.8 $";
+const char *copyright = "2001-2005";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
@@ -106,11 +106,6 @@
 
 /**** Common definitions ****/
 
-#define STATE_OK          0
-#define STATE_WARNING     1
-#define STATE_CRITICAL    2
-#define STATE_UNKNOWN     -1
-
 #define OK                0
 #define ERROR             -1
 
@@ -241,7 +236,7 @@
 
 int main(int argc, char **argv){
 	int dhcp_socket;
-	int result;
+	int result = STATE_UNKNOWN;
 
 	setlocale (LC_ALL, "");
 	bindtextdomain (PACKAGE, LOCALEDIR);
@@ -921,8 +916,14 @@
 	else if(request_specific_address==TRUE && received_requested_address==FALSE)
 		result=STATE_WARNING;
 
-
-	printf("DHCP %s: ",(result==STATE_OK)?"ok":"problem");
+    if(result==0)               /* garrett honeycutt 2005 */
+        printf("OK: ");
+    else if(result==1)
+        printf("WARNING: ");
+    else if(result==2)
+        printf("CRITICAL: ");
+    else if(result==3)
+        printf("UNKNOWN: ");
 
 	/* we didn't receive any DHCPOFFERs */
 	if(dhcp_offer_list==NULL){