Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD

*** 1,6 **** --- 1,7 ---- /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2002-2004 Tim J. Robbins. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
*** 27,44 **** #include "lint.h" #include <limits.h> #include <stdlib.h> #include <wchar.h> #include "mblocal.h" size_t ! mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s, size_t n) { static const mbstate_t initial = { 0 }; mbstate_t mbs; const char *sp; mbs = initial; sp = s; ! return (__mbsnrtowcs(pwcs, &sp, ULONG_MAX, n, &mbs)); } --- 28,55 ---- #include "lint.h" #include <limits.h> #include <stdlib.h> #include <wchar.h> + #include <locale.h> #include "mblocal.h" + #include "localeimpl.h" + #include "lctype.h" size_t ! mbstowcs_l(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s, ! size_t n, locale_t loc) { static const mbstate_t initial = { 0 }; mbstate_t mbs; const char *sp; mbs = initial; sp = s; ! return (loc->ctype->lc_mbsnrtowcs(pwcs, &sp, ULONG_MAX, n, &mbs)); ! } ! ! size_t ! mbstowcs(wchar_t *_RESTRICT_KYWD pwcs, const char *_RESTRICT_KYWD s, size_t n) ! { ! return (mbstowcs_l(pwcs, s, n, uselocale(NULL))); }