From 92cd137176830bcdfbd477f151ba22d456b2e31c Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Fri, 8 Aug 2003 03:51:02 +0000 Subject: markup for translation git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@661 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 85c6753..91022ba 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -64,9 +64,10 @@ int show_all=FALSE; const char *progname = "check_nt"; int process_arguments(int, char **); -void print_usage(void); -void print_help(void); void preparelist(char *string); +int strtoularray(unsigned long *array, char *string, char *delim); +void print_help(void); +void print_usage(void); int main(int argc, char **argv){ int result; @@ -91,10 +92,10 @@ int main(int argc, char **argv){ int uphours=0; int upminutes=0; - asprintf(&req_password,"None"); + asprintf(&req_password, _("None")); if(process_arguments(argc,argv)==ERROR) - usage("Could not parse arguments\n"); + usage(_("Could not parse arguments\n")); /* initialize alarm signal handling */ signal(SIGALRM,socket_timeout_alarm_handler); @@ -116,15 +117,15 @@ int main(int argc, char **argv){ else if(vars_to_check==CHECK_CPULOAD){ if (check_value_list==TRUE) { - if (strtolarray(&lvalue_list,value_list,",")==TRUE) { + if (strtoularray(&lvalue_list,value_list,",")==TRUE) { /* -l parameters is present with only integers */ return_code=STATE_OK; - asprintf(&temp_string,"CPU Load"); - while (lvalue_list[0+offset]>(unsigned long)0 && + asprintf(&temp_string,_("CPU Load")); + while (lvalue_list[0+offset]> (unsigned long)0 && lvalue_list[0+offset]<=(unsigned long)17280 && - lvalue_list[1+offset]>=(unsigned long)0 && + lvalue_list[1+offset]> (unsigned long)0 && lvalue_list[1+offset]<=(unsigned long)100 && - lvalue_list[2+offset]>=(unsigned long)0 && + lvalue_list[2+offset]> (unsigned long)0 && lvalue_list[2+offset]<=(unsigned long)100) { /* loop until one of the parameters is wrong or not present */ @@ -147,7 +148,7 @@ int main(int argc, char **argv){ else if(utilization >= lvalue_list[1+offset] && return_code=0) { - asprintf(&temp_string,"%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)", + asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"), value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); @@ -221,14 +222,14 @@ int main(int argc, char **argv){ } else { - asprintf(&output_message,"Free disk space : Invalid drive "); + asprintf(&output_message,_("Free disk space : Invalid drive ")); return_code=STATE_UNKNOWN; } } else - asprintf(&output_message,"wrong -l argument"); + asprintf(&output_message,_("wrong -l argument")); } else - asprintf(&output_message,"missing -l parameters"); + asprintf(&output_message,_("missing -l parameters")); } @@ -237,7 +238,7 @@ int main(int argc, char **argv){ if (check_value_list==TRUE) { preparelist(value_list); /* replace , between services with & to send the request */ asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6, - (show_all==TRUE)?"ShowAll":"ShowFail",value_list); + (show_all==TRUE)?_("ShowAll"):_("ShowFail"),value_list); result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer)); if(result!=STATE_OK) return result; @@ -251,7 +252,7 @@ int main(int argc, char **argv){ asprintf(&output_message, "%s",temp_string); } else - asprintf(&output_message,"No service/process specified"); + asprintf(&output_message,_("No service/process specified")); } else if(vars_to_check==CHECK_MEMUSE) { @@ -269,7 +270,7 @@ int main(int argc, char **argv){ mem_commitLimit=atof(strtok(recv_buffer,"&")); mem_commitByte=atof(strtok(NULL,"&")); percent_used_space = (mem_commitByte / mem_commitLimit) * 100; - asprintf(&output_message,"Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)", + asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), mem_commitLimit / 1048576, mem_commitByte / 1048567, percent_used_space, (mem_commitLimit - mem_commitByte) / 1048576, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100); @@ -325,7 +326,7 @@ int main(int argc, char **argv){ } else { - asprintf(&output_message,"No counter specified"); + asprintf(&output_message,_("No counter specified")); result=STATE_UNKNOWN; } } @@ -368,7 +369,7 @@ int main(int argc, char **argv){ } else { - asprintf(&output_message,"No file specified"); + asprintf(&output_message,_("No file specified")); result=STATE_UNKNOWN; } } @@ -382,6 +383,10 @@ int main(int argc, char **argv){ } + + + + /* process command-line arguments */ int process_arguments(int argc, char **argv){ int c; @@ -448,7 +453,7 @@ int process_arguments(int argc, char **argv){ if (is_intnonneg(optarg)) server_port=atoi(optarg); else - die(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname); + die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname); break; case 'v': if(strlen(optarg)<4) @@ -505,21 +510,53 @@ int process_arguments(int argc, char **argv){ } -void print_usage(void) -{ - printf("Usage: %s -H host -v variable [-p port] [-w warning] [-c critical] [-l params] [-d SHOWALL] [-t timeout]\n",progname); + + + + +int strtoularray(unsigned long *array, char *string, char *delim) { + /* split a delimited string into a long array */ + int idx=0; + char *t1; + + for (idx=0;idx,,.\n\ should be less than 24*60.\n\ Thresholds are percentage and up to 10 requests can be done in one shot.\n\ - ie: -l 60,90,95,120,90,95\n"); - printf ("\ + ie: -l 60,90,95,120,90,95\n")); + printf (_("\ UPTIME = Get the uptime of the machine.\n\ - No specific parameters. No warning or critical threshold\n"); - printf ("\ + No specific parameters. No warning or critical threshold\n")); + printf (_("\ USEDDISKSPACE = Size and percentage of disk use.\n\ Request a -l parameter containing the drive letter only.\n\ - Warning and critical thresholds can be specified with -w and -c.\n"); - printf ("\ + Warning and critical thresholds can be specified with -w and -c.\n")); + printf (_("\ MEMUSE = Memory use.\n\ - Warning and critical thresholds can be specified with -w and -c.\n"); - printf ("\ + Warning and critical thresholds can be specified with -w and -c.\n")); + printf (_("\ SERVICESTATE = Check the state of one or several services.\n\ Request a -l parameters with the following syntax:\n\ -l ,,,...\n\ You can specify -d SHOWALL in case you want to see working services\n\ - in the returned string.\n"); - printf ("\ + in the returned string.\n")); + printf (_("\ PROCSTATE = Check if one or several process are running.\n\ - Same syntax as SERVICESTATE.\n"); - printf ("\ + Same syntax as SERVICESTATE.\n")); + printf (_("\ COUNTER = Check any performance counter of Windows NT/2000.\n\ Request a -l parameters with the following syntax:\n\ -l \"\\\\\\\\counter\",\"\n\ @@ -576,39 +613,20 @@ Windows NT/2000/XP server.\n\n"); is given to a printf output command which require a float parameters.\n\ Some examples:\n\ \"Paging file usage is %%.2f %%%%\"\n\ - \"%%.f %%%% paging file used.\"\n"); - printf ("Notes:\n\ + \"%%.f %%%% paging file used.\"\n")); + printf (_("Notes:\n\ - The NSClient service should be running on the server to get any information\n\ (http://nsclient.ready2run.nl).\n\ - - Critical thresholds should be lower than warning thresholds\n"); + - Critical thresholds should be lower than warning thresholds\n")); } -int strtolarray(unsigned long *array, char *string, char *delim) { - /* split a delimited string into a long array */ - int idx=0; - char *t1; - for (idx=0;idx\n\n%s\n", - copyright, authors, email, summary); + + printf (_("Copyright (c) 1999-2001 Ethan Galstad \n")); + printf (_(COPYRIGHT), copyright, email); + + printf(_("\ +This plugin will attempt to open an SMTP connection with the host.\n\n")); + print_usage (); - printf ("\nOptions:\n"); - printf (options, SMTP_PORT, SMTP_EXPECT, mail_command, from_arg, - DEFAULT_SOCKET_TIMEOUT); - support (); + + printf (_(UT_HELP_VRSN)); + + printf (_(UT_HOST_PORT), 'p', myport); + + printf (_(UT_IPv46)); + + printf (_("\ + -e, --expect=STRING\n\ + String to expect in first line of server response (default: '%s')\n\ + -n, nocommand\n\ + Suppress SMTP command\n\ + -C, --command=STRING\n\ + SMTP command (default: '%s')\n\ + -f, --from=STRING\n\ + FROM-address to include in MAIL command, required by Exchange 2000\n\ + (default: '%s')\n"), SMTP_EXPECT, mail_command, from_arg); + + printf (_(UT_WARN_CRIT)); + + printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + + printf (_(UT_VERBOSE)); + + printf(_("\n\ +Successul connects return STATE_OK, refusals and timeouts return\n\ +STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful\n\ +connects, but incorrect reponse messages from the host result in\n\ +STATE_WARNING return values.\n")); + + printf (_(UT_SUPPORT)); } @@ -395,8 +388,11 @@ print_help (void) void print_usage (void) { - printf ("Usage: %s %s\n" - " %s --help\n" - " %s --version\n", - progname, option_summary, progname, progname); + printf ("\ +Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ + [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); + printf (_(UT_HLP_VRS), progname, progname); } + + + -- cgit v0.10-9-g596f