diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index b124cceb82f153a13e65c8e17b195725e56b567c..dd49893b8f955011a3e26964bab39113d49f1ee6 100644 (file)
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* 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"
#include "common.h"
#include "popen.h"
#include "utils.h"
#define DEFAULT_COMMUNITY "public"
#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";
const char *option_summary = "-H host [-C community]\n";
main (int argc, char **argv)
{
char command_line[1024];
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];
int line;
char input_buffer[MAX_INPUT_BUFFER];
char query_string[512];
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
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 */
/* removed ' 2>1' at end of command 10/27/1999 - EG */
/* create the query string */
HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
/* get the command to run */
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 */
address, query_string);
/* run the command */
}
}
-
-
-
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
address = strscpy(address, optarg) ;
}
else {
address = strscpy(address, optarg) ;
}
else {
- usage2 (_("Invalid host name"), optarg);
+ usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'C': /* community */
}
break;
case 'C': /* community */
print_help ();
exit (STATE_OK);
case '?': /* help */
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage (_("Invalid argument\n"));
+ usage2 (_("Unknown argument"), optarg);
}
}
}
}
address = argv[c++];
}
else {
address = argv[c++];
}
else {
- usage2 (_("Invalid host name"), argv[c]);
+ usage2 (_("Invalid hostname/address"), argv[c]);
}
}
}
}
}
}
-
-
-
int
validate_arguments (void)
{
int
validate_arguments (void)
{
}
}
-
-
-
-\f
void
print_help (void)
{
void
print_help (void)
{
-
void
print_usage (void)
{
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);
}
}