diff options
Diffstat (limited to 'plugins/check_hpjd.c')
-rw-r--r-- | plugins/check_hpjd.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 6546556..c4b4417 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -66,7 +66,7 @@ void print_usage (void); | |||
66 | 66 | ||
67 | char *community = NULL; | 67 | char *community = NULL; |
68 | char *address = NULL; | 68 | char *address = NULL; |
69 | char *port = NULL; | 69 | unsigned int port = 0; |
70 | int check_paper_out = 1; | 70 | int check_paper_out = 1; |
71 | 71 | ||
72 | int | 72 | int |
@@ -121,8 +121,12 @@ main (int argc, char **argv) | |||
121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); | 121 | HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); |
122 | 122 | ||
123 | /* get the command to run */ | 123 | /* get the command to run */ |
124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community, | 124 | sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%u %s", |
125 | address, port, query_string); | 125 | PATH_TO_SNMPGET, |
126 | community, | ||
127 | address, | ||
128 | port, | ||
129 | query_string); | ||
126 | 130 | ||
127 | /* run the command */ | 131 | /* run the command */ |
128 | child_process = spopen (command_line); | 132 | child_process = spopen (command_line); |
@@ -380,11 +384,8 @@ process_arguments (int argc, char **argv) | |||
380 | community = strdup (DEFAULT_COMMUNITY); | 384 | community = strdup (DEFAULT_COMMUNITY); |
381 | } | 385 | } |
382 | 386 | ||
383 | if (port == NULL) { | 387 | if (port == 0) { |
384 | if (argv[c] != NULL ) | 388 | port = atoi(DEFAULT_PORT); |
385 | port = argv[c]; | ||
386 | else | ||
387 | port = atoi (DEFAULT_PORT); | ||
388 | } | 389 | } |
389 | 390 | ||
390 | return validate_arguments (); | 391 | return validate_arguments (); |