diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-11 22:22:12 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-11 22:22:12 +0000 |
commit | 7283211f00a3a89956d9dfc4a851dc1aaa7a1cf3 (patch) | |
tree | 371434969644a1d3cc3c5c2c26ee73cd8221aaa4 /plugins | |
parent | d7ba5ec38b51731d4ddc0a7f6e9f30897f70f156 (diff) | |
download | monitoring-plugins-7283211f00a3a89956d9dfc4a851dc1aaa7a1cf3.tar.gz |
Remove getopt_long checks
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@396 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
32 files changed, 27 insertions, 258 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 0cffaeb2..866044bd 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -174,7 +174,6 @@ process_arguments (int argc, char **argv) char *p1, *p2; size_t len; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"version", no_argument, 0, 'V'}, @@ -195,7 +194,6 @@ process_arguments (int argc, char **argv) {"use-ipv6", no_argument, 0, '6'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -205,13 +203,8 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-t"); while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:", long_options, + c = getopt_long (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:", long_options, &option_index); -#else - c = getopt (argc, argv, "Vvh46ft:H:O:p:i:u:l:C:n:s:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 5c6f1e12..59c3b7c8 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -146,7 +146,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -156,17 +155,12 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "hVvt:l:H:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVvt:l:H:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 1afc7620..5fac4eae 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -217,7 +217,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"warning", required_argument, 0, 'w'}, @@ -235,7 +234,6 @@ process_arguments (int argc, char **argv) {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -245,12 +243,7 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-t"); while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+?Vqhvet:c:w:p:x:m", long_options, &option_index); -#else - c = getopt (argc, argv, "+?Vqhvet:c:w:p:x:m"); -#endif + c = getopt_long (argc, argv, "+?Vqhvet:c:w:p:x:m", long_options, &option_index); if (c == -1 || c == EOF) break; diff --git a/plugins/check_dns.c b/plugins/check_dns.c index ac62c457..7c79893a 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -262,7 +262,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int opt_index = 0; static struct option long_opts[] = { {"help", no_argument, 0, 'h'}, @@ -275,7 +274,6 @@ process_arguments (int argc, char **argv) {"expected-address", required_argument, 0, 'a'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -285,11 +283,7 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-t"); while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "hVvt:H:s:r:a:", long_opts, &opt_index); -#else - c = getopt (argc, argv, "hVvt:H:s:r:a:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 8887afe8..ac203f52 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -202,7 +202,6 @@ process_arguments (int argc, char **argv) int c; char *rv[2]; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -215,7 +214,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif rv[PL] = NULL; rv[RTA] = NULL; @@ -231,12 +229,7 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVvH:c:w:b:n:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVvH:c:w:b:n:"); -#endif + c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", long_options, &option_index); if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 267de2e0..d8583724 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -390,7 +390,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -402,18 +401,13 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+hVH:C:", long_options, &option_index); -#else - c = getopt (argc, argv, "+?hVH:C:"); -#endif if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_http.c b/plugins/check_http.c index cf86d469..d6f2c15a 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -296,7 +296,6 @@ process_arguments (int argc, char **argv) { int c = 1; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { STD_LONG_OPTS, @@ -317,7 +316,6 @@ process_arguments (int argc, char **argv) {"min", required_argument, 0, 'm'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -335,14 +333,8 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-n"); } -#define OPTCHARS "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:" - while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index); -#else - c = getopt (argc, argv, OPTCHARS); -#endif + c = getopt_long (argc, argv, "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", long_options, &option_index); if (c == -1 || c == EOF) break; @@ -1068,12 +1060,7 @@ void print_usage (void) { printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H " %s (-h | --help) for detailed help\n" " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif progname, OPTIONS, progname, progname); } diff --git a/plugins/check_ide-smart.c b/plugins/check_ide-smart.c index 869f7dc0..47d9d840 100644 --- a/plugins/check_ide-smart.c +++ b/plugins/check_ide-smart.c @@ -44,7 +44,6 @@ #include <unistd.h> #include <linux/hdreg.h> #include <linux/types.h> -#include <getopt.h> #include <errno.h> #define NR_ATTRIBUTES 30 @@ -342,7 +341,6 @@ main (int argc, char *argv[]) int o, longindex; int retval = 0; -#ifdef HAVE_GETOPT_H const struct option longopts[] = { {"device", required_argument, 0, 'd'}, {"immediate", no_argument, 0, 'i'}, @@ -354,16 +352,10 @@ main (int argc, char *argv[]) {"version", no_argument, 0, 'V'}, {0, 0, 0, 0} }; -#endif /* */ while (1) { -#ifdef HAVE_GETOPT_H o = getopt_long (argc, argv, "+d:iq10nhV", longopts, &longindex); -#else /* */ - o = getopt (argc, argv, "+d:iq10nhV"); - -#endif /* */ if (o == -1 || o == EOF) break; switch (o) { diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index ac11c58f..90fe6225 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -130,7 +130,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; /* initialize the long option struct */ static struct option longopts[] = { @@ -147,7 +146,6 @@ process_arguments (int argc, char **argv) {"crit", required_argument, 0, 'c'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -158,11 +156,7 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); -#else - c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:"); -#endif + c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); if (c == -1 || c == EOF) break; diff --git a/plugins/check_load.c b/plugins/check_load.c index 7d60d234..ba1a5983 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -155,7 +155,6 @@ process_arguments (int argc, char **argv) { int c = 0; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"warning", required_argument, 0, 'w'}, @@ -164,19 +163,13 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif - -#define OPTCHARS "Vhc:w:" if (argc < 2) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index); -#else - c = getopt (argc, argv, OPTCHARS); -#endif + c = getopt_long (argc, argv, "Vhc:w:", long_options, &option_index); + if (c == -1 || c == EOF) break; diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index e26e2e66..095dcbc8 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c @@ -214,7 +214,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"logfile", required_argument, 0, 'F'}, @@ -230,7 +229,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -245,13 +243,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "hVF:e:a:v:c:w:l:u:", long_options, + c = getopt_long (argc, argv, "hVF:e:a:v:c:w:l:u:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVF:e:a:v:c:w:l:u:"); -#endif if (c == -1 || c == EOF) break; @@ -370,12 +363,7 @@ void print_usage (void) { printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H " %s (-h | --help) for detailed help\n" " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif progname, OPTIONS, progname, progname); } diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 94e6e080..21791ae9 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -231,7 +231,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option longopts[] = { {"logfile", required_argument, 0, 'F'}, @@ -245,7 +244,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -260,11 +258,7 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "hVF:e:a:c:w:", longopts, &option_index); -#else - c = getopt (argc, argv, "hVF:e:a:c:w:"); -#endif + c = getopt_long (argc, argv, "hVF:e:a:c:w:", longopts, &option_index); if (c == -1 || c == EOF) break; diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 18324c81..30748146 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -126,7 +126,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -139,18 +138,12 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 1) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "hVP:p:u:d:H:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVP:p:u:d:H:"); -#endif + c = getopt_long (argc, argv, "hVP:p:u:d:H:", long_options, &option_index); if (c == -1 || c == EOF) break; diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 5c4cd4a3..649bec43 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -144,7 +144,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"filename", required_argument, 0, 'F'}, @@ -154,7 +153,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -172,11 +170,7 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+hVF:C:e:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVF:C:e:"); -#endif if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 1c9dc0ad..c7baa474 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -387,7 +387,6 @@ int main(int argc, char **argv){ int process_arguments(int argc, char **argv){ int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { @@ -401,7 +400,6 @@ int process_arguments(int argc, char **argv){ {"help", no_argument, 0,'h'}, {0,0,0,0} }; -#endif /* no options were supplied */ if(argc<2) return ERROR; @@ -424,11 +422,7 @@ int process_arguments(int argc, char **argv){ } while (1){ -#ifdef HAVE_GETOPT_H c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",long_options,&option_index); -#else - c = getopt(argc,argv,"+hVH:t:c:w:p:v:l:s:d:"); -#endif if (c==-1||c==EOF||c==1) break; diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 2f7ecc10..100be12f 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -622,7 +622,6 @@ int main(int argc, char **argv){ int process_arguments(int argc, char **argv){ int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { @@ -637,7 +636,6 @@ int process_arguments(int argc, char **argv){ {"help", no_argument, 0,'h'}, {0,0,0,0} }; -#endif /* no options were supplied */ if(argc<2) return ERROR; @@ -660,11 +658,7 @@ int process_arguments(int argc, char **argv){ } while (1){ -#ifdef HAVE_GETOPT_H c = getopt_long(argc,argv,"+hoVH:t:c:w:p:v:",long_options,&option_index); -#else - c = getopt(argc,argv,"+hoVH:t:c:w:p:v:"); -#endif if (c==-1||c==EOF||c==1) break; @@ -797,13 +791,8 @@ void print_usage(void) printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H " %s (-h | --help) for detailed help\n" " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif progname, OPTIONS, progname, progname); } diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 2ff37a48..4c3b957f 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c @@ -317,7 +317,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"port", required_argument, 0, 'p'}, @@ -330,7 +329,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif /* no options were supplied */ if (argc < 2) @@ -354,13 +352,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVH:t:c:w:p:v:", long_options, + c = getopt_long (argc, argv, "+hVH:t:c:w:p:v:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVH:t:c:w:p:v:"); -#endif if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 2033b8c1..e1484566 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -246,7 +246,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -262,15 +261,11 @@ process_arguments (int argc, char **argv) {"database", required_argument, 0, 'd'}, {0, 0, 0, 0} }; -#endif while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVt:c:w:H:P:d:l:p:a:"); -#endif + if (c == EOF) break; diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 480f631e..2526a74f 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -162,7 +162,6 @@ process_arguments (int argc, char **argv) int c = 1; char *ptr; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { STD_LONG_OPTS, @@ -171,9 +170,6 @@ process_arguments (int argc, char **argv) {"link", no_argument, 0, 'L'}, {0, 0, 0, 0} }; -#endif - -#define OPTCHARS "VvhnLt:c:w:H:p:" if (argc < 2) return ERROR; @@ -186,11 +182,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, OPTCHARS, long_options, &option_index); -#else - c = getopt (argc, argv, OPTCHARS); -#endif + c = getopt_long (argc, argv, "VvhnLt:c:w:H:p:", long_options, &option_index); + if (c == -1 || c == EOF) break; @@ -507,13 +500,8 @@ void print_usage (void) { printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H " %s (-h | --help) for detailed help\n" " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif progname, OPTIONS, progname, progname); } diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 755ed860..ceaff958 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -268,7 +268,6 @@ process_arguments (int argc, char **argv) int c = 1; char *user; struct passwd *pw; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"warning", required_argument, 0, 'w'}, @@ -283,18 +282,14 @@ process_arguments (int argc, char **argv) {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0} }; -#endif for (c = 1; c < argc; c++) if (strcmp ("-to", argv[c]) == 0) strcpy (argv[c], "-t"); while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:", long_options, &option_index); -#else - c = getopt (argc, argv, "Vvht:c:w:p:s:u:C:a:"); -#endif + c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:", long_options, &option_index); + if (c == -1 || c == EOF) break; diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 0b338c2b..c71f3b4c 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -208,7 +208,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -224,7 +223,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -251,13 +249,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVvH:P:F:u:p:t:r:e:", long_options, + c = getopt_long (argc, argv, "+hVvH:P:F:u:p:t:r:e:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVvH:P:F:u:p:t:r:e:"); -#endif if (c == -1 || c == EOF || c == 1) break; @@ -340,12 +333,7 @@ void print_usage (void) { printf ("Usage:\n" " %s %s\n" -#ifdef HAVE_GETOPT_H " %s (-h | --help) for detailed help\n" " %s (-V | --version) for version information\n", -#else - " %s -h for detailed help\n" - " %s -V for version information\n", -#endif progname, OPTIONS, progname, progname); } diff --git a/plugins/check_real.c b/plugins/check_real.c index ef3581b9..6b484eac 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -274,7 +274,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -290,7 +289,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -305,13 +303,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVI:H:e:u:p:w:c:t:", long_options, + c = getopt_long (argc, argv, "+hVI:H:e:u:p:w:c:t:", long_options, &option_index); -#else - c = getopt (argc, argv, "+?hVI:H:e:u:p:w:c:t"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index f78d1126..5e980bcc 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -192,7 +192,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -206,7 +205,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -221,13 +219,9 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:", long_options, + c = getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:", long_options, &option_index); -#else - c = getopt (argc, argv, "+?hVvt:p:f:e:c:w:H:"); -#endif + if (c == -1 || c == EOF) break; diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 327ef818..b943379d 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -422,7 +422,6 @@ process_arguments (int argc, char **argv) int c = 1; int j = 0, jj = 0, ii = 0; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { STD_LONG_OPTS, @@ -447,7 +446,6 @@ process_arguments (int argc, char **argv) {"privpasswd", required_argument, 0, 'X'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -463,13 +461,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:", + c = getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:", long_options, &option_index); -#else - c = getopt (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:R:r:l:u:p:m:P:L:U:a:A:X:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index bd0a2451..f3a351e6 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -64,7 +64,6 @@ process_arguments (int argc, char **argv) int c; char *tmp = NULL; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"version", no_argument, 0, 'V'}, @@ -74,7 +73,6 @@ process_arguments (int argc, char **argv) {"host", required_argument, 0, 'H'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -84,11 +82,8 @@ process_arguments (int argc, char **argv) strcpy (argv[c], "-t"); while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+Vhvt:H:p:", long_options, &option_index); -#else - c = getopt (argc, argv, "+Vhvt:H:p:"); -#endif + if (c == -1 || c == EOF) break; diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 5645779d..ad5eb25f 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -198,7 +198,6 @@ process_arguments (int argc, char **argv) int wc = 0; /* warning counter */ int cc = 0; /* critical counter */ -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"warning", required_argument, 0, 'w'}, @@ -209,17 +208,12 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+?Vvhac:w:", long_options, &option_index); -#else - c = getopt (argc, argv, "+?Vvhac:w:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 8a2dcc5c..3461c333 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -334,7 +334,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -354,7 +353,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) usage ("No arguments found\n"); @@ -377,13 +375,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S", long_options, + c = getopt_long (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVvH:s:e:q:c:w:t:p:C:W:d:S"); -#endif if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_time.c b/plugins/check_time.c index e4bd26d7..70bb6906 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -158,7 +158,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -172,7 +171,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) usage ("\n"); @@ -191,13 +189,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "hVH:w:c:W:C:p:t:", long_options, + c = getopt_long (argc, argv, "hVH:w:c:W:C:p:t:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVH:w:c:W:C:p:t:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 4ae9c103..ac221025 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -125,7 +125,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -140,7 +139,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) usage ("\n"); @@ -155,11 +153,7 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = getopt_long (argc, argv, "+hVvH:e:s:c:w:t:p:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVvH:e:s:c:w:t:p:"); -#endif + c = getopt_long (argc, argv, "+hVvH:e:s:c:w:t:p:", long_options, &option_index); if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 4c903226..b077d31f 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -434,7 +434,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"hostname", required_argument, 0, 'H'}, @@ -448,7 +447,6 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; @@ -463,13 +461,8 @@ process_arguments (int argc, char **argv) } while (1) { -#ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "hVH:u:p:v:c:w:t:", long_options, + c = getopt_long (argc, argv, "hVH:u:p:v:c:w:t:", long_options, &option_index); -#else - c = getopt (argc, argv, "hVH:u:p:v:c:w:t:"); -#endif if (c == -1 || c == EOF) break; diff --git a/plugins/check_users.c b/plugins/check_users.c index 565d9e70..58e8c13b 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -136,7 +136,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"critical", required_argument, 0, 'c'}, @@ -145,17 +144,12 @@ process_arguments (int argc, char **argv) {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; -#endif if (argc < 2) usage ("\n"); while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+hVvc:w:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVvc:w:"); -#endif if (c == -1 || c == EOF || c == 1) break; diff --git a/plugins/check_vsz.c b/plugins/check_vsz.c index e6132a0f..7a9acb2d 100644 --- a/plugins/check_vsz.c +++ b/plugins/check_vsz.c @@ -140,7 +140,6 @@ process_arguments (int argc, char **argv) { int c; -#ifdef HAVE_GETOPT_H int option_index = 0; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -150,17 +149,13 @@ process_arguments (int argc, char **argv) {"command", required_argument, 0, 'C'}, {0, 0, 0, 0} }; -#endif if (argc < 2) return ERROR; while (1) { -#ifdef HAVE_GETOPT_H c = getopt_long (argc, argv, "+hVc:w:C:", long_options, &option_index); -#else - c = getopt (argc, argv, "+hVc:w:C:"); -#endif + if (c == EOF) break; |