diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_dummy.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index ca37e98e..c2f1f50d 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c | |||
| @@ -38,9 +38,31 @@ | |||
| 38 | #include "utils.h" | 38 | #include "utils.h" |
| 39 | 39 | ||
| 40 | const char *progname = "check_dummy"; | 40 | const char *progname = "check_dummy"; |
| 41 | const char *revision = "$Revision$"; | ||
| 42 | const char *copyright = "1999-2003"; | ||
| 43 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 41 | 44 | ||
| 42 | void print_help (const char *); | 45 | void |
| 43 | void print_usage (const char *); | 46 | print_usage (void) |
| 47 | { | ||
| 48 | printf (_("Usage: %s <integer state>\n"), progname); | ||
| 49 | } | ||
| 50 | |||
| 51 | void | ||
| 52 | print_help (void) | ||
| 53 | { | ||
| 54 | print_revision (progname, revision); | ||
| 55 | |||
| 56 | printf (_(COPYRIGHT), copyright, email); | ||
| 57 | |||
| 58 | print_usage (); | ||
| 59 | |||
| 60 | printf (_(HELP_VRSN)); | ||
| 61 | |||
| 62 | printf (_("\n\ | ||
| 63 | This plugin will simply return the state corresponding to the numeric value\n\ | ||
| 64 | of the <state> argument.\n")); | ||
| 65 | } | ||
| 44 | 66 | ||
| 45 | int | 67 | int |
| 46 | main (int argc, char **argv) | 68 | main (int argc, char **argv) |
| @@ -48,19 +70,19 @@ main (int argc, char **argv) | |||
| 48 | int result; | 70 | int result; |
| 49 | 71 | ||
| 50 | if (argc != 2) { | 72 | if (argc != 2) { |
| 51 | printf ("Incorrect number of arguments supplied\n"); | 73 | printf (_("Incorrect number of arguments supplied\n")); |
| 52 | exit (STATE_UNKNOWN); | 74 | exit (STATE_UNKNOWN); |
| 53 | } | 75 | } |
| 54 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { | 76 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { |
| 55 | print_revision (argv[0], "$Revision$"); | 77 | print_revision (progname, revision); |
| 56 | exit (STATE_OK); | 78 | exit (STATE_OK); |
| 57 | } | 79 | } |
| 58 | else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { | 80 | else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { |
| 59 | print_help (argv[0]); | 81 | print_help (); |
| 60 | exit (STATE_OK); | 82 | exit (STATE_OK); |
| 61 | } | 83 | } |
| 62 | else if (!is_integer (argv[1])) { | 84 | else if (!is_integer (argv[1])) { |
| 63 | print_usage (argv[0]); | 85 | print_usage (); |
| 64 | exit (STATE_UNKNOWN); | 86 | exit (STATE_UNKNOWN); |
| 65 | } | 87 | } |
| 66 | result = atoi (argv[1]); | 88 | result = atoi (argv[1]); |
| @@ -82,21 +104,3 @@ main (int argc, char **argv) | |||
| 82 | 104 | ||
| 83 | return result; | 105 | return result; |
| 84 | } | 106 | } |
| 85 | |||
| 86 | void | ||
| 87 | print_help (const char *cmd) | ||
| 88 | { | ||
| 89 | print_revision (cmd, "$Revision$"); | ||
| 90 | printf ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n" | ||
| 91 | "License: GPL\n\n"); | ||
| 92 | print_usage (cmd); | ||
| 93 | printf | ||
| 94 | ("\nThis plugin will simply return the state corresponding to the numeric value\n" | ||
| 95 | "of the <state> argument.\n"); | ||
| 96 | } | ||
| 97 | |||
| 98 | void | ||
| 99 | print_usage (const char *cmd) | ||
| 100 | { | ||
| 101 | printf ("Usage: %s <integer state>\n", cmd); | ||
| 102 | } | ||
