X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_hpjd.c;h=dd49893b8f955011a3e26964bab39113d49f1ee6;hb=6ecaa524bf28b5fb861b161ea075a11119cb3bd2;hp=b124cceb82f153a13e65c8e17b195725e56b567c;hpb=0c1c9f51e2c33db04918d2aa322fd1f9a688979b;p=nagiosplug.git diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index b124cce..dd49893 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -14,8 +14,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * +* $Id$ *****************************************************************************/ +const char *progname = "check_hpjd"; +const char *revision = "$Revision$"; +const char *copyright = "2000-2004"; +const char *email = "nagiosplug-devel@lists.sourceforge.net"; + #include "common.h" #include "popen.h" #include "utils.h" @@ -23,10 +29,6 @@ #define DEFAULT_COMMUNITY "public" -const char *progname = "check_hpjd"; -const char *revision = "$Revision$"; -const char *copyright = "2000-2003"; -const char *email = "nagiosplug-devel@lists.sourceforge.net"; const char *option_summary = "-H host [-C community]\n"; @@ -58,7 +60,7 @@ int main (int argc, char **argv) { char command_line[1024]; - int result; + int result = STATE_UNKNOWN; int line; char input_buffer[MAX_INPUT_BUFFER]; char query_string[512]; @@ -83,8 +85,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) != OK) - usage (_("Incorrect arguments supplied\n")); + if (process_arguments (argc, argv) == ERROR) + usage4 (_("Could not parse arguments")); /* removed ' 2>1' at end of command 10/27/1999 - EG */ /* create the query string */ @@ -103,7 +105,7 @@ main (int argc, char **argv) HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); /* get the command to run */ - sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, + sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, address, query_string); /* run the command */ @@ -284,9 +286,6 @@ main (int argc, char **argv) } - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -321,7 +320,7 @@ process_arguments (int argc, char **argv) address = strscpy(address, optarg) ; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'C': /* community */ @@ -334,7 +333,7 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case '?': /* help */ - usage (_("Invalid argument\n")); + usage2 (_("Unknown argument"), optarg); } } @@ -344,7 +343,7 @@ process_arguments (int argc, char **argv) address = argv[c++]; } else { - usage2 (_("Invalid host name"), argv[c]); + usage2 (_("Invalid hostname/address"), argv[c]); } } @@ -359,9 +358,6 @@ process_arguments (int argc, char **argv) } - - - int validate_arguments (void) { @@ -369,10 +365,6 @@ validate_arguments (void) } - - - - void print_help (void) { @@ -398,11 +390,8 @@ Net-snmp must be installed on the computer running the plugin.\n\n")); - void print_usage (void) { - printf (_("\ -Usage: %s -H host [-C community]\n"), progname); - printf (_(UT_HLP_VRS), progname, progname); + printf ("Usage: %s -H host [-C community]\n", progname); }