summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 381715a)
raw | patch | inline | side by side (parent: 381715a)
author | Holger Weiss <hweiss@users.sourceforge.net> | |
Sun, 28 Jan 2007 21:46:41 +0000 (21:46 +0000) | ||
committer | Holger Weiss <hweiss@users.sourceforge.net> | |
Sun, 28 Jan 2007 21:46:41 +0000 (21:46 +0000) |
command line option was used, as this leads to a segfault on some
systems. The unknown option will be printed by getopt(3) anyway. So,
simply call print_usage() and exit UNKNOWN via the new usage5() instead.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1590 f882894a-f735-0410-b71e-b25c423dba1c
systems. The unknown option will be printed by getopt(3) anyway. So,
simply call print_usage() and exit UNKNOWN via the new usage5() instead.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1590 f882894a-f735-0410-b71e-b25c423dba1c
38 files changed:
index fbfb3311b2f4dc3b9270fe71a74c43a576b79036..245946b5ebd971c173f82ac2dc502f9ef70ff7d2 100644 (file)
break;
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
break;
default:
diff --git a/plugins/check_apt.c b/plugins/check_apt.c
index 902b455f7b3213d8289dfa628a7fc028d4ae2edb..f67ebf9be9ab4ac968c8098ed51a880df3047b34 100644 (file)
--- a/plugins/check_apt.c
+++ b/plugins/check_apt.c
break;
default:
/* print short usage statement if args not parsable */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index d1cbf936e91424ac3a8482e9d28a2046fc2fde4b..1675071c187e08cc5776ca160d8a8f72dbaeb119 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
asprintf (&comm, "%s -%c", comm, c);
break;
default: /* help */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 77df3c2e99c4f0a8cd73ab8624edc636347c2262..e850337b59405bdaa741253459e1611aca28e32e 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
case 'a':
expected_address = optarg;
break;
- default: /* usage_va */
- usage_va(_("Unknown argument - %s"), optarg);
+ default: /* usage5 */
+ usage5();
}
}
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 93af7dc56765eb6f52e5f4fa331dbf8d04ad7c17..454f813b30c0bda831874013a4fb30322468abd7 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
critical = optarg;
break;
default: /* args not parsable */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 25ca4a8d3fe4fc888e02a04efab444eca481ecae..4dc48b7744f68b2dd3b55b9eee762a8a2dcebf60 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_game.c b/plugins/check_game.c
index a785b511317508c655db4670638586517e72932b..79abec33c77bd94bf812d11dbd2db179d4bce0b8 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
return ERROR;
break;
default: /* args not parsable */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c
index 31a76bd2870fdff4e39f96b1a4546d29d1e3469b..8a60ce8c855fd2bcd33a0f756d30c80af73515e4 100644 (file)
--- a/plugins/check_hpjd.c
+++ b/plugins/check_hpjd.c
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_http.c b/plugins/check_http.c
index b81f214616be5dc29966cc6ef7b7d9345b67141e..d1f3998b2010ae10f929b08d163ceb86ec0313d8 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
switch (c) {
case '?': /* usage */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
break;
case 'h': /* help */
print_help ();
index 14d27b33a181526206e22ec39fb706c79cae8c96..234f23b74b5c08a9f1f9e20050696a137f19a27d 100644 (file)
print_revision (progname, revision);
return STATE_OK;
default:
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index 60872cfdff2e114358e4a0854983b1323feed147..12ea07135defce944055d7f55cc7365a0d0767fa 100644 (file)
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
#endif
break;
default:
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 562eaf5d449066b5fcb857b28958e45277308f13..3d00432f9fba1364d8433c34bb444269f0544b95 100644 (file)
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 7cee31ebcdcf6106e77d37c7c5a4756457e1f7bb..4abe1d767dc668c639b6d3449636091f7a450eb4 100644 (file)
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
index adaf9e25b9f700e8ddca216bec704006fe5a081f..e587e5cd061fcc4247d6cbe344a7a01f16f145b7 100644 (file)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index e10211faf3396440f6fa7756410f16be4f9825e1..573ec96a8a4aecd6b266063f389cf0ba57f2fa39 100644 (file)
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
verbose++;
break;
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
index ecb7e7fe83cf32f1b529729178b803d2f1b92052..bb62eecf23dd3afafae7d42f0770de9f4dc991e6 100644 (file)
critical = optarg;
break;
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index a6ae71f2e172986636ac5dc2a477804e753a4593..5703e606b7b6e255fa3f568060c07793168017cc 100644 (file)
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
verbose++;
break;
default: /* print short usage_va statement if args not parsable */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 44203dbc7127e7711241d04d6540b7eef71c0a10..fe47a58bf4480098dabcfc92fe2097522d492312 100644 (file)
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
switch (c)
{
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help();
exit(STATE_OK);
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index d6e1dd5f506c2b3c328bb82a241bbe801e5e7376..3ed8f3470360131a38103f5cbeaa2d1dbf25d295 100644 (file)
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
break;
case '?':
/* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
break;
}
}
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 91797dc816f5c9d298dee0fd37e31985c5013687..53ac2e08e4246ccb9d8db65247b5bc8c9304e314 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
switch (c)
{
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help();
exit(STATE_OK);
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 2aca8ea5dde8ddcdb00fecc16e068db23e8f78fe..25a7785a8949f39043a02fc026c45e2bec7772f5 100644 (file)
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 41c51413342e6b7b33e35a0421643cb3c64a839e..cbff8d759c10788c3f7b4c9729bbc97cc0734e2f 100644 (file)
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
switch (c) {
case '?': /* usage */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index ca40920cd8d1b198bd9edb48ffddfcac8a08ceb2..aa686a65a0e7205506322d078acdb6f5c4ed36c6 100644 (file)
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
switch (c) {
case '?': /* usage */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_procs.c b/plugins/check_procs.c
index d9e2a6710a13543ae940564c4c58b880ee4cca4c..da7e9f0f888d6392a9df6949249e958ce2bfddb7 100644 (file)
--- a/plugins/check_procs.c
+++ b/plugins/check_procs.c
switch (c) {
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index b1bb928f3e31484b9966538d2f35bc6cadcfd2a0..4b340c3b4d46809c4f4cc36447d26a01af3ad945 100644 (file)
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (OK);
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 2d24e1481605e9c1bc7a0bd0529aac2685ea7753..0ccc1c098c6d8e85723a1006fe7d7942f040bd25 100644 (file)
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
print_help ();
exit (STATE_OK);
case '?': /* usage */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 94214ee0f92fdf3921cb58b7591d169b58cc494e..94b97c4f3e284249b0806d7dce315159e70640c5 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 1e1657b4f91651ce02fb30baa60e5715b14ae781..d9e007820739c28b53b4d2873a6d832405e0eeec 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
switch (c) {
case '?': /* usage */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 1c24e5889c460525910d55baa793ce6d08c86f4e..afe44c9512d668f9410393cddaf89bf838970dbd 100644 (file)
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
switch (c) {
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'V': /* version */
print_revision (progname, revision);
exit (STATE_OK);
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 59c1ecf6ce2d902d7298de4fd25e67d659dff427..1903a00617855b225874abae588450499f2dce03 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
print_help ();
exit (STATE_OK);
case '?': /* error */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index faa3cedb99c3d60d9fda8b57b1d4084da86c0528..7e1bd38b043be9059075803aa1fd33ec1c192dd9 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_time.c b/plugins/check_time.c
index ca4205663e10176ce75454db502143547a573c1c..d3af3b0cef944242fb97055e5455620c935fea7c 100644 (file)
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 280b3fb6c0489821ee03c7eb79ca26017c48a5d3..56438bb28007b0d019113b4e62ef62a6c34a1232 100644 (file)
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
switch (c) {
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'H': /* hostname */
if (is_host (optarg)) {
server_address = optarg;
diff --git a/plugins/check_users.c b/plugins/check_users.c
index 0c62e3b118fe41ec1057ba8b93e7072adef658c2..8e5f23d72a17e86ef886829fb69bfdf24a0a1e4c 100644 (file)
--- a/plugins/check_users.c
+++ b/plugins/check_users.c
switch (c) {
case '?': /* print short usage statement if args not parsable */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
case 'h': /* help */
print_help ();
exit (STATE_OK);
diff --git a/plugins/negate.c b/plugins/negate.c
index 45c032691d07002b99f025720859a4e3ac9327ad..8b2dff0e6ba86c6a2e42e857d06f5026130fa246 100644 (file)
--- a/plugins/negate.c
+++ b/plugins/negate.c
switch (c) {
case '?': /* help */
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
break;
case 'h': /* help */
print_help ();
diff --git a/plugins/urlize.c b/plugins/urlize.c
index 7793e9a8604165f5a253674628d09753572d097a..612dd14daf7ed6ee87b4ce6f8e233756d12253e3 100644 (file)
--- a/plugins/urlize.c
+++ b/plugins/urlize.c
break;
case '?':
default:
- usage2 (_("Unknown argument"), optarg);
+ usage5 ();
}
}
diff --git a/plugins/utils.c b/plugins/utils.c
index 2b3accea672e2050f2f82abbf1d7962d479c550d..7e1e58a20060187204b4fb523632c5d418465a2e 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
exit (STATE_UNKNOWN);
}
+void
+usage5 (void)
+{
+ print_usage();
+ exit (STATE_UNKNOWN);
+}
+
char *
clean_revstring (const char *revstring)
{
diff --git a/plugins/utils.h b/plugins/utils.h
index 0d00ce85cef9fd759b85e04c36626d1376adcdb3..f15a7b161de69541a59629198f622fa30e89d30e 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
void usage (const char *) __attribute__((noreturn));
void usage2(const char *, const char *) __attribute__((noreturn));
void usage3(const char *, int) __attribute__((noreturn));
-void usage4(const char *);
-void usage_va(const char *fmt, ...);
+void usage4(const char *) __attribute__((noreturn));
+void usage5(void) __attribute__((noreturn));
+void usage_va(const char *fmt, ...) __attribute__((noreturn));
const char *state_text (int);