diff options
Diffstat (limited to 'plugins/check_dummy.c')
-rw-r--r-- | plugins/check_dummy.c | 117 |
1 files changed, 61 insertions, 56 deletions
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index 0892611..0a7f472 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | const char *progname = "check_dummy"; | 21 | const char *progname = "check_dummy"; |
22 | const char *revision = "$Revision$"; | 22 | const char *revision = "$Revision$"; |
23 | const char *copyright = "1999-2004"; | 23 | const char *copyright = "1999-2005"; |
24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
25 | 25 | ||
26 | #include "common.h" | 26 | #include "common.h" |
@@ -33,51 +33,51 @@ void print_usage (void); | |||
33 | int | 33 | int |
34 | main (int argc, char **argv) | 34 | main (int argc, char **argv) |
35 | { | 35 | { |
36 | int result = STATE_UNKNOWN; | 36 | int result = STATE_UNKNOWN; |
37 | 37 | ||
38 | setlocale (LC_ALL, ""); | 38 | setlocale (LC_ALL, ""); |
39 | bindtextdomain (PACKAGE, LOCALEDIR); | 39 | bindtextdomain (PACKAGE, LOCALEDIR); |
40 | textdomain (PACKAGE); | 40 | textdomain (PACKAGE); |
41 | 41 | ||
42 | if (argc < 2) | 42 | if (argc < 2) |
43 | usage4 (_("Could not parse arguments")); | 43 | usage4 (_("Could not parse arguments")); |
44 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { | 44 | else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) { |
45 | print_revision (progname, revision); | 45 | print_revision (progname, revision); |
46 | exit (STATE_OK); | 46 | exit (STATE_OK); |
47 | } | 47 | } |
48 | else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { | 48 | else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { |
49 | print_help (); | 49 | print_help (); |
50 | exit (STATE_OK); | 50 | exit (STATE_OK); |
51 | } | 51 | } |
52 | else if (!is_integer (argv[1])) | 52 | else if (!is_integer (argv[1])) |
53 | usage4 (_("Arguments to check_dummy must be an integer")); | 53 | usage4 (_("Arguments to check_dummy must be an integer")); |
54 | else | 54 | else |
55 | result = atoi (argv[1]); | 55 | result = atoi (argv[1]); |
56 | 56 | ||
57 | switch (result) { | 57 | switch (result) { |
58 | case STATE_OK: | 58 | case STATE_OK: |
59 | printf (_("OK")); | 59 | printf (_("OK")); |
60 | break; | 60 | break; |
61 | case STATE_WARNING: | 61 | case STATE_WARNING: |
62 | printf (_("WARNING")); | 62 | printf (_("WARNING")); |
63 | break; | 63 | break; |
64 | case STATE_CRITICAL: | 64 | case STATE_CRITICAL: |
65 | printf (_("CRITICAL")); | 65 | printf (_("CRITICAL")); |
66 | break; | 66 | break; |
67 | case STATE_UNKNOWN: | 67 | case STATE_UNKNOWN: |
68 | printf (_("UNKNOWN")); | 68 | printf (_("UNKNOWN")); |
69 | break; | 69 | break; |
70 | default: | 70 | default: |
71 | printf (_("Status %d is not a supported error state\n"), result); | 71 | printf (_("Status %d is not a supported error state\n"), result); |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | 74 | ||
75 | if (argc >= 3) | 75 | if (argc >= 3) |
76 | printf (": %s", argv[2]); | 76 | printf (": %s", argv[2]); |
77 | 77 | ||
78 | printf("\n"); | 78 | printf("\n"); |
79 | 79 | ||
80 | return result; | 80 | return result; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
@@ -85,20 +85,24 @@ main (int argc, char **argv) | |||
85 | void | 85 | void |
86 | print_help (void) | 86 | print_help (void) |
87 | { | 87 | { |
88 | print_revision (progname, revision); | 88 | print_revision (progname, revision); |
89 | 89 | ||
90 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | 90 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); |
91 | printf (COPYRIGHT, copyright, email); | 91 | printf (COPYRIGHT, copyright, email); |
92 | 92 | ||
93 | printf (_("\ | 93 | printf (_("This plugin will simply return the state corresponding to the numeric value")); |
94 | This plugin will simply return the state corresponding to the numeric value\n\ | 94 | |
95 | of the <state> argument with optional text.\n\n")); | 95 | printf ("\n"); |
96 | |||
97 | printf (_("of the <state> argument with optional text")); | ||
96 | 98 | ||
97 | print_usage (); | 99 | printf ("\n\n"); |
100 | |||
101 | print_usage (); | ||
98 | 102 | ||
99 | printf (_(UT_HELP_VRSN)); | 103 | printf (_(UT_HELP_VRSN)); |
100 | 104 | ||
101 | printf (_(UT_SUPPORT)); | 105 | printf (_(UT_SUPPORT)); |
102 | } | 106 | } |
103 | 107 | ||
104 | 108 | ||
@@ -106,5 +110,6 @@ of the <state> argument with optional text.\n\n")); | |||
106 | void | 110 | void |
107 | print_usage (void) | 111 | print_usage (void) |
108 | { | 112 | { |
109 | printf ("Usage: %s <integer state> [optional text]\n", progname); | 113 | printf (_("Usage:")); |
114 | printf (" %s <integer state> [optional text]\n", progname); | ||
110 | } | 115 | } |