[ECOS] wcstombs
Klaas Gadeyne
klaas.gadeyne@fmtc.be
Thu Aug 10 07:12:00 GMT 2006
On Wed, 9 Aug 2006, Jonathan Larmour wrote:
> Klaas Gadeyne wrote:
>> So the next question: Is there reason why the implementation is not
>> conform the Single unix spec?
>
> The short answer: eCos is not UNIX.
>
> The longer answer: eCos does try to comply with C90 and C99 (although it
> doesn't by a long way with the latter), and selected parts of POSIX. UNIX
> compatibility is a "would be nice" thing, but not if it means adding bells
> and whistles that just bloat code until eCos slowly grows to be the size of
> UNIX. Therefore bells and whistles that only exist in the SUS are unlikely to
> be implemented.
Then, only for those who are interested: The following patch works fine
for me (without too much code bloat I hope :-), but please check...
cvs diff wcstombs.cxx
Index: wcstombs.cxx
===================================================================
RCS file:
/cvs/ecos/ecos/packages/language/c/libc/i18n/current/src/wcstombs.cxx,v
retrieving revision 1.3
diff -r1.3 wcstombs.cxx
88c88
< <[s]> is <<NULL>> or is the empty string;
---
> <[s]> is the empty string;
196,202c196,209
<
< if (n != 0) {
< do {
< if ((*s++ = (char) *pwcs++) == 0)
< break;
< count++;
< } while (--n != 0);
---
>
> if (s == NULL){
> while (*pwcs++ != 0){
> count++;
> }
> }
> else {
> if (n != 0) {
> do {
> if ((*s++ = (char) *pwcs++) == 0)
> break;
> count++;
> } while (--n != 0);
> }
Klaas
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
More information about the Ecos-discuss
mailing list