rchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strerror.3 \
string.3 strlen.3 strmode.3 strdup.3 strpbrk.3 strrchr.3 strsep.3 \
strsignal.3 strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 strlcpy.3 \
- wcstok.3 wmemchr.3 wcswidth.3 wcsdup.3
+ wcscasecmp.3 wcscat.3 wcschr.3 wcscmp.3 wcs
On Fri, Jul 08, 2011 at 04:51:47PM +0100, Nicholas Marriott wrote:
> Except it isn't sizeof(b) or '\0'.
Ooops, right. It's counting in units of ints.
> This actually passes the right length to mbstowcs as well:
This looks good
Except it isn't sizeof(b) or '\0'. This actually passes the right length
to mbstowcs as well:
Index: wcsdup.3
===
RCS file: /cvs/src/lib/libc/string/wcsdup.3,v
retrieving revision 1.2
diff -u -p -r1.2 wcsdup.3
--- wc
On Fri, Jul 08, 2011 at 10:18:59AM +0200, Stefan Sperling wrote:
> On Fri, Jul 08, 2011 at 03:01:45AM +0100, Nicholas Marriott wrote:
> > Index: wcsdup.3
> > ===
> > RCS file: /cvs/src/lib/libc/string/wcsd
On Fri, Jul 08, 2011 at 03:01:45AM +0100, Nicholas Marriott wrote:
> Index: wcsdup.3
> ===
> RCS file: /cvs/src/lib/libc/string/wcsdup.3,v
> retrieving revision 1.2
> diff -u -p -r1.2 wcsdup.3
> --- wcsdup.3 5 Jul 2
gt; The standard says the multibyte-encoding used by L"" is
> implementation-defined. I am not entirely sure what rules our various
> gcc versions apply. L"" might not work in all locales on OpenBSD.
> So generally it's better to use something like mbstowcs
On Tue, 05 Jul 2011 20:03:14 BST, Nicholas Marriott wrote:
> I think they would be better as separate pages but I'm not volunteering
> to do it, at least not right now ;-). FreeBSD and NetBSD look to have a
> few split out.
Me neither :-) This would be a easy project for someone with a
little bit
Hi
I think they would be better as separate pages but I'm not volunteering
to do it, at least not right now ;-). FreeBSD and NetBSD look to have a
few split out.
On Tue, Jul 05, 2011 at 02:17:23PM -0400, Todd C. Miller wrote:
> On Tue, 05 Jul 2011 20:12:44 +0200, Stefan Sperling wrote:
>
> > L"
s
On Tue, Jul 05, 2011 at 01:52:06PM -0400, Todd C. Miller wrote:
> The code looks fine to me, though you don't need to include stdint.h.
> It is basically identical to what is in FreeBSD too.
>
> In the man page example:
>
> if (p = wcsdup(L"foobar"), p ==
On Tue, 05 Jul 2011 20:12:44 +0200, Stefan Sperling wrote:
> L"" is C99 notation for wide character string literals.
> wchar_t is an int, so a pointer increment will consume 4 bytes, not 1.
> L"foobar" results in the byte string:
> "f\0\0\0o\0\0\0o\0\0\0b\0\0\0a\0\0\0r\0\0\0\0\0\0\0"
Aha, thanks
On Tue, Jul 05, 2011 at 01:52:06PM -0400, Todd C. Miller wrote:
> Also, what is that
> 'L' doing there before the "foobar"? Is it some sort of wide char
> thing I'm not aware of?
>
L"" is C99 notation for wide character string literals.
wchar_t is an int, so a pointer increment will consume 4 byt
On Tue, Jul 05, 2011 at 01:52:06PM -0400, Todd C. Miller wrote:
> if ((p = wcsdup(L"foobar")) == NULL) {
>
> or just split it into two lines. Using the comma operator that way
> is correct but likely to confuse some readers. Also, what is that
> 'L' doin
The code looks fine to me, though you don't need to include stdint.h.
It is basically identical to what is in FreeBSD too.
In the man page example:
if (p = wcsdup(L"foobar"), p == NULL) {
I think it is best to either write this as:
if ((p = wcsdup(L"foobar"))
On Mon, Jul 04, 2011, Nicholas Marriott wrote:
> Yep, you're right, the check is unnecessary, I'll remove it.
somewhere on my todo list is adding checks like these to strlcpy to
catch underflow. but it makes more sense when the length is user
provided.
>
>
> On Sun, Jul 03, 2011 at 10:21:38PM
Yep, you're right, the check is unnecessary, I'll remove it.
On Sun, Jul 03, 2011 at 10:21:38PM -0600, Matthew Dempsky wrote:
> On Sun, Jul 3, 2011 at 10:11 PM, Nicholas Marriott
> wrote:
> > From NetBSD with overflow check and a couple of minor tweaks by me.
> >
> > libc minor bump.
> >
> > Nee
On Sun, Jul 3, 2011 at 10:11 PM, Nicholas Marriott
wrote:
> From NetBSD with overflow check and a couple of minor tweaks by me.
>
> libc minor bump.
>
> Needed for libedit with wide characters which might be nice sometime.
>
> Comments/ok?
ok matthew@
> + len = wcslen(str) + 1;
> + i
char_t *wcsdup(const wchar_t *);
int wcscasecmp(const wchar_t *, const wchar_t *);
int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
#endif
Index: lib/libc/shlib_version
===
RCS file: /cvs/src/lib/libc/shlib_version,v
retr
17 matches
Mail list logo