[sane-devel] Schedule for release of sane-backends 1.0.24
m. allan noah
kitno455 at gmail.com
Mon Aug 26 01:24:45 UTC 2013
That is one option. The other is to do own own upcasing, as per this patch:
diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c
index 6b50f03..c9571e9 100644
@@ -67,6 +67,19 @@
#define BACKEND_NAME sanei_debug
+/* If a frontend enables translations, the system toupper()
+ * call will use the LANG env var. We need to use ascii
+ * instead, so the debugging env var name matches the docs.
+ * This is a particular problem in Turkish, where 'i' does
+ * not capitalize to 'I' */
+toupper_ascii (int c)
+ if(c > 0x60 && c < 0x7b)
+ return c - 0x20;
+ return c;
sanei_init_debug (const char * backend, int * var)
@@ -80,7 +93,7 @@ sanei_init_debug (const char * backend, int * var)
if (i >= sizeof (buf) - 1)
- buf[i] = toupper(ch);
+ buf[i] = toupper_ascii(ch);
buf[i] = '\0';
On Sun, Aug 25, 2013 at 9:15 PM, Olaf Meeuwissen
<olaf.meeuwissen at avasys.jp> wrote:
> m. allan noah writes:
>> No, this is a good issue to discuss. I wonder, can the Turkish
>> keyboard make the capitol 'I'? If not, then what is the correct fix?
> A lot of string functions do take the current locale into account when
> doing their thing, so the correct fix is to use the right locale before
> calling toupper().
> IIRC, backend names are expected to be valid C identifiers which means
> they are ASCII. Setting the LC_CTYPE to "C" before use of toupper() and
> reverting when done should fix this issue. Patch attached.
>>> This is due to limitation of toupper() function w.r.t. character 'i' when
>>> locale is set to turkish.
>>> As toupper('i') is 'i' (i.e. still the small i) ,the SANE_DEBUG_RICOH etc
>>> would not work correctly.
>>> Root cause:
>>> Env variable set by user as mentioned in the man page is as below
>>> export SANE_DEBUG_RICOH=4
>>> Sane's search logic's final string generated for ricoh backend would be
>>> SANE_DEBUG_RiCOH --->note mismatch for i
> Hope this helps,
> Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION
> FSF Associate Member #1962 Help support software freedom
"The truth is an offense, but not a sin"
More information about the sane-devel