--- 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 (); }