WRAP_API int wrap_mvwinsnstr(WINDOW *win, int y, int x, uchar2 *str, int n) { #if defined(CURSES_WIDE) && SIZEOF_WCHAR_T == 2 return mvwins_nwstr(win, y, x, str, n); #elif defined(CURSES_WIDE) wchar_t stackbuf[BUFFER_SIZE]; xbuffer xinput, xoutput; int ret; xbuf_init_uc(&xinput, str, n, XBUF_FILL); xbuf_init_wc(&xoutput, stackbuf, BUFFER_SIZE, XBUF_EXPANDABLE); ret = unicode_to_wchar(&xinput, &xoutput); if (ret < 0) goto do_exit; ret = xbuf_tzero_wc(&xoutput); if (ret < 0) goto do_exit; ret = mvwins_nwstr(win, y, x, xbuf_data_wc(&xoutput), xbuf_len_wc(&xoutput)); do_exit: xbuf_free(&xoutput); return ret; #else char stackbuf[BUFFER_SIZE]; xbuffer xinput, xoutput; int ret; xbuf_init_uc(&xinput, str, n, XBUF_FILL); xbuf_init(&xoutput, stackbuf, BUFFER_SIZE, XBUF_EXPANDABLE); ret = unicode_to_char(&xinput, &xoutput); if (ret < 0) goto do_exit; ret = xbuf_tzero(&xoutput); if (ret < 0) goto do_exit; ret = mvwinsnstr(win, y, x, xbuf_data(&xoutput), xbuf_len(&xoutput)); do_exit: xbuf_free(&xoutput); return ret; #endif }
/* * mvinsnstr -- * Do an insert-n-string on the line at (y, x). */ int mvinsnstr(int y, int x, const char *str, int n) { return mvwinsnstr(stdscr, y, x, str, n); }