diff options
Diffstat (limited to 'usr/src/lib/libc/port/print')
-rw-r--r-- | usr/src/lib/libc/port/print/doprnt.c | 16 | ||||
-rw-r--r-- | usr/src/lib/libc/port/print/vwprintf.c | 20 | ||||
-rw-r--r-- | usr/src/lib/libc/port/print/wprintf.c | 19 |
3 files changed, 19 insertions, 36 deletions
diff --git a/usr/src/lib/libc/port/print/doprnt.c b/usr/src/lib/libc/port/print/doprnt.c index c291970f8e..0c644c33bd 100644 --- a/usr/src/lib/libc/port/print/doprnt.c +++ b/usr/src/lib/libc/port/print/doprnt.c @@ -89,7 +89,7 @@ static const wchar_t widenullstr[] = L"(null)"; #define PUT(p, n) \ { \ int retp; \ - retp = put_wide(iop, &bufptr, bufferend, p, n, sflag, lc, fp); \ + retp = put_wide(iop, &bufptr, bufferend, p, n, sflag); \ if (retp == EOF) { \ return ((ssize_t)EOF); \ } \ @@ -299,7 +299,7 @@ _dowrite(const char *p, ssize_t n, FILE *iop, unsigned char **ptrptr) static int put_wide(FILE *iop, unsigned char **bufptr, unsigned char *bufferend, wchar_t *p, size_t n, - int sflag, void *lc, int (*fp_wctomb)(void *, char *, wchar_t)) + int sflag) { unsigned char *newbufptr; wchar_t *q; @@ -330,7 +330,7 @@ put_wide(FILE *iop, unsigned char **bufptr, q = p; tmpq = tmpp; for (len = 0, i = 0; i < n; i++) { - r = fp_wctomb(lc, tmpq, *q++); + r = wctomb(tmpq, *q++); if (r == -1) { lfree(tmpp, tsize); errno = EILSEQ; @@ -423,9 +423,6 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag) #ifdef _WIDE int sflag = 0; size_t maxcount; - mbstate_t *mbst; - void *lc; - int (*fp)(void *, char *, wchar_t); #else int snflag = 0; #endif /* _WIDE */ @@ -592,13 +589,6 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag) sflag = 1; if (!sflag) { - mbst = _getmbstate(iop); - if (mbst == NULL) { - errno = EBADF; - return (EOF); - } - lc = __mbst_get_lc_and_fp((const mbstate_t *)mbst, - (void (*(*))(void))&fp, FP_WCTOMB); #endif /* _WIDE */ /* if first I/O to the stream get a buffer */ /* Note that iop->_base should not equal 0 for sprintf and vsprintf */ diff --git a/usr/src/lib/libc/port/print/vwprintf.c b/usr/src/lib/libc/port/print/vwprintf.c index ae64a62688..3ba770c96a 100644 --- a/usr/src/lib/libc/port/print/vwprintf.c +++ b/usr/src/lib/libc/port/print/vwprintf.c @@ -23,8 +23,10 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Use is subject to license terms. + */ #include "lint.h" #include "file64.h" @@ -65,11 +67,8 @@ vwprintf(const wchar_t *format, va_list ap) FLOCKFILE(lk, stdout); - if (_set_orientation_wide(stdout, NULL, NULL, 0) == -1) { - errno = EBADF; - FUNLOCKFILE(lk); - return (EOF); - } + if (GET_NO_MODE(stdout)) + _setorientation(stdout, _WC_MODE); if (!(stdout->_flag & _IOWRT)) { /* if no write flag */ if (stdout->_flag & _IORW) { @@ -114,11 +113,8 @@ vfwprintf(FILE *iop, const wchar_t *format, va_list ap) FLOCKFILE(lk, iop); - if (_set_orientation_wide(iop, NULL, NULL, 0) == -1) { - errno = EBADF; - FUNLOCKFILE(lk); - return (EOF); - } + if (GET_NO_MODE(iop)) + _setorientation(iop, _WC_MODE); if (!(iop->_flag & _IOWRT)) { /* if no write flag */ diff --git a/usr/src/lib/libc/port/print/wprintf.c b/usr/src/lib/libc/port/print/wprintf.c index 4cdfe715fa..dc7d207766 100644 --- a/usr/src/lib/libc/port/print/wprintf.c +++ b/usr/src/lib/libc/port/print/wprintf.c @@ -23,8 +23,11 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Use is subject to license terms. + */ -#pragma ident "%Z%%M% %I% %E% SMI" #include "lint.h" #include "file64.h" @@ -63,11 +66,8 @@ wprintf(const wchar_t *format, ...) va_start(ap, format); FLOCKFILE(lk, stdout); - if (_set_orientation_wide(stdout, NULL, NULL, 0) == -1) { - errno = EBADF; - FUNLOCKFILE(lk); - return (EOF); - } + if (GET_NO_MODE(stdout)) + _setorientation(stdout, _WC_MODE); if (!(stdout->_flag & _IOWRT)) { /* if no write flag */ @@ -109,11 +109,8 @@ fwprintf(FILE *iop, const wchar_t *format, ...) FLOCKFILE(lk, iop); - if (_set_orientation_wide(iop, NULL, NULL, 0) == -1) { - errno = EBADF; - FUNLOCKFILE(lk); - return (EOF); - } + if (GET_NO_MODE(iop)) + _setorientation(iop, _WC_MODE); if (!(iop->_flag & _IOWRT)) { /* if no write flag */ |