diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 43bd4800..9dc848c1 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2003-09-12 Marcel Telka + + * configure.ac (AC_CHECK_FUNCS): Added swprintf. + * src/cmd/print.c (cmd_print_run): Added alternative implementation of the header printing using + snprintf() for platforms without swprintf() function available. + 2003-09-12 Marcel Telka * configure.ac (AC_INIT): Changed version number to 0.5.1. diff --git a/jtag/configure.ac b/jtag/configure.ac index d1b9cdc4..209c7a42 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -89,6 +89,7 @@ else fi AC_CHECK_FUNCS(getline getdelim) +AC_CHECK_FUNCS(swprintf) AC_CHECK_HEADERS(linux/ppdev.h) diff --git a/jtag/src/cmd/print.c b/jtag/src/cmd/print.c index 57eadbaa..ecafc049 100644 --- a/jtag/src/cmd/print.c +++ b/jtag/src/cmd/print.c @@ -38,7 +38,9 @@ static int cmd_print_run( char *params[] ) { char format[100]; +#if HAVE_SWPRINTF wchar_t wformat[100]; +#endif /* HAVE_SWPRINTF */ wchar_t wheader[100]; char header[100]; int i; @@ -65,11 +67,17 @@ cmd_print_run( char *params[] ) if (noheader == 0) { snprintf( format, 100, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING, MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER ); +#if HAVE_SWPRINTF if (mbstowcs( wformat, format, 100 ) == -1) printf( _("(%d) String conversion failed!\n"), __LINE__ ); swprintf( wheader, 100, wformat, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); if (wcstombs( header, wheader, 100 ) == -1) printf( _("(%d) String conversion failed!\n"), __LINE__ ); +#else /* HAVE_SWPRINTF */ + snprintf( header, 100, format, _("Manufacturer"), _("Part"), _("Stepping"), _("Instruction"), _("Register") ); + if (mbstowcs( wheader, header, 100 ) == -1) + printf( _("(%d) String conversion failed!\n"), __LINE__ ); +#endif /* HAVE_SWPRINTF */ printf( header ); for (i = 0; i < wcslen( wheader ); i++ )