[comp.mail.elm] ELM 2.3 PL0 unofficial patch for 8-bit characters.

chip@tct.uucp (Chip Salzenberg) (05/26/90)

According to prc@erbe.se (Robert Claeson):
>In article <26597A7A.5CFF@tct.uucp>, chip@tct.uucp (Chip Salzenberg) writes:
>> So it is not portable to call isprint() unless isascii() is true.
>
>If so, how could one possibly use isprint() to identify printable, non-
>ASCII characters?

You can't, at least not portably.  You need another method of
determining what's printable, because isprint() won't cut it.
-- 
Chip, the new t.b answer man    <chip%tct@ateng.com>, <uunet!ateng!tct!chip>

chip@chinacat.Unicom.COM (Chip Rosenthal) (05/27/90)

In article <265D8143.39EE@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes:
>[re: isascii() && isprint() vs. 8-bit chars]
>You can't, at least not portably.  You need another method of
>determining what's printable, because isprint() won't cut it.

Maybe what is needed is a printable() macro.  Elm already uses a
whitespace() macro which gets around the analogous isspace() problems.

-- 
Chip Rosenthal                            |  You aren't some icon carved out
chip@chinacat.Unicom.COM                  |  of soap, sent down here to clean
Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt

prc@erbe.se (Robert Claeson) (05/28/90)

In article <1273@chinacat.Unicom.COM>, chip@chinacat.Unicom.COM (Chip Rosenthal) writes:
> In article <265D8143.39EE@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes:

> >You can't, at least not portably.  You need another method of
> >determining what's printable, because isprint() won't cut it.

> Maybe what is needed is a printable() macro.  Elm already uses a
> whitespace() macro which gets around the analogous isspace() problems.

You mean along the lines of:

/* Side effects */

#ifdef HAS_STABLE_ISPRINT
#define printable(c) (isprint(c))
#else
#define printable(c) (isascii(c) && isprint(c))
#endif
-- 
          Robert Claeson      E-mail: rclaeson@erbe.se
	  ERBE DATA AB

chip@chinacat.Unicom.COM (Chip Rosenthal) (05/29/90)

prc@erbe.se (Robert Claeson) writes:
|chip@chinacat.Unicom.COM (Chip Rosenthal) writes:
|> Maybe what is needed is a printable() macro.
|
|You mean along the lines of:
|#ifdef HAS_STABLE_ISPRINT
|#define printable(c) (isprint(c))
|#else
|#define printable(c) (isascii(c) && isprint(c))
|#endif

Yeah.  But the tough part is defining a Configure module which decides
whether or not isprint() should be qualified with isascii().  Asking the
user for the answer is probably not a viable method.

-- 
Chip Rosenthal                            |  You aren't some icon carved out
chip@chinacat.Unicom.COM                  |  of soap, sent down here to clean
Unicom Systems Development, 512-482-8260  |  up my reputation.  -John Hiatt

prc@erbe.se (Robert Claeson) (05/31/90)

In article <1281@chinacat.Unicom.COM>, chip@chinacat.Unicom.COM (Chip Rosenthal) writes:

> Yeah.  But the tough part is defining a Configure module which decides
> whether or not isprint() should be qualified with isascii().  Asking the
> user for the answer is probably not a viable method.

Is it safe to assume that UNIX System V Release 3.0 and upwards have
safe isprint()s and the others not? I haven't found a system yet that
don't pass this test, but then, I haven't checked them all.

-- 
          Robert Claeson      E-mail: rclaeson@erbe.se
	  ERBE DATA AB