[darcs-devel] darcs patch: use C library version of isprint in ColourPrinter

ptp at lysator.liu.se ptp at lysator.liu.se
Fri Nov 11 09:36:24 PST 2005


This is a very very iffy patch.

It switsh to the foreign C library isprint function to fix
a problem of incorrect 8-bit locale escaping if compiling
darcs with GHC 2.4.

I don't understand fully what I'm doing, I just copied and
changed from other examples untill it compiled.  Especially
I'm unsure about the type casting.  The declaration should
probably be CInt -> CInt and the invocation should convert
this into Char -> Bool.

I don't know if it works.  I don't have GHC 2.4 (yet).
Perhaps GHC 2.4 doesn't activate the current locale, and
then this fix won't help.  The change only affects darcs
if DARCS_DONT_ESCPAE_ISPRINT=1.  If the locale is Latin1,
chars in the range \80--\9f should be escaped and the
range \a0--\ff should not.  Without this fix (and GHC 2.4)
I believe everything in the range \80--\ff is not escaped
(which is bad because \80--\9f are control codes that perhaps
can spoof the terminal).

I know darcs is becoming 1.0.4 about just now, and I'm sorry
I don't have more time for this right now, but if this change
looks undangerous and someone can confirm that it works,
it would be really good if it makes it into 1.0.4 (for those
with GHC 2.4 and 8-bit locales).


Fri Nov 11 17:43:04 CET 2005  Tommy Pettersson <ptp at lysator.liu.se>
  * use C library version of isprint in ColourPrinter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 1574 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-devel/attachments/20051111/284c49c5/attachment.bin


More information about the darcs-devel mailing list