diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-01-13 12:15:16 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-01-13 12:15:16 +0000 |
commit | 0c3386274ef5002dffc20337ef02407f24d7400c (patch) | |
tree | 1e78bac7844a548e56a642b35acfe1fd67342f71 /plugins/check_tcp.c | |
parent | de5650f28e4e43a7264913953f95a75d8afe23f0 (diff) | |
download | monitoring-plugins-0c3386274ef5002dffc20337ef02407f24d7400c.tar.gz |
convert PROGANE from a define to a const char
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@238 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r-- | plugins/check_tcp.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 32d38b42..43580b6c 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * | 22 | * |
23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
24 | 24 | ||
25 | #define PROGRAM check_tcp | 25 | /* const char *progname = "check_tcp"; */ |
26 | #define REVISION "$Revision$" | 26 | #define REVISION "$Revision$" |
27 | #define DESCRIPTION "Check a TCP port" | 27 | #define DESCRIPTION "Check a TCP port" |
28 | #define AUTHOR "Ethan Galstad" | 28 | #define AUTHOR "Ethan Galstad" |
@@ -65,7 +65,7 @@ int process_arguments (int, char **); | |||
65 | void print_usage (void); | 65 | void print_usage (void); |
66 | void print_help (void); | 66 | void print_help (void); |
67 | 67 | ||
68 | char *PROGNAME = NULL; | 68 | char *progname = NULL; |
69 | char *SERVICE = NULL; | 69 | char *SERVICE = NULL; |
70 | char *SEND = NULL; | 70 | char *SEND = NULL; |
71 | char *EXPECT = NULL; | 71 | char *EXPECT = NULL; |
@@ -103,7 +103,7 @@ main (int argc, char **argv) | |||
103 | struct timeval tv; | 103 | struct timeval tv; |
104 | 104 | ||
105 | if (strstr (argv[0], "check_udp")) { | 105 | if (strstr (argv[0], "check_udp")) { |
106 | asprintf (&PROGNAME, "check_udp"); | 106 | asprintf (&progname, "check_udp"); |
107 | asprintf (&SERVICE, "UDP"); | 107 | asprintf (&SERVICE, "UDP"); |
108 | SEND = NULL; | 108 | SEND = NULL; |
109 | EXPECT = NULL; | 109 | EXPECT = NULL; |
@@ -112,7 +112,7 @@ main (int argc, char **argv) | |||
112 | PORT = 0; | 112 | PORT = 0; |
113 | } | 113 | } |
114 | else if (strstr (argv[0], "check_tcp")) { | 114 | else if (strstr (argv[0], "check_tcp")) { |
115 | asprintf (&PROGNAME, "check_tcp"); | 115 | asprintf (&progname, "check_tcp"); |
116 | asprintf (&SERVICE, "TCP"); | 116 | asprintf (&SERVICE, "TCP"); |
117 | SEND = NULL; | 117 | SEND = NULL; |
118 | EXPECT = NULL; | 118 | EXPECT = NULL; |
@@ -121,7 +121,7 @@ main (int argc, char **argv) | |||
121 | PORT = 0; | 121 | PORT = 0; |
122 | } | 122 | } |
123 | else if (strstr (argv[0], "check_ftp")) { | 123 | else if (strstr (argv[0], "check_ftp")) { |
124 | asprintf (&PROGNAME, "check_ftp"); | 124 | asprintf (&progname, "check_ftp"); |
125 | asprintf (&SERVICE, "FTP"); | 125 | asprintf (&SERVICE, "FTP"); |
126 | SEND = NULL; | 126 | SEND = NULL; |
127 | asprintf (&EXPECT, "220"); | 127 | asprintf (&EXPECT, "220"); |
@@ -130,7 +130,7 @@ main (int argc, char **argv) | |||
130 | PORT = 21; | 130 | PORT = 21; |
131 | } | 131 | } |
132 | else if (strstr (argv[0], "check_smtp")) { | 132 | else if (strstr (argv[0], "check_smtp")) { |
133 | asprintf (&PROGNAME, "check_smtp"); | 133 | asprintf (&progname, "check_smtp"); |
134 | asprintf (&SERVICE, "SMTP"); | 134 | asprintf (&SERVICE, "SMTP"); |
135 | SEND = NULL; | 135 | SEND = NULL; |
136 | asprintf (&EXPECT, "220"); | 136 | asprintf (&EXPECT, "220"); |
@@ -139,7 +139,7 @@ main (int argc, char **argv) | |||
139 | PORT = 25; | 139 | PORT = 25; |
140 | } | 140 | } |
141 | else if (strstr (argv[0], "check_pop")) { | 141 | else if (strstr (argv[0], "check_pop")) { |
142 | asprintf (&PROGNAME, "check_pop"); | 142 | asprintf (&progname, "check_pop"); |
143 | asprintf (&SERVICE, "POP"); | 143 | asprintf (&SERVICE, "POP"); |
144 | SEND = NULL; | 144 | SEND = NULL; |
145 | asprintf (&EXPECT, "+OK"); | 145 | asprintf (&EXPECT, "+OK"); |
@@ -148,7 +148,7 @@ main (int argc, char **argv) | |||
148 | PORT = 110; | 148 | PORT = 110; |
149 | } | 149 | } |
150 | else if (strstr (argv[0], "check_imap")) { | 150 | else if (strstr (argv[0], "check_imap")) { |
151 | asprintf (&PROGNAME, "check_imap"); | 151 | asprintf (&progname, "check_imap"); |
152 | asprintf (&SERVICE, "IMAP"); | 152 | asprintf (&SERVICE, "IMAP"); |
153 | SEND = NULL; | 153 | SEND = NULL; |
154 | asprintf (&EXPECT, "* OK"); | 154 | asprintf (&EXPECT, "* OK"); |
@@ -158,7 +158,7 @@ main (int argc, char **argv) | |||
158 | } | 158 | } |
159 | #ifdef HAVE_SSL | 159 | #ifdef HAVE_SSL |
160 | else if (strstr(argv[0],"check_simap")) { | 160 | else if (strstr(argv[0],"check_simap")) { |
161 | asprintf (&PROGNAME, "check_simap"); | 161 | asprintf (&progname, "check_simap"); |
162 | asprintf (&SERVICE, "SIMAP"); | 162 | asprintf (&SERVICE, "SIMAP"); |
163 | SEND=NULL; | 163 | SEND=NULL; |
164 | asprintf (&EXPECT, "* OK"); | 164 | asprintf (&EXPECT, "* OK"); |
@@ -168,7 +168,7 @@ main (int argc, char **argv) | |||
168 | PORT=993; | 168 | PORT=993; |
169 | } | 169 | } |
170 | else if (strstr(argv[0],"check_spop")) { | 170 | else if (strstr(argv[0],"check_spop")) { |
171 | asprintf (&PROGNAME, "check_spop"); | 171 | asprintf (&progname, "check_spop"); |
172 | asprintf (&SERVICE, "SPOP"); | 172 | asprintf (&SERVICE, "SPOP"); |
173 | SEND=NULL; | 173 | SEND=NULL; |
174 | asprintf (&EXPECT, "+OK"); | 174 | asprintf (&EXPECT, "+OK"); |
@@ -179,7 +179,7 @@ main (int argc, char **argv) | |||
179 | } | 179 | } |
180 | #endif | 180 | #endif |
181 | else if (strstr (argv[0], "check_nntp")) { | 181 | else if (strstr (argv[0], "check_nntp")) { |
182 | asprintf (&PROGNAME, "check_nntp"); | 182 | asprintf (&progname, "check_nntp"); |
183 | asprintf (&SERVICE, "NNTP"); | 183 | asprintf (&SERVICE, "NNTP"); |
184 | SEND = NULL; | 184 | SEND = NULL; |
185 | EXPECT = NULL; | 185 | EXPECT = NULL; |
@@ -387,21 +387,21 @@ process_arguments (int argc, char **argv) | |||
387 | 387 | ||
388 | switch (c) { | 388 | switch (c) { |
389 | case '?': /* print short usage statement if args not parsable */ | 389 | case '?': /* print short usage statement if args not parsable */ |
390 | printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg); | 390 | printf ("%s: Unknown argument: %s\n\n", progname, optarg); |
391 | print_usage (); | 391 | print_usage (); |
392 | exit (STATE_UNKNOWN); | 392 | exit (STATE_UNKNOWN); |
393 | case 'h': /* help */ | 393 | case 'h': /* help */ |
394 | print_help (); | 394 | print_help (); |
395 | exit (STATE_OK); | 395 | exit (STATE_OK); |
396 | case 'V': /* version */ | 396 | case 'V': /* version */ |
397 | print_revision (PROGNAME, "$Revision$"); | 397 | print_revision (progname, "$Revision$"); |
398 | exit (STATE_OK); | 398 | exit (STATE_OK); |
399 | case 'v': /* verbose mode */ | 399 | case 'v': /* verbose mode */ |
400 | verbose = TRUE; | 400 | verbose = TRUE; |
401 | break; | 401 | break; |
402 | case 'H': /* hostname */ | 402 | case 'H': /* hostname */ |
403 | if (is_host (optarg) == FALSE) | 403 | if (is_host (optarg) == FALSE) |
404 | usage ("Invalid host name/address\n"); | 404 | usage2 ("invalid host name or address", optarg); |
405 | server_address = optarg; | 405 | server_address = optarg; |
406 | break; | 406 | break; |
407 | case 'c': /* critical */ | 407 | case 'c': /* critical */ |
@@ -479,7 +479,7 @@ print_usage (void) | |||
479 | { | 479 | { |
480 | printf | 480 | printf |
481 | ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n" | 481 | ("Usage: %s -H host -p port [-w warn_time] [-c crit_time] [-s send]\n" |
482 | " [-e expect] [-W wait] [-t to_sec] [-v]\n", PROGNAME); | 482 | " [-e expect] [-W wait] [-t to_sec] [-v]\n", progname); |
483 | } | 483 | } |
484 | 484 | ||
485 | 485 | ||
@@ -489,7 +489,7 @@ print_usage (void) | |||
489 | void | 489 | void |
490 | print_help (void) | 490 | print_help (void) |
491 | { | 491 | { |
492 | print_revision (PROGNAME, "$Revision$"); | 492 | print_revision (progname, "$Revision$"); |
493 | printf | 493 | printf |
494 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" | 494 | ("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n\n" |
495 | "This plugin tests %s connections with the specified host.\n\n", | 495 | "This plugin tests %s connections with the specified host.\n\n", |