003 File Manager
Current Path:
/usr/src/contrib/ncurses/ncurses/base
usr
/
src
/
contrib
/
ncurses
/
ncurses
/
base
/
📁
..
📄
MKkeyname.awk
(6.48 KB)
📄
MKlib_gen.sh
(13.34 KB)
📄
MKunctrl.awk
(5.76 KB)
📄
README
(2.52 KB)
📄
define_key.c
(3.73 KB)
📄
key_defined.c
(3.61 KB)
📄
keybound.c
(3.17 KB)
📄
keyok.c
(4.03 KB)
📄
legacy_coding.c
(3.01 KB)
📄
lib_addch.c
(15.66 KB)
📄
lib_addstr.c
(7.21 KB)
📄
lib_beep.c
(3.54 KB)
📄
lib_bkgd.c
(6.98 KB)
📄
lib_box.c
(5.24 KB)
📄
lib_chgat.c
(3.42 KB)
📄
lib_clear.c
(2.77 KB)
📄
lib_clearok.c
(2.78 KB)
📄
lib_clrbot.c
(3.28 KB)
📄
lib_clreol.c
(3.5 KB)
📄
lib_color.c
(28.66 KB)
📄
lib_colorset.c
(3.12 KB)
📄
lib_delch.c
(3.1 KB)
📄
lib_delwin.c
(3.61 KB)
📄
lib_dft_fgbg.c
(4.27 KB)
📄
lib_driver.c
(4.88 KB)
📄
lib_echo.c
(3.37 KB)
📄
lib_endwin.c
(3.42 KB)
📄
lib_erase.c
(3.64 KB)
📄
lib_flash.c
(3.53 KB)
📄
lib_freeall.c
(5.58 KB)
📄
lib_getch.c
(18.86 KB)
📄
lib_getstr.c
(6.7 KB)
📄
lib_hline.c
(3.55 KB)
📄
lib_immedok.c
(2.75 KB)
📄
lib_inchstr.c
(3.16 KB)
📄
lib_initscr.c
(4.18 KB)
📄
lib_insch.c
(5.2 KB)
📄
lib_insdel.c
(3 KB)
📄
lib_insnstr.c
(3.85 KB)
📄
lib_instr.c
(4.2 KB)
📄
lib_isendwin.c
(3.01 KB)
📄
lib_leaveok.c
(2.78 KB)
📄
lib_mouse.c
(52.49 KB)
📄
lib_move.c
(2.97 KB)
📄
lib_mvwin.c
(4.87 KB)
📄
lib_newterm.c
(10.81 KB)
📄
lib_newwin.c
(10.96 KB)
📄
lib_nl.c
(3.53 KB)
📄
lib_overlay.c
(6.42 KB)
📄
lib_pad.c
(10.73 KB)
📄
lib_printw.c
(4.91 KB)
📄
lib_redrawln.c
(3.52 KB)
📄
lib_refresh.c
(9.38 KB)
📄
lib_restart.c
(4.4 KB)
📄
lib_scanw.c
(4.05 KB)
📄
lib_screen.c
(24.15 KB)
📄
lib_scroll.c
(5.8 KB)
📄
lib_scrollok.c
(2.78 KB)
📄
lib_scrreg.c
(2.96 KB)
📄
lib_set_term.c
(21.57 KB)
📄
lib_slk.c
(7.85 KB)
📄
lib_slkatr_set.c
(3.58 KB)
📄
lib_slkatrof.c
(3.28 KB)
📄
lib_slkatron.c
(3.29 KB)
📄
lib_slkatrset.c
(3.05 KB)
📄
lib_slkattr.c
(3.09 KB)
📄
lib_slkclear.c
(3.52 KB)
📄
lib_slkcolor.c
(3.66 KB)
📄
lib_slkinit.c
(3.63 KB)
📄
lib_slklab.c
(3.17 KB)
📄
lib_slkrefr.c
(5.66 KB)
📄
lib_slkset.c
(5.02 KB)
📄
lib_slktouch.c
(3.01 KB)
📄
lib_touch.c
(3.77 KB)
📄
lib_ungetch.c
(3.58 KB)
📄
lib_vline.c
(3.57 KB)
📄
lib_wattroff.c
(3.09 KB)
📄
lib_wattron.c
(3.1 KB)
📄
lib_winch.c
(2.78 KB)
📄
lib_window.c
(7.83 KB)
📄
nc_panel.c
(2.81 KB)
📄
new_pair.c
(9.92 KB)
📄
resizeterm.c
(14.29 KB)
📄
safe_sprintf.c
(7.86 KB)
📄
sigaction.c
(3.62 KB)
📄
tries.c
(4.86 KB)
📄
use_window.c
(2.79 KB)
📄
version.c
(2.59 KB)
📄
vsscanf.c
(8.54 KB)
📄
wresize.c
(8.41 KB)
Editing: lib_addstr.c
/**************************************************************************** * Copyright 2019,2020 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * * and: Eric S. Raymond <esr@snark.thyrsus.com> * * * * Rewritten 2001-2004 to support wide-characters by * * Sven Verdoolaege * * Thomas Dickey * ****************************************************************************/ /* ** lib_addstr.c * ** The routines waddnstr(), waddchnstr(). ** */ #include <curses.priv.h> MODULE_ID("$Id: lib_addstr.c,v 1.56 2020/02/02 23:34:34 tom Exp $") NCURSES_EXPORT(int) waddnstr(WINDOW *win, const char *astr, int n) { const char *str = astr; int code = ERR; T((T_CALLED("waddnstr(%p,%s,%d)"), (void *) win, _nc_visbufn(astr, n), n)); if (win && (str != 0)) { TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); code = OK; if (n < 0) n = (int) strlen(astr); TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); while ((n-- > 0) && (*str != '\0')) { NCURSES_CH_T ch; TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str))); SetChar(ch, UChar(*str++), A_NORMAL); if (_nc_waddch_nosync(win, ch) == ERR) { code = ERR; break; } } _nc_synchook(win); } TR(TRACE_VIRTPUT, ("waddnstr returns %d", code)); returnCode(code); } NCURSES_EXPORT(int) waddchnstr(WINDOW *win, const chtype *astr, int n) { NCURSES_SIZE_T y, x; int code = OK; int i; struct ldat *line; T((T_CALLED("waddchnstr(%p,%p,%d)"), (void *) win, (const void *) astr, n)); if (!win || !astr) returnCode(ERR); y = win->_cury; x = win->_curx; if (n < 0) { const chtype *str; n = 0; for (str = (const chtype *) astr; *str != 0; str++) n++; } if (n > win->_maxx - x + 1) n = win->_maxx - x + 1; if (n == 0) returnCode(code); line = &(win->_line[y]); for (i = 0; i < n && ChCharOf(astr[i]) != '\0'; ++i) { SetChar2(line->text[i + x], astr[i]); } CHANGED_RANGE(line, x, (NCURSES_SIZE_T) (x + n - 1)); _nc_synchook(win); returnCode(code); } #if USE_WIDEC_SUPPORT NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *s) { int result = 0; if (s != 0) { while (CharOf(s[result]) != L'\0') { result++; } } return result; } NCURSES_EXPORT(int) wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n) { static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); NCURSES_SIZE_T y; NCURSES_SIZE_T x; int code = OK; struct ldat *line; int i, j, start, len, end; T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), (void *) win, _nc_viscbuf(astr, n), n)); if (!win) returnCode(ERR); y = win->_cury; x = win->_curx; if (n < 0) { n = _nc_wchstrlen(astr); } if (n > win->_maxx - x + 1) n = win->_maxx - x + 1; if (n == 0) returnCode(code); line = &(win->_line[y]); start = x; end = x + n - 1; /* * Reset orphaned cells of multi-column characters that extend up to the * new string's location to blanks. */ if (x > 0 && isWidecExt(line->text[x])) { for (i = 0; i <= x; ++i) { if (!isWidecExt(line->text[x - i])) { /* must be isWidecBase() */ start -= i; while (i > 0) { line->text[x - i--] = _nc_render(win, blank); } break; } } } /* * Copy the new string to the window. */ for (i = 0; i < n && CharOf(astr[i]) != L'\0' && x <= win->_maxx; ++i) { if (isWidecExt(astr[i])) continue; len = _nc_wacs_width(CharOf(astr[i])); if (x + len - 1 <= win->_maxx) { line->text[x] = _nc_render(win, astr[i]); if (len > 1) { for (j = 0; j < len; ++j) { if (j != 0) { line->text[x + j] = line->text[x]; } SetWidecExt(line->text[x + j], j); } } else { len = 1; } x = (NCURSES_SIZE_T) (x + len); end += len - 1; } else { break; } } /* * Set orphaned cells of multi-column characters which lie after the new * string to blanks. */ while (x <= win->_maxx && isWidecExt(line->text[x])) { line->text[x] = _nc_render(win, blank); ++end; ++x; } CHANGED_RANGE(line, start, end); _nc_synchook(win); returnCode(code); } NCURSES_EXPORT(int) waddnwstr(WINDOW *win, const wchar_t *str, int n) { int code = ERR; T((T_CALLED("waddnwstr(%p,%s,%d)"), (void *) win, _nc_viswbufn(str, n), n)); if (win && (str != 0)) { TR(TRACE_VIRTPUT | TRACE_ATTRS, ("... current %s", _traceattr(WINDOW_ATTRS(win)))); code = OK; if (n < 0) n = (int) wcslen(str); TR(TRACE_VIRTPUT, ("str is not null, length = %d", n)); while ((n-- > 0) && (*str != L('\0'))) { NCURSES_CH_T ch; TR(TRACE_VIRTPUT, ("*str[0] = %#lx", (unsigned long) *str)); SetChar(ch, *str++, A_NORMAL); if (wadd_wch(win, &ch) == ERR) { code = ERR; break; } } _nc_synchook(win); } TR(TRACE_VIRTPUT, ("waddnwstr returns %d", code)); returnCode(code); } #endif
Upload File
Create Folder