2003-09-12 Marcel Telka <marcel@telka.sk>

* 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.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@564 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 22 years ago
parent 680950c502
commit bf54af7380

@ -1,3 +1,9 @@
2003-09-12 Marcel Telka <marcel@telka.sk>
* 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 <marcel@telka.sk>
* configure.ac (AC_INIT): Changed version number to 0.5.1.

@ -89,6 +89,7 @@ else
fi
AC_CHECK_FUNCS(getline getdelim)
AC_CHECK_FUNCS(swprintf)
AC_CHECK_HEADERS(linux/ppdev.h)

@ -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++ )

Loading…
Cancel
Save