summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 11ea955..7d0ebc9 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -14,6 +14,8 @@
14 along with this program; if not, write to the Free Software 14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 16
17 $Id$
18
17******************************************************************************/ 19******************************************************************************/
18 20
19const char *progname = "check_snmp"; 21const char *progname = "check_snmp";
@@ -118,9 +120,6 @@ char *miblist;
118 120
119 121
120 122
121
122
123
124int 123int
125main (int argc, char **argv) 124main (int argc, char **argv)
126{ 125{
@@ -158,7 +157,7 @@ main (int argc, char **argv)
158 miblist = strdup (DEFAULT_MIBLIST); 157 miblist = strdup (DEFAULT_MIBLIST);
159 158
160 if (process_arguments (argc, argv) == ERROR) 159 if (process_arguments (argc, argv) == ERROR)
161 usage (_("Incorrect arguments supplied\n")); 160 usage (_("check_snmp: could not parse arguments\n"));
162 161
163 /* create the command line to execute */ 162 /* create the command line to execute */
164 asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", 163 asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
@@ -344,9 +343,6 @@ main (int argc, char **argv)
344 343
345 344
346 345
347
348
349
350/* process command-line arguments */ 346/* process command-line arguments */
351int 347int
352process_arguments (int argc, char **argv) 348process_arguments (int argc, char **argv)
@@ -402,7 +398,9 @@ process_arguments (int argc, char **argv)
402 398
403 switch (c) { 399 switch (c) {
404 case '?': /* usage */ 400 case '?': /* usage */
405 usage3 ("Unknown argument", optopt); 401 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
402 print_usage ();
403 exit (STATE_UNKNOWN);
406 case 'h': /* help */ 404 case 'h': /* help */
407 print_help (); 405 print_help ();
408 exit (STATE_OK); 406 exit (STATE_OK);
@@ -601,8 +599,6 @@ process_arguments (int argc, char **argv)
601} 599}
602 600
603 601
604
605
606/****************************************************************************** 602/******************************************************************************
607 603
608@@- 604@@-
@@ -623,6 +619,8 @@ first character cannot be a number, however.</para>
623-@@ 619-@@
624******************************************************************************/ 620******************************************************************************/
625 621
622
623
626int 624int
627validate_arguments () 625validate_arguments ()
628{ 626{
@@ -665,7 +663,6 @@ validate_arguments ()
665 asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd); 663 asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
666 } 664 }
667 665
668
669 } 666 }
670 else { 667 else {
671 printf (_("Invalid SNMP version: %s\n"), proto); 668 printf (_("Invalid SNMP version: %s\n"), proto);
@@ -673,17 +670,11 @@ validate_arguments ()
673 exit (STATE_UNKNOWN); 670 exit (STATE_UNKNOWN);
674 } 671 }
675 672
676
677
678
679 return OK; 673 return OK;
680} 674}
681 675
682 676
683 677
684
685
686
687char * 678char *
688clarify_message (char *msg) 679clarify_message (char *msg)
689{ 680{
@@ -721,7 +712,6 @@ clarify_message (char *msg)
721 712
722 713
723 714
724
725int 715int
726check_num (int i) 716check_num (int i)
727{ 717{
@@ -766,7 +756,6 @@ check_num (int i)
766 756
767 757
768 758
769
770int 759int
771lu_getll (unsigned long *ll, char *str) 760lu_getll (unsigned long *ll, char *str)
772{ 761{
@@ -782,7 +771,6 @@ lu_getll (unsigned long *ll, char *str)
782 771
783 772
784 773
785
786int 774int
787lu_getul (unsigned long *ul, char *str) 775lu_getul (unsigned long *ul, char *str)
788{ 776{
@@ -798,7 +786,6 @@ lu_getul (unsigned long *ul, char *str)
798 786
799 787
800 788
801
802/* trim leading whitespace 789/* trim leading whitespace
803 if there is a leading quote, make sure it balances */ 790 if there is a leading quote, make sure it balances */
804 791
@@ -815,7 +802,6 @@ thisarg (char *str)
815 802
816 803
817 804
818
819/* if there's a leading quote, advance to the trailing quote 805/* if there's a leading quote, advance to the trailing quote
820 set the trailing quote to '\x0' 806 set the trailing quote to '\x0'
821 if the string continues, advance beyond the comma */ 807 if the string continues, advance beyond the comma */
@@ -851,9 +837,6 @@ nextarg (char *str)
851 837
852 838
853 839
854
855
856
857void 840void
858print_help (void) 841print_help (void)
859{ 842{
@@ -960,6 +943,8 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
960 printf (_(UT_SUPPORT)); 943 printf (_(UT_SUPPORT));
961} 944}
962 945
946
947
963void 948void
964print_usage (void) 949print_usage (void)
965{ 950{