Code

Removed old terminate function (Bug 1093491)
[nagiosplug.git] / plugins / check_snmp.c
index ab110fbd0fb86c0593f92ac191127754c973a46c..ef411e15fe59208e521b66fbdb7a723cbaff06a2 100644 (file)
@@ -251,7 +251,7 @@ main (int argc, char **argv)
                    eval_method[i] & WARN_NE) {
                        p2 = strpbrk (p2, "0123456789");
                        if (p2 == NULL) 
-                               die (STATE_UNKNOWN,"No valid data returned");
+                               die (STATE_UNKNOWN,_("No valid data returned"));
                        response_value[i] = strtoul (p2, NULL, 10);
                        iresult = check_num (i);
                        asprintf (&show, "%lu", response_value[i]);
@@ -281,7 +281,7 @@ main (int argc, char **argv)
                                iresult = STATE_CRITICAL;
                        }
 #else
-                       printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
+                       printf (_("Call for regex which was not a compiled option"));
                        exit (STATE_UNKNOWN);
 #endif
                }
@@ -398,9 +398,7 @@ process_arguments (int argc, char **argv)
 
                switch (c) {
                case '?':       /* usage */
-                       printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
-                       print_usage ();
-                       exit (STATE_UNKNOWN);
+                       usage2 (_("Unknown argument"), optarg);
                case 'h':       /* help */
                        print_help ();
                        exit (STATE_OK); 
@@ -513,7 +511,7 @@ process_arguments (int argc, char **argv)
                        eval_method[jj++] = CRIT_REGEX;
                        ii++;
 #else
-                       printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
+                       printf (_("call for regex which was not a compiled option"));
                        exit (STATE_UNKNOWN);
 #endif
                        break;
@@ -532,8 +530,7 @@ process_arguments (int argc, char **argv)
                                labels_size += 8;
                                labels = realloc (labels, labels_size);
                                if (labels == NULL)
-                                       die (STATE_UNKNOWN,
-                                                                                _("Could not realloc() labels[%d]"), nlabels);
+                                       die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), nlabels);
                        }
                        labels[nlabels - 1] = optarg;
                        ptr = thisarg (optarg);
@@ -545,7 +542,7 @@ process_arguments (int argc, char **argv)
                                        labels_size += 8;
                                        labels = realloc (labels, labels_size);
                                        if (labels == NULL)
-                                               die (STATE_UNKNOWN, _("Could not realloc() labels\n"));
+                                               die (STATE_UNKNOWN, _("Could not reallocate labels\n"));
                                }
                                labels++;
                                ptr = thisarg (ptr);
@@ -562,8 +559,7 @@ process_arguments (int argc, char **argv)
                                unitv_size += 8;
                                unitv = realloc (unitv, unitv_size);
                                if (unitv == NULL)
-                                       die (STATE_UNKNOWN,
-                                                                                _("Could not realloc() units [%d]\n"), nunits);
+                                       die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), nunits);
                        }
                        unitv[nunits - 1] = optarg;
                        ptr = thisarg (optarg);
@@ -648,7 +644,7 @@ validate_arguments ()
                }
                else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
                        if ( secname == NULL || authpasswd == NULL) {
-                               printf (_("Missing secname (%s) or authpassword (%s) ! \n)"),secname, authpasswd );
+                               printf (_("Missing secname (%s) or authpassword (%s) ! \n"),secname, authpasswd );
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -656,7 +652,7 @@ validate_arguments ()
                }
                else if ( strcmp(seclevel, "authPriv") == 0 ) {
                        if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
-                               printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
+                               printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -665,9 +661,7 @@ validate_arguments ()
                
        }
        else {
-               printf (_("Invalid SNMP version: %s\n"), proto);
-               print_usage ();
-               exit (STATE_UNKNOWN);                           
+               usage2 (_("Invalid SNMP version"), proto);
        }
                        
        return OK;
@@ -795,7 +789,7 @@ thisarg (char *str)
        str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
        if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */
                if (strlen (str) == 1 || !strstr (str + 1, "'"))
-                       die (STATE_UNKNOWN, "Unbalanced quotes\n");
+                       die (STATE_UNKNOWN, _("Unbalanced quotes\n"));
        }
        return str;
 }