diff options
Diffstat (limited to 'tests/rwfile.c')
-rw-r--r-- | tests/rwfile.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/rwfile.c b/tests/rwfile.c index bf279ab..81a3508 100644 --- a/tests/rwfile.c +++ b/tests/rwfile.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <locale.h> int main ( int argc, char **argv ) { @@ -68,6 +69,17 @@ int main ( int argc, char **argv ) (void) memset(size,0,sizeof(size)); (void) memset(filespec,0,sizeof(filespec)); + /* + Initialize locale from environment variables (LANG, LC_CTYPE, + LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES, + LC_ALL), but require that LC_NUMERIC use common conventions. The + LC_NUMERIC variable affects the decimal point character and + thousands separator character for the formatted input/output + functions and string conversion functions. + */ + (void) setlocale(LC_ALL,""); + (void) setlocale(LC_NUMERIC,"C"); + if (LocaleNCompare("rwfile",argv[0],7) == 0) InitializeMagick((char *) NULL); else @@ -195,10 +207,10 @@ int main ( int argc, char **argv ) goto program_exit; } - (void) strncpy(infile, argv[arg], MaxTextExtent ); + (void) strncpy(infile, argv[arg], MaxTextExtent-1 ); infile[MaxTextExtent-1]='\0'; arg++; - (void) strncpy( format, argv[arg], MaxTextExtent ); + (void) strncpy( format, argv[arg], MaxTextExtent-1 ); format[MaxTextExtent-1]='\0'; magick_info=GetMagickInfo(format,&exception); |