James Carlson <[EMAIL PROTECTED]> wrote:

> > This is a conclusion from the C standard....
>
> I should have been more explicit.  It seemed like a strange place for
> a comment like this.

If you did see the modifications done to my software by people from SuSE or 
Debian, you would understand why I put a lot of such comments into my 
sources ;-)


> One may check for overflow of the target buffer (and thus truncation
> of the result) using strlcat(3C) like this:
>
>       if (strlcat(dst, src, dstsize) >= dstsize)
>               string_is_too_big();
>
> The same works well with snprintf.  With the formulation of strcatl
> you've proposed, it's not possible to check for this error condition
> in any reasonable way following the call.  The user must do something
> like this instead:
>
>       if (strlen(dst) + strlen(src) >= dstsize)
>               string_is_too_big();
>       (void) strcatl(dst, src, (char *)NULL);
>
> ... and that seems unfortunate to me.

OK, there are still places where I use strcatl() although it is much less than
my usage for strcalt() in 1985.

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]     (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to