[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smartmontools-support
Subject:    [smartmontools-support] Problems with thousand separator in some
From:       "=?ISO-8859-1?Q?Niklas_Laxstr=F6m?=" <niklas.laxstrom () gmail ! com>
Date:       2006-06-24 17:52:36
Message-ID: 501f5b5d0606241052g70d1b6f0nf86fbc732d761879 () mail ! gmail ! com
[Download RAW message or body]

Hello,
The search is broken, so please forgive me if this has been reported
before. Smartmontools uses locale dependent thousand separator, but
assumes it's only one char (byte) long. This gives results like [1] on
fi_FI.utf8 locale, where thousand separator is two-byte utf-8
character, but only first byte is outputted.

[1] http://nike.users.idler.fi/smartmontools.png

Here is the suggested patch to correct the behaviour. It works on my
machine at least.

Index: ataprint.c
===================================================================
RCS file: /cvsroot/smartmontools/sm5/ataprint.c,v
retrieving revision 1.165
diff -u -r1.165 ataprint.c
--- ataprint.c  20 Jun 2006 19:23:32 -0000      1.165
+++ ataprint.c  24 Jun 2006 17:24:28 -0000
@@ -448,7 +448,7 @@
   unsigned short lba_64         = drive->words088_255[103-88];
   uint64_t capacity_short=0, capacity=0, threedigits, power_of_ten;
   int started=0,k=1000000000;
-  char separator=',';
+  char *separator=",";

   // get correct character to use as thousands separator
 #ifdef HAVE_LOCALE_H
@@ -456,7 +456,7 @@
   setlocale (LC_ALL, "");
   currentlocale=localeconv();
   if (*(currentlocale->thousands_sep))
-    separator=*(currentlocale->thousands_sep);
+    separator=currentlocale->thousands_sep;
 #endif // #ifdef HAVE_LOCALE_H

   // if drive supports LBA addressing, determine 32-bit LBA capacity
@@ -488,7 +488,7 @@
     capacity   -= threedigits*power_of_ten;
     if (started)
       // we have already printed some digits
-      pstring += sprintf(pstring, "%c%03"PRIu64, separator, threedigits);
+      pstring += sprintf(pstring, "%s%03"PRIu64, separator, threedigits);
     else if (threedigits || k==6) {
       // these are the first digits that we are printing
       pstring += sprintf(pstring, "%"PRIu64, threedigits);


-- 
Niklas Laxström

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Smartmontools-support mailing list
Smartmontools-support@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/smartmontools-support

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic