summaryrefslogtreecommitdiffstats
path: root/web/attachments/394815-woo
blob: 352f7de46874c4a2ecd805a7e91660d4a4349d68 (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
--- orig/plugins/check_hpjd.c	2010-07-27 21:47:16.000000000 +0100
+++ new/plugins/check_hpjd.c	2010-11-30 12:25:56.000000000 +0000
@@ -41,7 +41,7 @@
 #define DEFAULT_COMMUNITY "public"
 
 
-const char *option_summary = "-H host [-C community]\n";
+const char *option_summary = "-H host [-C community] [-p port]\n";
 
 #define HPJD_LINE_STATUS           ".1.3.6.1.4.1.11.2.3.9.1.1.2.1"
 #define HPJD_PAPER_STATUS          ".1.3.6.1.4.1.11.2.3.9.1.1.2.2"
@@ -66,6 +66,7 @@
 
 char *community = NULL;
 char *address = NULL;
+short port = 161;
 
 int
 main (int argc, char **argv)
@@ -119,8 +120,8 @@
 		 HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
 
 	/* get the command to run */
-	sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
-									address, query_string);
+	sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community,
+									address, port, query_string);
 
 	/* run the command */
 	child_process = spopen (command_line);
@@ -324,7 +325,7 @@
 
 
 	while (1) {
-		c = getopt_long (argc, argv, "+hVH:C:", longopts, &option);
+		c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option);
 
 		if (c == -1 || c == EOF || c == 1)
 			break;
@@ -347,6 +348,9 @@
 		case 'h':									/* help */
 			print_help ();
 			exit (STATE_OK);
+		case 'p':									/* port */
+			port = (short) atoi(optarg);
+			break;
 		case '?':									/* help */
 			usage5 ();
 		}