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
*** 28,44 ****
#include "lint.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "mblocal.h"
size_t
! wcsrtombs(char *_RESTRICT_KYWD dst, const wchar_t **_RESTRICT_KYWD src,
! size_t len, mbstate_t *_RESTRICT_KYWD ps)
{
static mbstate_t mbs;
if (ps == NULL)
ps = &mbs;
! return (__wcsnrtombs(dst, src, ULONG_MAX, len, ps));
}
--- 29,54 ----
#include "lint.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
+ #include "localeimpl.h"
+ #include "lctype.h"
#include "mblocal.h"
size_t
! wcsrtombs_l(char *_RESTRICT_KYWD dst, const wchar_t **_RESTRICT_KYWD src,
! size_t len, mbstate_t *_RESTRICT_KYWD ps, locale_t loc)
{
static mbstate_t mbs;
if (ps == NULL)
ps = &mbs;
! return (loc->ctype->lc_wcsnrtombs(dst, src, ULONG_MAX, len, ps));
! }
!
! size_t
! wcsrtombs(char *_RESTRICT_KYWD dst, const wchar_t **_RESTRICT_KYWD src,
! size_t len, mbstate_t *_RESTRICT_KYWD ps)
! {
! return (wcsrtombs_l(dst, src, len, ps, uselocale(NULL)));
}