diff options
author | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
---|---|---|
committer | stevel@tonic-gate <none@none> | 2005-06-14 00:00:00 -0700 |
commit | 7c478bd95313f5f23a4c958a745db2134aa03244 (patch) | |
tree | c871e58545497667cbb4b0a4f2daf204743e1fe7 /usr/src/lib/libcurses | |
download | illumos-joyent-7c478bd95313f5f23a4c958a745db2134aa03244.tar.gz |
OpenSolaris Launch
Diffstat (limited to 'usr/src/lib/libcurses')
438 files changed, 43308 insertions, 0 deletions
diff --git a/usr/src/lib/libcurses/Makefile b/usr/src/lib/libcurses/Makefile new file mode 100644 index 0000000000..27a9dc4a70 --- /dev/null +++ b/usr/src/lib/libcurses/Makefile @@ -0,0 +1,138 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 1990-2002 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/Makefile +# +# The builds occur in isa subdirectories. +# + +include ../Makefile.lib + +SUBDIRS = spec .WAIT $(MACH) $(BUILD64) $(MACH64) + +# conditional assignments +all := TARGET= all +install := TARGET= install +clean := TARGET= clean +clobber := TARGET= clobber +lint := TARGET= lint +test := TARGET= test + +SCRFILES = screen/keycaps \ + screen/curses.h \ + screen/keyname.c \ + screen/termcap.c \ + screen/tifget.c \ + screen/tiget.c \ + screen/tifnames.c \ + screen/tnames.c \ + screen/tinames.c \ + screen/term.h + +# definitions for install_h target +HDRS= curses.h term.h unctrl.h +HDRDIR= screen + +LIBRARY= libcurses.a +TEXT_DOMAIN= SUNW_OST_OSLIB +XGETFLAGS= -a +MSGDIRS= screen +POFILE= $(LIBRARY:.a=.po) +POFILES= generic.po +CLEANFILES += $(SCRFILES) + +# term.h doesn't pass cstyle due to numerous lines exceeding the 80 character +# limit. maketerm.ed can probably be fixed to prevent this, but it is arguable +# if this work would ever be worth it. +# +screen/term.check := CSTYLE_TAIL = | grep -v "line > 80 characters" | true + +.KEEP_STATE: + +all: $(SCRFILES) .WAIT $(SUBDIRS) + +install: all .WAIT $(SUBDIRS) + +clean clobber lint test: $(SUBDIRS) + +install_h: $(ROOTHDRS) + +check: $(CHECKHDRS) + +scrfiles: $(SCRFILES) + +$(MACH) $(MACH64) spec: FRC + @cd $@; pwd; $(MAKE) $(TARGET) + +ED = ed + +screen/curses.h: screen/curses.ed screen/keycaps screen/tmp + (cd screen; $(ED) - < curses.ed) + +screen/keycaps: screen/caps + grep "KEY_" screen/caps > screen/keycaps + @if tail -1 screen/keycaps | grep 'KEY_MOUSE' > /dev/null;then :; \ + else echo new keys!! must change setkeymap.c; exit 1;fi + +screen/keyname.c: screen/keyname.sh screen/keycaps + (cd screen; sh keyname.sh) + +screen/termcap.c: screen/termcap.ed + (cd screen; $(ED) - < termcap.ed) + (cd screen; $(RM) bool num str) + +screen/tifget.c: screen/tifget.ed + (cd screen; $(ED) - < tifget.ed) + +screen/tiget.c: screen/tiget.ed + (cd screen; $(ED) - < tiget.ed) + +screen/tnames.c screen/tinames.c screen/tifnames.c \ +screen/term.h: screen/maketerm.ed + (cd screen; $(ED) - < maketerm.ed) + +screen/tmp: + rm -rf $@ + mkdir $@ + +_msg: $(MSGDOMAIN) $(POFILE) + $(RM) $(MSGDOMAIN)/$(POFILE) + $(CP) $(POFILE) $(MSGDOMAIN) + +$(POFILE): .WAIT $(POFILES) + $(RM) $@ + $(CAT) $(POFILES) > $@ + +generic.po: + $(RM) messages.po + $(XGETTEXT) $(XGETFLAGS) `$(GREP) -l gettext *.[ch]* */*.[ch]*` + $(SED) -e '/^# msg/d' -e '/^domain/d' messages.po > $@ + $(RM) messages.po + +FRC: + +include ../Makefile.targ diff --git a/usr/src/lib/libcurses/Makefile.com b/usr/src/lib/libcurses/Makefile.com new file mode 100644 index 0000000000..093db7a79a --- /dev/null +++ b/usr/src/lib/libcurses/Makefile.com @@ -0,0 +1,236 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/screen/Makefile +# +LIBRARY= libcurses.a +VERS= .1 + +OBJECTS= $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) + +OBJS1= _addch.o _addchnstr.o _addchstr.o _addnstr.o _addstr.o \ + _attroff.o _attron.o _attrset.o _beep.o _bkgd.o \ + _bkgdset.o _border.o _box.o _clear.o _clrtobot.o \ + _clrtoeol.o _crmode.o _del_curterm.o _delch.o _deleteln.o \ + _echo.o _echochar.o _erase.o _fixterm.o _flash.o \ + _garbagdlins.o _garbagedwin.o _getch.o _getstr.o \ + _halfdelay.o _hline.o _inch.o _inchnstr.o _inchstr.o \ + _innstr.o _insch.o _insdelln.o _insertln.o _insnstr.o \ + _insstr.o _instr.o _intrflush.o _meta.o _move.o \ + _mvaddch.o _mvaddchnstr.o _mvaddchstr.o _mvaddnstr.o \ + _mvaddstr.o _mvdelch.o _mvgetch.o _mvgetstr.o _mvhline.o \ + _mvinch.o _mvinchnstr.o _mvinchstr.o _mvinnstr.o \ + _mvinsch.o _mvinsnstr.o _mvinsstr.o _mvinstr.o _mvvline.o \ + _mvwaddch.o _mvwaddchnst.o _mvwaddchstr.o _mvwaddnstr.o \ + _mvwaddstr.o _mvwdelch.o _mvwgetch.o _mvwgetstr.o \ + _mvwhline.o _mvwinch.o _mvwinchnst.o _mvwinchstr.o \ + _mvwinnstr.o _mvwinsch.o _mvwinsnstr.o _mvwinsstr.o \ + _mvwinstr.o _mvwvline.o _newterm.o _nl.o _nocrmode.o \ + _noecho.o _nonl.o _noqiflush.o _overlay.o _overwrite.o \ + _qiflush.o _refresh.o _resetterm.o _saveterm.o \ + _scr_init.o _scr_restore.o _scr_set.o _scrl.o _scroll.o \ + _set_curterm.o _set_term.o _setscrreg.o _slk_init.o \ + _standend.o _standout.o _subpad.o _timeout.o _touchline.o \ + _unctrl.o _vline.o _waddchstr.o _waddstr.o _wclear.o \ + _wdeleteln.o _werase.o _winsertln.o _winsstr.o \ + _wstandend.o _wstandout.o V2.__sscans.o V2._sprintw.o \ + V2.makenew.o V3.box.o V3.initscr.o V3.m_addch.o V3.m_addstr.o \ + V3.m_clear.o V3.m_erase.o V3.m_initscr.o V3.m_move.o V3.m_newterm.o \ + V3.m_refresh.o V3.newterm.o V3.pechochar.o V3.upd_old_y.o \ + V3.vidattr.o V3.vidputs.o V3.waddch.o V3.wattroff.o V3.wattron.o \ + V3.wattrset.o V3.wechochar.o V3.winsch.o baudrate.o can_change.o \ + color_cont.o cbreak.o chkinput.o clearok.o copywin.o curs_set.o \ + curserr.o curses.o def_prog.o delay.o delay_out.o \ + delkey.o delkeymap.o delscreen.o delterm.o delwin.o \ + derwin.o doupdate.o draino.o dupwin.o endwin.o erasechar.o \ + flushinp.o getattrs.o getbegyx.o getbkgd.o getmaxyx.o \ + getparyx.o getsyx.o gettmode.o getwin.o getyx.o has_colors.o \ + has_ic.o has_il.o idcok.o idlok.o immedok.o init_acs.o init_color.o \ + init_costs.o init_pair.o initscr.o is_linetou.o is_wintou.o \ + keyname.o keypad.o killchar.o leaveok.o + +OBJS2= longname.o makenew.o memSset.o meta.o mvcur.o \ + mvderwin.o mvprintw.o mvscanw.o mvwin.o mvwprintw.o \ + mvwscanw.o napms.o newkey.o newpad.o newscreen.o \ + newwin.o nocbreak.o nodelay.o noraw.o \ + notimeout.o outch.o overlap.o pechochar.o pnoutref.o \ + prefresh.o printw.o putp.o putwin.o quick_echo.o \ + raw.o redrawwin.o reset_sh.o resetty.o restart.o \ + ring.o ripoffline.o savetty.o scanw.o scr_all.o \ + scr_dump.o scr_ll_dump.o scr_reset.o scrollok.o setcurscreen.o \ + setcurterm.o setecho.o setkeymap.o setnonl.o setqiflush.o \ + setsyx.o setterm.o setupterm.o slk_atroff.o slk_atron.o \ + slk_atrset.o slk_clear.o slk_label.o \ + slk_noutref.o slk_refresh.o slk_restore.o slk_set.o slk_start.o \ + slk_touch.o subwin.o syncok.o tcsearch.o termattrs.o \ + termcap.o termerr.o termname.o tgetch.o tgoto.o \ + tifget.o tifnames.o tiget.o tinames.o tinputfd.o \ + tnames.o touchwin.o tparm.o tputs.o trace.o \ + tstp.o ttimeout.o typeahead.o unctrl.o ungetch.o \ + untouchwin.o vidputs.o vidupdate.o vwprintw.o \ + vwscanw.o waddch.o waddchnstr.o waddnstr.o wattroff.o \ + wattron.o wattrset.o wbkgd.o wbkgdset.o wborder.o \ + wclrtobot.o wclrtoeol.o wdelch.o wechochar.o wgetch.o \ + wgetstr.o whline.o winch.o winchnstr.o winchstr.o \ + winnstr.o winsch.o winsdelln.o winsnstr.o winstr.o \ + wmove.o wnoutref.o wprintw.o wredrawln.o wrefresh.o \ + wscanw.o wscrl.o wsetscrreg.o wsyncdown.o wsyncup.o \ + wtimeout.o wtouchln.o wvline.o pair_cont.o start_col.o \ + mouse.o + +OBJS3= mbaddch.o mbcharlen.o mbdisplen.o mbgetwidth.o \ + mbinch.o mbinsshift.o mbmove.o mbtranslate.o \ + pechowchar.o tgetwch.o ungetwch.o waddnwstr.o \ + waddwch.o waddwchnstr.o wechowchar.o wgetwstr.o \ + wgetwch.o winnwstr.o winsnwstr.o winswch.o \ + winwch.o winwchnstr.o winwstr.o \ + use_env.o + +OBJS4= _addnwstr.o _addwch.o _addwchnstr.o _addwchstr.o \ + _addwstr.o _echowchar.o _getnwstr.o _getwch.o \ + _getwstr.o _innwstr.o _insnwstr.o _inswch.o \ + _inswstr.o _inwch.o _inwchnstr.o _inwchstr.o \ + _inwstr.o _mvaddnwstr.o _mvaddwch.o _mvaddwchnstr.o \ + _mvaddwchstr.o _mvaddwstr.o _mvgetnwstr.o _mvgetwch.o \ + _mvgetwstr.o _mvinnwstr.o _mvinsnwstr.o _mvinswch.o \ + _mvinswstr.o _mvinwch.o _mvinwchnstr.o _mvinwchstr.o \ + _mvinwstr.o _mvwaddnwstr.o _mvwaddwch.o _mvwaddwchnstr.o \ + _mvwaddwchstr.o _mvwaddwstr.o _mvwgetnwstr.o _mvwgetwch.o \ + _mvwgetwstr.o _mvwinnwstr.o _mvwinsnwstr.o _mvwinswch.o \ + _mvwinswstr.o _mvwinwch.o _mvwinwchnstr.o _mvwinwchstr.o \ + _mvwinwstr.o _waddwchstr.o _waddwstr.o _winswstr.o \ + _winwchstr.o + +OBJS5= mbstowcs.o mbtowc.o wcstombs.o wctomb.o + +OBJS6= wmovenextch.o wmoveprevch.o wadjcurspos.o print.o iexpand.o \ + cexpand.o infotocap.o + +# include library definitions +include ../../Makefile.lib + +# install this library in the root filesystem +include ../../Makefile.rootfs + +MAPFILE= $(MAPDIR)/mapfile +MAPOPTS= $(MAPFILE:%=-M %) + +SRCS= $(OBJECTS:%.o=../screen/%.c) + +LIBS = $(DYNLIB) $(LINTLIB) + +# definitions for lint + +$(LINTLIB):= SRCS=../screen/llib-lcurses + +LINTOUT= lint.out +LINTSRC= $(LINTLIB:%.ln=%) + +ROOTLINTDIR= $(ROOTLIBDIR) +ROOTLINT= $(LINTSRC:%=$(ROOTLINTDIR)/%) +ROOTLINTDIR64= $(ROOTLIBDIR64) +ROOTLINT64= $(LINTSRC:%=$(ROOTLINTDIR64)/%) +ROOTLINKS64= $(ROOTLIBDIR64)/$(LIBLINKS) + +CLEANFILES += $(LINTOUT) $(LINTLIB) + +CFLAGS += $(CCVERBOSE) +DYNFLAGS += $(MAPOPTS) +LDLIBS += -lc + +CPPFLAGS += -I../screen -I../../common/inc + +ED = ed +RM = rm -f + +# +# If and when somebody gets around to messaging this, CLOBBERFILE should not +# be cleared (so that any .po file will be clobbered. +# +CLOBBERFILES= libcurses.so libcurses.so$(VERS) + +.KEEP_STATE: + +all: $(LIBS) + +lint: lintcheck + +$(DYNLIB): $(MAPFILE) + +$(MAPFILE): + @cd $(MAPDIR); $(MAKE) mapfile + + +# install rule for 32-bit libcurses.a +$(ROOTLIBDIR)/%.a: %.a + $(INS.file) + cd $(ROOTLIBDIR); \ + $(RM) libtermlib.a libtermcap.a; \ + ln libcurses.a libtermlib.a; \ + ln libcurses.a libtermcap.a; + +# install rules for 32-bit libcurses.so in /usr/lib +$(ROOTLINKS) := INS.liblink= \ + $(RM) $@; $(SYMLINK) $(LIBLINKPATH)$(LIBLINKS)$(VERS) $@; \ + cd $(ROOTLIBDIR); \ + $(RM) libtermlib.so$(VERS) libtermcap.so$(VERS); \ + $(RM) libtermlib.so libtermcap.so; \ + $(SYMLINK) libcurses.so$(VERS) libtermlib.so$(VERS); \ + $(SYMLINK) libcurses.so$(VERS) libtermcap.so$(VERS); \ + $(SYMLINK) libtermlib.so$(VERS) libtermlib.so; \ + $(SYMLINK) libtermcap.so$(VERS) libtermcap.so; + +# +# Include library targets +# +include ../../Makefile.targ + +pics/%.o: ../screen/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + +# install rule for lint library target +$(ROOTLINTDIR)/%: ../screen/% + $(INS.file) + cd $(ROOTLINTDIR); \ + $(RM) llib-ltermcap llib-ltermlib ; \ + $(SYMLINK) ./llib-lcurses llib-ltermcap; \ + $(SYMLINK) ./llib-lcurses llib-ltermlib; \ + $(RM) llib-ltermcap.ln llib-ltermlib.ln ; \ + $(SYMLINK) ./llib-lcurses.ln llib-ltermcap.ln; \ + $(SYMLINK) ./llib-lcurses.ln llib-ltermlib.ln; + +# install rule for 64 bit lint library target +$(ROOTLINTDIR64)/%: ../screen/% + $(INS.file) + cd $(ROOTLINTDIR64); \ + $(RM) llib-ltermcap llib-ltermlib ; \ + $(SYMLINK) ./llib-lcurses llib-ltermcap; \ + $(SYMLINK) ./llib-lcurses llib-ltermlib; \ + $(RM) llib-ltermcap.ln llib-ltermlib.ln ; \ + $(SYMLINK) ./llib-lcurses.ln llib-ltermcap.ln; \ + $(SYMLINK) ./llib-lcurses.ln llib-ltermlib.ln; diff --git a/usr/src/lib/libcurses/amd64/Makefile b/usr/src/lib/libcurses/amd64/Makefile new file mode 100644 index 0000000000..4733b9a3dd --- /dev/null +++ b/usr/src/lib/libcurses/amd64/Makefile @@ -0,0 +1,47 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +MAPDIR= ../spec/amd64 + +include ../Makefile.com +include ../../Makefile.lib.64 + +.KEEP_STATE: + +$(ROOTLIBDIR64)/$(LIBLINKS) := INS.liblink64 = \ + -$(RM) $@; \ + cd $(ROOTLIBDIR64); \ + $(RM) libtermlib.so$(VERS) libtermcap.so$(VERS);\ + $(RM) libtermlib.so libtermcap.so; \ + $(SYMLINK) $(LIBLINKS)$(VERS) $(LIBLINKS); \ + $(SYMLINK) libcurses.so$(VERS) libtermlib.so$(VERS); \ + $(SYMLINK) libcurses.so$(VERS) libtermcap.so$(VERS); \ + $(SYMLINK) libtermcap.so$(VERS) libtermcap.so; \ + $(SYMLINK) libtermlib.so$(VERS) libtermlib.so + +install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64) diff --git a/usr/src/lib/libcurses/i386/Makefile b/usr/src/lib/libcurses/i386/Makefile new file mode 100644 index 0000000000..951cf8b81d --- /dev/null +++ b/usr/src/lib/libcurses/i386/Makefile @@ -0,0 +1,38 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/i386/Makefile + +MAPDIR= ../spec/i386 + +include ../Makefile.com + +.KEEP_STATE: + +all: $(LIBS) + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libcurses/screen/V2.__sscans.c b/usr/src/lib/libcurses/screen/V2.__sscans.c new file mode 100644 index 0000000000..5ad73922f1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V2.__sscans.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +#ifdef _VR2_COMPAT_CODE +/* + * This file is provided for compatibility reasons only + * and will go away someday. Programs should reference + * vwscanw() instead. + */ + + +int +__sscans(WINDOW *win, char *fmt, va_list ap) +{ + return (vwscanw(win, fmt, ap)); +} +#endif diff --git a/usr/src/lib/libcurses/screen/V2._sprintw.c b/usr/src/lib/libcurses/screen/V2._sprintw.c new file mode 100644 index 0000000000..aee0d43d86 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V2._sprintw.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +#ifdef _VR2_COMPAT_CODE +/* + * This is only here for compatibility with SVR2 curses. + * It will go away someday. Programs should reference + * vwprintw() instead. + */ + +int +_sprintw(WINDOW *win, char *fmt, va_list ap) +{ + return (vwprintw(win, fmt, ap)); +} +#endif diff --git a/usr/src/lib/libcurses/screen/V2.makenew.c b/usr/src/lib/libcurses/screen/V2.makenew.c new file mode 100644 index 0000000000..e0af90be94 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V2.makenew.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR2_COMPAT_CODE + +WINDOW * +makenew(int num_lines, int num_cols, int begy, int begx) +{ + return (_makenew(num_lines, num_cols, begy, begx)); +} +#endif diff --git a/usr/src/lib/libcurses/screen/V3.box.c b/usr/src/lib/libcurses/screen/V3.box.c new file mode 100644 index 0000000000..02ec64724f --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.box.c @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef box +int +box(WINDOW *win, _ochtype v, _ochtype h) +{ + return (wborder(win, _FROM_OCHTYPE(v), _FROM_OCHTYPE(v), + _FROM_OCHTYPE(h), _FROM_OCHTYPE(h), 0, 0, 0, 0)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.initscr.c b/usr/src/lib/libcurses/screen/V3.initscr.c new file mode 100644 index 0000000000..216b4ea52c --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.initscr.c @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +extern void _update_old_y_area(WINDOW *, int, int, int, int); + +#ifdef _VR3_COMPAT_CODE + +#undef initscr +WINDOW * +initscr(void) +{ + _y16update = _update_old_y_area; + return (initscr32()); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_addch.c b/usr/src/lib/libcurses/screen/V3.m_addch.c new file mode 100644 index 0000000000..ae759cb411 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_addch.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_addch(int c) +{ + return (waddch(stdscr, c)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_addstr.c b/usr/src/lib/libcurses/screen/V3.m_addstr.c new file mode 100644 index 0000000000..783c39f4c8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_addstr.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_addstr(char *str) +{ + return (waddstr(stdscr, str)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_clear.c b/usr/src/lib/libcurses/screen/V3.m_clear.c new file mode 100644 index 0000000000..2864aa17cd --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_clear.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_clear(void) +{ + return (wclear(stdscr)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_erase.c b/usr/src/lib/libcurses/screen/V3.m_erase.c new file mode 100644 index 0000000000..2ced7a401e --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_erase.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_erase(void) +{ + return (werase(stdscr)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_initscr.c b/usr/src/lib/libcurses/screen/V3.m_initscr.c new file mode 100644 index 0000000000..23fda43e3f --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_initscr.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +WINDOW * +m_initscr(void) +{ + return (initscr()); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_move.c b/usr/src/lib/libcurses/screen/V3.m_move.c new file mode 100644 index 0000000000..ccc19121c2 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_move.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_move(int y, int x) +{ + return (wmove(stdscr, y, x)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_newterm.c b/usr/src/lib/libcurses/screen/V3.m_newterm.c new file mode 100644 index 0000000000..b11fac3cf6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_newterm.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +SCREEN * +m_newterm(char *type, FILE *outfptr, FILE *infptr) +{ + return (newterm(type, outfptr, infptr)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.m_refresh.c b/usr/src/lib/libcurses/screen/V3.m_refresh.c new file mode 100644 index 0000000000..673b1a7296 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.m_refresh.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +int +m_refresh(void) +{ + return (wrefresh(stdscr)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.newterm.c b/usr/src/lib/libcurses/screen/V3.newterm.c new file mode 100644 index 0000000000..dc69ed583f --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.newterm.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE + +#undef newterm +SCREEN * +newterm(char *type, FILE *outfptr, FILE *infptr) +{ + _y16update = _update_old_y_area; + return (newscreen(type, 0, 0, 0, outfptr, infptr)); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.pechochar.c b/usr/src/lib/libcurses/screen/V3.pechochar.c new file mode 100644 index 0000000000..d6515d3513 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.pechochar.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef pechochar +int +pechochar(WINDOW *win, _ochtype c) +{ + return (p32echochar(win, _FROM_OCHTYPE(c))); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.upd_old_y.c b/usr/src/lib/libcurses/screen/V3.upd_old_y.c new file mode 100644 index 0000000000..d5c9957cde --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.upd_old_y.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +void +_update_old_y_area(WINDOW *win, int nlines, int ncols, + int start_line, int start_col) +{ + int row, col, num_cols; + + for (row = start_line; nlines > 0; nlines--, row++) + for (num_cols = ncols, col = start_col; num_cols > 0; + num_cols--, col++) + /*LINTED*/ + win->_y16[row][col] = _TO_OCHTYPE(win->_y[row][col]); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.vidattr.c b/usr/src/lib/libcurses/screen/V3.vidattr.c new file mode 100644 index 0000000000..8f861ee8ec --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.vidattr.c @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +extern int _outchar(char); + +#ifdef _VR3_COMPAT_CODE +#undef vidattr + +int +vidattr(_ochtype a) +{ + vidupdate(_FROM_OCHTYPE(a), cur_term->sgr_mode, _outchar); + return (OK); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.vidputs.c b/usr/src/lib/libcurses/screen/V3.vidputs.c new file mode 100644 index 0000000000..1c6b462bd7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.vidputs.c @@ -0,0 +1,46 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef vidputs +int +vidputs(_ochtype a, int (*o)(char)) +{ + vidupdate(_FROM_OCHTYPE(a), cur_term->sgr_mode, o); + return (OK); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.waddch.c b/usr/src/lib/libcurses/screen/V3.waddch.c new file mode 100644 index 0000000000..9e23dfac59 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.waddch.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef waddch +int +waddch(WINDOW *win, _ochtype c) +{ + return (w32addch(win, _FROM_OCHTYPE(c))); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.wattroff.c b/usr/src/lib/libcurses/screen/V3.wattroff.c new file mode 100644 index 0000000000..7acf241263 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.wattroff.c @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef wattroff +int +wattroff(WINDOW *win, _ochtype attrs) +{ + win->_attrs &= (~_FROM_OCHTYPE(attrs) | win->_bkgd) & A_ATTRIBUTES; + return (OK); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.wattron.c b/usr/src/lib/libcurses/screen/V3.wattron.c new file mode 100644 index 0000000000..c752a4afb9 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.wattron.c @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef wattron +int +wattron(WINDOW *win, _ochtype attrs) +{ + win->_attrs |= _FROM_OCHTYPE(attrs) & A_ATTRIBUTES; + return (OK); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.wattrset.c b/usr/src/lib/libcurses/screen/V3.wattrset.c new file mode 100644 index 0000000000..6e91ab3773 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.wattrset.c @@ -0,0 +1,55 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef wattrset +int +wattrset(WINDOW *win, _ochtype attrs) +{ + win->_attrs = (_FROM_OCHTYPE(attrs) | win->_bkgd) & A_ATTRIBUTES; + return (OK); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.wechochar.c b/usr/src/lib/libcurses/screen/V3.wechochar.c new file mode 100644 index 0000000000..88955dc4a7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.wechochar.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef wechochar +int +wechochar(WINDOW *win, _ochtype c) +{ + return (w32echochar(win, _FROM_OCHTYPE(c))); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/V3.winsch.c b/usr/src/lib/libcurses/screen/V3.winsch.c new file mode 100644 index 0000000000..6471b99e5e --- /dev/null +++ b/usr/src/lib/libcurses/screen/V3.winsch.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR3_COMPAT_CODE +#undef winsch +int +winsch(WINDOW *win, _ochtype c) +{ + return (w32insch(win, _FROM_OCHTYPE(c))); +} +#endif /* _VR3_COMPAT_CODE */ diff --git a/usr/src/lib/libcurses/screen/_addch.c b/usr/src/lib/libcurses/screen/_addch.c new file mode 100644 index 0000000000..2c3581bbca --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addch(chtype ch) +{ + return (waddch(stdscr, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_addchnstr.c b/usr/src/lib/libcurses/screen/_addchnstr.c new file mode 100644 index 0000000000..188171a192 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addchnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addchnstr(chtype *s, int n) +{ + return (waddchnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_addchstr.c b/usr/src/lib/libcurses/screen/_addchstr.c new file mode 100644 index 0000000000..9ce633b6b1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addchstr(chtype *s) +{ + return (waddchstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_addnstr.c b/usr/src/lib/libcurses/screen/_addnstr.c new file mode 100644 index 0000000000..46711a1df5 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addnstr(char *s, int n) +{ + return (waddnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_addnwstr.c b/usr/src/lib/libcurses/screen/_addnwstr.c new file mode 100644 index 0000000000..79c1b668ef --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addnwstr(wchar_t *ws, int n) +{ + return (waddnwstr(stdscr, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_addstr.c b/usr/src/lib/libcurses/screen/_addstr.c new file mode 100644 index 0000000000..78e72a841c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addstr(char *str) +{ + return (waddstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_addwch.c b/usr/src/lib/libcurses/screen/_addwch.c new file mode 100644 index 0000000000..7e14695647 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addwch(chtype ch) +{ + return (waddwch(stdscr, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_addwchnstr.c b/usr/src/lib/libcurses/screen/_addwchnstr.c new file mode 100644 index 0000000000..527e727880 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addwchnstr(chtype *str, int n) +{ + return (waddwchnstr(stdscr, str, n)); +} diff --git a/usr/src/lib/libcurses/screen/_addwchstr.c b/usr/src/lib/libcurses/screen/_addwchstr.c new file mode 100644 index 0000000000..0c210a9f5c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addwchstr(chtype *str) +{ + return (waddwchstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_addwstr.c b/usr/src/lib/libcurses/screen/_addwstr.c new file mode 100644 index 0000000000..8f7a2a45f0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_addwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +addwstr(wchar_t *ws) +{ + return (waddwstr(stdscr, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_attroff.c b/usr/src/lib/libcurses/screen/_attroff.c new file mode 100644 index 0000000000..d907f86b9a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_attroff.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +attroff(chtype at) +{ + (void) wattroff(stdscr, at); + return (1); +} diff --git a/usr/src/lib/libcurses/screen/_attron.c b/usr/src/lib/libcurses/screen/_attron.c new file mode 100644 index 0000000000..d5c582bc79 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_attron.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +attron(chtype at) +{ + (void) wattron(stdscr, at); + return (1); +} diff --git a/usr/src/lib/libcurses/screen/_attrset.c b/usr/src/lib/libcurses/screen/_attrset.c new file mode 100644 index 0000000000..d321a2540e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_attrset.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +attrset(chtype at) +{ + (void) wattrset(stdscr, at); + return (1); +} diff --git a/usr/src/lib/libcurses/screen/_beep.c b/usr/src/lib/libcurses/screen/_beep.c new file mode 100644 index 0000000000..4f2c34a4d7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_beep.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +beep(void) +{ + (void) _ring(TRUE); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/_bkgd.c b/usr/src/lib/libcurses/screen/_bkgd.c new file mode 100644 index 0000000000..3417ddcf6f --- /dev/null +++ b/usr/src/lib/libcurses/screen/_bkgd.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +bkgd(chtype c) +{ + return (wbkgd(stdscr, c)); +} diff --git a/usr/src/lib/libcurses/screen/_bkgdset.c b/usr/src/lib/libcurses/screen/_bkgdset.c new file mode 100644 index 0000000000..f5d11d1819 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_bkgdset.c @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +void +bkgdset(chtype c) +{ + wbkgdset(stdscr, c); +} diff --git a/usr/src/lib/libcurses/screen/_border.c b/usr/src/lib/libcurses/screen/_border.c new file mode 100644 index 0000000000..c0ed46a935 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_border.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +border(chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) +{ + return (wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)); +} diff --git a/usr/src/lib/libcurses/screen/_box.c b/usr/src/lib/libcurses/screen/_box.c new file mode 100644 index 0000000000..2280a3d900 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_box.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +box(WINDOW *win, chtype v, chtype h) +{ + return (wborder(win, v, v, h, h, + (chtype) 0, (chtype) 0, (chtype) 0, (chtype) 0)); +} diff --git a/usr/src/lib/libcurses/screen/_clear.c b/usr/src/lib/libcurses/screen/_clear.c new file mode 100644 index 0000000000..12d83a5694 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_clear.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +clear(void) +{ + return (wclear(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_clrtobot.c b/usr/src/lib/libcurses/screen/_clrtobot.c new file mode 100644 index 0000000000..7d588095f3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_clrtobot.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +clrtobot(void) +{ + return (wclrtobot(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_clrtoeol.c b/usr/src/lib/libcurses/screen/_clrtoeol.c new file mode 100644 index 0000000000..a8d9b40949 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_clrtoeol.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +clrtoeol(void) +{ + return (wclrtoeol(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_crmode.c b/usr/src/lib/libcurses/screen/_crmode.c new file mode 100644 index 0000000000..bf84026282 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_crmode.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +#undef crmode +int +crmode(void) +{ + return (cbreak()); +} diff --git a/usr/src/lib/libcurses/screen/_curs_gettext.h b/usr/src/lib/libcurses/screen/_curs_gettext.h new file mode 100644 index 0000000000..ac2609b07d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_curs_gettext.h @@ -0,0 +1,48 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1990, 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#ifndef _CURS_GETTEXT_H +#define _CURS_GETTEXT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Header file for _curs_gettext() macro. */ +#if !defined(TEXT_DOMAIN) /* Should be defined thru -D flag. */ +# define TEXT_DOMAIN "SYS_TEST" +#endif + +char *_dgettext(const char *, const char *); +#define _curs_gettext(msg_id) _dgettext(TEXT_DOMAIN, msg_id) + +#ifdef __cplusplus +} +#endif + +#endif /* _CURS_GETTEXT_H */ diff --git a/usr/src/lib/libcurses/screen/_del_curterm.c b/usr/src/lib/libcurses/screen/_del_curterm.c new file mode 100644 index 0000000000..3bc62a2c2c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_del_curterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +del_curterm(TERMINAL *terminal) +{ + return (delterm(terminal)); +} diff --git a/usr/src/lib/libcurses/screen/_delch.c b/usr/src/lib/libcurses/screen/_delch.c new file mode 100644 index 0000000000..e7a198ce9b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_delch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +delch(void) +{ + return (wdelch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_deleteln.c b/usr/src/lib/libcurses/screen/_deleteln.c new file mode 100644 index 0000000000..fe2801d6b4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_deleteln.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +deleteln(void) +{ + return (winsdelln(stdscr, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_echo.c b/usr/src/lib/libcurses/screen/_echo.c new file mode 100644 index 0000000000..28fea7002b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_echo.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +echo(void) +{ + return (_setecho(TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/_echochar.c b/usr/src/lib/libcurses/screen/_echochar.c new file mode 100644 index 0000000000..1d1cc3384c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_echochar.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +echochar(chtype ch) +{ + return (wechochar(stdscr, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_echowchar.c b/usr/src/lib/libcurses/screen/_echowchar.c new file mode 100644 index 0000000000..b8f85cd659 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_echowchar.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +echowchar(chtype ch) +{ + return (wechowchar(stdscr, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_erase.c b/usr/src/lib/libcurses/screen/_erase.c new file mode 100644 index 0000000000..84e21e2674 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_erase.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +erase(void) +{ + return (werase(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_fixterm.c b/usr/src/lib/libcurses/screen/_fixterm.c new file mode 100644 index 0000000000..b7242ca532 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_fixterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +fixterm(void) +{ + return (reset_prog_mode()); +} diff --git a/usr/src/lib/libcurses/screen/_flash.c b/usr/src/lib/libcurses/screen/_flash.c new file mode 100644 index 0000000000..b60821e80e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_flash.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +flash(void) +{ + (void) _ring(FALSE); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/_garbagdlins.c b/usr/src/lib/libcurses/screen/_garbagdlins.c new file mode 100644 index 0000000000..3f7678abca --- /dev/null +++ b/usr/src/lib/libcurses/screen/_garbagdlins.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +garbagedlines(WINDOW *win, int start, int finish) +{ + return (wredrawln(win, start, finish)); +} diff --git a/usr/src/lib/libcurses/screen/_garbagedwin.c b/usr/src/lib/libcurses/screen/_garbagedwin.c new file mode 100644 index 0000000000..340e524ba0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_garbagedwin.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +garbagedwin(WINDOW *win) +{ + return (redrawwin(win)); +} diff --git a/usr/src/lib/libcurses/screen/_getch.c b/usr/src/lib/libcurses/screen/_getch.c new file mode 100644 index 0000000000..b0abc83a37 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_getch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +getch(void) +{ + return (wgetch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_getnwstr.c b/usr/src/lib/libcurses/screen/_getnwstr.c new file mode 100644 index 0000000000..5ed147688d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_getnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +getnwstr(wchar_t *ws, int n) +{ + return (wgetnwstr(stdscr, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_getstr.c b/usr/src/lib/libcurses/screen/_getstr.c new file mode 100644 index 0000000000..6ba495b1d1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_getstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +getstr(char *str) +{ + return (wgetstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_getwch.c b/usr/src/lib/libcurses/screen/_getwch.c new file mode 100644 index 0000000000..98544a8a92 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_getwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +getwch(void) +{ + return (wgetwch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_getwstr.c b/usr/src/lib/libcurses/screen/_getwstr.c new file mode 100644 index 0000000000..52e335ea51 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_getwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +getwstr(wchar_t *ws) +{ + return (wgetwstr(stdscr, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_halfdelay.c b/usr/src/lib/libcurses/screen/_halfdelay.c new file mode 100644 index 0000000000..96a5dc6d37 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_halfdelay.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +halfdelay(int tens) +{ + return (ttimeout(tens * 100)); +} diff --git a/usr/src/lib/libcurses/screen/_hline.c b/usr/src/lib/libcurses/screen/_hline.c new file mode 100644 index 0000000000..840657f774 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_hline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +hline(chtype horch, int num_chars) +{ + return (whline(stdscr, horch, num_chars)); +} diff --git a/usr/src/lib/libcurses/screen/_inch.c b/usr/src/lib/libcurses/screen/_inch.c new file mode 100644 index 0000000000..79cccf028e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +inch(void) +{ + return (winch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_inchnstr.c b/usr/src/lib/libcurses/screen/_inchnstr.c new file mode 100644 index 0000000000..3a2eb27306 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inchnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inchnstr(chtype *s, int n) +{ + return (winchnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_inchstr.c b/usr/src/lib/libcurses/screen/_inchstr.c new file mode 100644 index 0000000000..cac6059d92 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inchstr(chtype *s) +{ + return (winchstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_innstr.c b/usr/src/lib/libcurses/screen/_innstr.c new file mode 100644 index 0000000000..e98f946361 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_innstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +innstr(char *s, int n) +{ + return (winnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_innwstr.c b/usr/src/lib/libcurses/screen/_innwstr.c new file mode 100644 index 0000000000..0a1b06d676 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_innwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +innwstr(wchar_t *ws, int n) +{ + return (winnwstr(stdscr, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_insch.c b/usr/src/lib/libcurses/screen/_insch.c new file mode 100644 index 0000000000..1b93556f01 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insch(chtype c) +{ + return (winsch(stdscr, c)); +} diff --git a/usr/src/lib/libcurses/screen/_insdelln.c b/usr/src/lib/libcurses/screen/_insdelln.c new file mode 100644 index 0000000000..04baec6c73 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insdelln.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insdelln(int id) +{ + return (winsdelln(stdscr, id)); +} diff --git a/usr/src/lib/libcurses/screen/_insertln.c b/usr/src/lib/libcurses/screen/_insertln.c new file mode 100644 index 0000000000..ac7657d668 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insertln.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insertln(void) +{ + return (winsdelln(stdscr, 1)); +} diff --git a/usr/src/lib/libcurses/screen/_insnstr.c b/usr/src/lib/libcurses/screen/_insnstr.c new file mode 100644 index 0000000000..e72180d9ac --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insnstr(char *s, int n) +{ + return (winsnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_insnwstr.c b/usr/src/lib/libcurses/screen/_insnwstr.c new file mode 100644 index 0000000000..2433f70c61 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insnwstr(wchar_t *ws, int n) +{ + return (winsnwstr(stdscr, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_insstr.c b/usr/src/lib/libcurses/screen/_insstr.c new file mode 100644 index 0000000000..887c95cdb6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_insstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +insstr(char *s) +{ + return (winsstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_instr.c b/usr/src/lib/libcurses/screen/_instr.c new file mode 100644 index 0000000000..ecf2ed4eaa --- /dev/null +++ b/usr/src/lib/libcurses/screen/_instr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +instr(char *s) +{ + return (winstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_inswch.c b/usr/src/lib/libcurses/screen/_inswch.c new file mode 100644 index 0000000000..0aac73e437 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inswch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inswch(chtype c) +{ + return (winswch(stdscr, c)); +} diff --git a/usr/src/lib/libcurses/screen/_inswstr.c b/usr/src/lib/libcurses/screen/_inswstr.c new file mode 100644 index 0000000000..771b393f0c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inswstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inswstr(wchar_t *ws) +{ + return (winswstr(stdscr, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_intrflush.c b/usr/src/lib/libcurses/screen/_intrflush.c new file mode 100644 index 0000000000..186ad19e4f --- /dev/null +++ b/usr/src/lib/libcurses/screen/_intrflush.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +/*ARGSUSED*/ +intrflush(WINDOW *win, int flag) +{ + _setqiflush(flag); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/_inwch.c b/usr/src/lib/libcurses/screen/_inwch.c new file mode 100644 index 0000000000..ded7afcb85 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +inwch(void) +{ + return (winwch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_inwchnstr.c b/usr/src/lib/libcurses/screen/_inwchnstr.c new file mode 100644 index 0000000000..8e9d4d7347 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inwchnstr(chtype *str, int n) +{ + return (winwchnstr(stdscr, str, n)); +} diff --git a/usr/src/lib/libcurses/screen/_inwchstr.c b/usr/src/lib/libcurses/screen/_inwchstr.c new file mode 100644 index 0000000000..b9e6f1711c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inwchstr(chtype *str) +{ + return (winwchstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_inwstr.c b/usr/src/lib/libcurses/screen/_inwstr.c new file mode 100644 index 0000000000..a82b8f4da3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_inwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +inwstr(wchar_t *ws) +{ + return (winwstr(stdscr, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_meta.c b/usr/src/lib/libcurses/screen/_meta.c new file mode 100644 index 0000000000..41aee2b497 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_meta.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +/*ARGSUSED*/ +meta(WINDOW *win, int flag) +{ + return (_meta(flag)); +} diff --git a/usr/src/lib/libcurses/screen/_move.c b/usr/src/lib/libcurses/screen/_move.c new file mode 100644 index 0000000000..62f88d2add --- /dev/null +++ b/usr/src/lib/libcurses/screen/_move.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +move(int y, int x) +{ + return (wmove(stdscr, y, x)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddch.c b/usr/src/lib/libcurses/screen/_mvaddch.c new file mode 100644 index 0000000000..f65e38dd66 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddch(int y, int x, chtype ch) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : waddch(stdscr, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddchnstr.c b/usr/src/lib/libcurses/screen/_mvaddchnstr.c new file mode 100644 index 0000000000..bf1a9bf8ed --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddchnstr(int y, int x, chtype *s, int n) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : waddchnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddchstr.c b/usr/src/lib/libcurses/screen/_mvaddchstr.c new file mode 100644 index 0000000000..ac777b4b71 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddchstr(int y, int x, chtype *s) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : waddchstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddnstr.c b/usr/src/lib/libcurses/screen/_mvaddnstr.c new file mode 100644 index 0000000000..9a79960825 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddnstr(int y, int x, char *s, int n) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : waddnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddnwstr.c b/usr/src/lib/libcurses/screen/_mvaddnwstr.c new file mode 100644 index 0000000000..33d902ef9c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddnwstr(int y, int x, wchar_t *ws, int n) +{ + return (mvwaddnwstr(stdscr, y, x, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddstr.c b/usr/src/lib/libcurses/screen/_mvaddstr.c new file mode 100644 index 0000000000..7a7cabc07b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddstr.c @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Copyright 1997 by Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 1988 AT&T + * All Rights Reserved + * + * + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddstr(int y, int x, char *str) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : waddstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddwch.c b/usr/src/lib/libcurses/screen/_mvaddwch.c new file mode 100644 index 0000000000..6ba0791f4b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddwch(int y, int x, chtype ch) +{ + return (mvwaddwch(stdscr, y, x, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddwchnstr.c b/usr/src/lib/libcurses/screen/_mvaddwchnstr.c new file mode 100644 index 0000000000..c4ac322c84 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddwchnstr(int y, int x, chtype *str, int n) +{ + return (mvwaddwchnstr(stdscr, y, x, str, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddwchstr.c b/usr/src/lib/libcurses/screen/_mvaddwchstr.c new file mode 100644 index 0000000000..41367f5b36 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddwchstr(int y, int x, chtype *str) +{ + return (mvwaddwchstr(stdscr, y, x, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvaddwstr.c b/usr/src/lib/libcurses/screen/_mvaddwstr.c new file mode 100644 index 0000000000..991f24a392 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvaddwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvaddwstr(int y, int x, wchar_t *ws) +{ + return (mvwaddwstr(stdscr, y, x, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_mvdelch.c b/usr/src/lib/libcurses/screen/_mvdelch.c new file mode 100644 index 0000000000..45c6f05a08 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvdelch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvdelch(int y, int x) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : wdelch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_mvgetch.c b/usr/src/lib/libcurses/screen/_mvgetch.c new file mode 100644 index 0000000000..1db1a61dbb --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvgetch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvgetch(int y, int x) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : wgetch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_mvgetnwstr.c b/usr/src/lib/libcurses/screen/_mvgetnwstr.c new file mode 100644 index 0000000000..96ad11dc45 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvgetnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvgetnwstr(int y, int x, wchar_t *ws, int n) +{ + return (mvwgetnwstr(stdscr, y, x, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvgetstr.c b/usr/src/lib/libcurses/screen/_mvgetstr.c new file mode 100644 index 0000000000..c6ca8ad984 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvgetstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvgetstr(int y, int x, char *str) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : wgetstr(stdscr, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvgetwch.c b/usr/src/lib/libcurses/screen/_mvgetwch.c new file mode 100644 index 0000000000..fd2e3b4789 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvgetwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvgetwch(int y, int x) +{ + return (mvwgetwch(stdscr, y, x)); +} diff --git a/usr/src/lib/libcurses/screen/_mvgetwstr.c b/usr/src/lib/libcurses/screen/_mvgetwstr.c new file mode 100644 index 0000000000..6baabaa246 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvgetwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvgetwstr(int y, int x, wchar_t *ws) +{ + return (mvwgetwstr(stdscr, y, x, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_mvhline.c b/usr/src/lib/libcurses/screen/_mvhline.c new file mode 100644 index 0000000000..2678e77953 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvhline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvhline(int y, int x, chtype c, int n) +{ + return (mvwhline(stdscr, y, x, c, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinch.c b/usr/src/lib/libcurses/screen/_mvinch.c new file mode 100644 index 0000000000..d230997f8c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +mvinch(int y, int x) +{ + return (wmove(stdscr, y, x) == ERR ? (chtype) ERR : winch(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinchnstr.c b/usr/src/lib/libcurses/screen/_mvinchnstr.c new file mode 100644 index 0000000000..0d851ea4c7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinchnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* LINTLIBRARY */ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinchnstr(int y, int x, chtype *s, int n) +{ + return (mvwinchnstr(stdscr, y, x, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinchstr.c b/usr/src/lib/libcurses/screen/_mvinchstr.c new file mode 100644 index 0000000000..ea6e46d36a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* LINTLIBRARY */ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinchstr(int y, int x, chtype *s) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winchstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinnstr.c b/usr/src/lib/libcurses/screen/_mvinnstr.c new file mode 100644 index 0000000000..7bfaf19dd8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinnstr(int y, int x, char *s, int n) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinnwstr.c b/usr/src/lib/libcurses/screen/_mvinnwstr.c new file mode 100644 index 0000000000..303f441536 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinnwstr(int y, int x, wchar_t *ws, int n) +{ + return (mvwinnwstr(stdscr, y, x, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinsch.c b/usr/src/lib/libcurses/screen/_mvinsch.c new file mode 100644 index 0000000000..41679bdf32 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinsch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinsch(int y, int x, chtype c) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winsch(stdscr, c)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinsnstr.c b/usr/src/lib/libcurses/screen/_mvinsnstr.c new file mode 100644 index 0000000000..bfe3ca7f57 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinsnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinsnstr(int y, int x, char *s, int n) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winsnstr(stdscr, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinsnwstr.c b/usr/src/lib/libcurses/screen/_mvinsnwstr.c new file mode 100644 index 0000000000..2eee4cb41a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinsnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinsnwstr(int y, int x, wchar_t *ws, int n) +{ + return (mvwinsnwstr(stdscr, y, x, ws, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinsstr.c b/usr/src/lib/libcurses/screen/_mvinsstr.c new file mode 100644 index 0000000000..7a1dbb0dfd --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinsstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinsstr(int y, int x, char *s) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winsstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinstr.c b/usr/src/lib/libcurses/screen/_mvinstr.c new file mode 100644 index 0000000000..86b3e790ba --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinstr(int y, int x, char *s) +{ + return (wmove(stdscr, y, x) == ERR ? ERR : winstr(stdscr, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinswch.c b/usr/src/lib/libcurses/screen/_mvinswch.c new file mode 100644 index 0000000000..6116d6c476 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinswch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinswch(int y, int x, chtype c) +{ + return (mvwinswch(stdscr, y, x, c)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinswstr.c b/usr/src/lib/libcurses/screen/_mvinswstr.c new file mode 100644 index 0000000000..c6a6a45f8c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinswstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinswstr(int y, int x, wchar_t *ws) +{ + return (mvwinswstr(stdscr, y, x, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinwch.c b/usr/src/lib/libcurses/screen/_mvinwch.c new file mode 100644 index 0000000000..d8a0f8b53a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +mvinwch(int y, int x) +{ + return (mvwinwch(stdscr, y, x)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinwchnstr.c b/usr/src/lib/libcurses/screen/_mvinwchnstr.c new file mode 100644 index 0000000000..000bffb7ca --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinwchnstr(int y, int x, chtype *str, int n) +{ + return (mvwinwchnstr(stdscr, y, x, str, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinwchstr.c b/usr/src/lib/libcurses/screen/_mvinwchstr.c new file mode 100644 index 0000000000..79caeeced6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinwchstr(int y, int x, chtype *str) +{ + return (mvwinwchstr(stdscr, y, x, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvinwstr.c b/usr/src/lib/libcurses/screen/_mvinwstr.c new file mode 100644 index 0000000000..b435404ffc --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvinwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvinwstr(int y, int x, wchar_t *ws) +{ + return (mvwinwstr(stdscr, y, x, ws)); +} diff --git a/usr/src/lib/libcurses/screen/_mvvline.c b/usr/src/lib/libcurses/screen/_mvvline.c new file mode 100644 index 0000000000..c8676bac7b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvvline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvvline(int y, int x, chtype c, int n) +{ + return (mvwvline(stdscr, y, x, c, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddch.c b/usr/src/lib/libcurses/screen/_mvwaddch.c new file mode 100644 index 0000000000..d3b22493f4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddch(WINDOW *win, int y, int x, chtype ch) +{ + return (wmove(win, y, x) == ERR ? ERR : waddch(win, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddchnst.c b/usr/src/lib/libcurses/screen/_mvwaddchnst.c new file mode 100644 index 0000000000..c84a1a1a49 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddchnst.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddchnstr(WINDOW *win, int y, int x, chtype *ch, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : waddchnstr(win, ch, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddchstr.c b/usr/src/lib/libcurses/screen/_mvwaddchstr.c new file mode 100644 index 0000000000..b156e65583 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddchstr(WINDOW *win, int y, int x, chtype *ch) +{ + return (wmove(win, y, x) == ERR ? ERR : waddchstr(win, ch)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddnstr.c b/usr/src/lib/libcurses/screen/_mvwaddnstr.c new file mode 100644 index 0000000000..283bbab7a7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddnstr(WINDOW *win, int y, int x, char *s, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : waddnstr(win, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddnwstr.c b/usr/src/lib/libcurses/screen/_mvwaddnwstr.c new file mode 100644 index 0000000000..69572e1be8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : waddnwstr(win, ws, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddstr.c b/usr/src/lib/libcurses/screen/_mvwaddstr.c new file mode 100644 index 0000000000..b1f6f9a834 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddstr(WINDOW *win, int y, int x, char *str) +{ + return (wmove(win, y, x) == ERR ? ERR : waddstr(win, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddwch.c b/usr/src/lib/libcurses/screen/_mvwaddwch.c new file mode 100644 index 0000000000..5784d89544 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddwch(WINDOW *win, int y, int x, chtype ch) +{ + return ((wmove(win, y, x) == ERR ? ERR : waddwch(win, ch))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddwchnstr.c b/usr/src/lib/libcurses/screen/_mvwaddwchnstr.c new file mode 100644 index 0000000000..850ecf955a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddwchnstr(WINDOW *win, int y, int x, chtype *str, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : waddwchnstr(win, str, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddwchstr.c b/usr/src/lib/libcurses/screen/_mvwaddwchstr.c new file mode 100644 index 0000000000..56a8e07849 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddwchstr(WINDOW *win, int y, int x, chtype *str) +{ + return ((wmove(win, y, x) == ERR ? ERR : waddwchstr(win, str))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwaddwstr.c b/usr/src/lib/libcurses/screen/_mvwaddwstr.c new file mode 100644 index 0000000000..53d76e0d24 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwaddwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwaddwstr(WINDOW *win, int y, int x, wchar_t *ws) +{ + return ((wmove(win, y, x) == ERR ? ERR : waddwstr(win, ws))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwdelch.c b/usr/src/lib/libcurses/screen/_mvwdelch.c new file mode 100644 index 0000000000..9d9959bd13 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwdelch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwdelch(WINDOW *win, int y, int x) +{ + return (wmove(win, y, x) == ERR ? ERR : wdelch(win)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwgetch.c b/usr/src/lib/libcurses/screen/_mvwgetch.c new file mode 100644 index 0000000000..e573bd08a9 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwgetch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwgetch(WINDOW *win, int y, int x) +{ + return (wmove(win, y, x) == ERR ? ERR : wgetch(win)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwgetnwstr.c b/usr/src/lib/libcurses/screen/_mvwgetnwstr.c new file mode 100644 index 0000000000..72020a3fd4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwgetnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwgetnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : wgetnwstr(win, ws, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwgetstr.c b/usr/src/lib/libcurses/screen/_mvwgetstr.c new file mode 100644 index 0000000000..f519bb7072 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwgetstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwgetstr(WINDOW *win, int y, int x, char *str) +{ + return (wmove(win, y, x) == ERR ? ERR : wgetstr(win, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwgetwch.c b/usr/src/lib/libcurses/screen/_mvwgetwch.c new file mode 100644 index 0000000000..612e2e129d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwgetwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwgetwch(WINDOW *win, int y, int x) +{ + return ((wmove(win, y, x) == ERR ? ERR : wgetwch(win))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwgetwstr.c b/usr/src/lib/libcurses/screen/_mvwgetwstr.c new file mode 100644 index 0000000000..f5739f4b8d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwgetwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwgetwstr(WINDOW *win, int y, int x, wchar_t *ws) +{ + return ((wmove(win, y, x) == ERR ? ERR : wgetwstr(win, ws))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwhline.c b/usr/src/lib/libcurses/screen/_mvwhline.c new file mode 100644 index 0000000000..3ff56e9da8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwhline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwhline(WINDOW *win, int y, int x, chtype c, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : whline(win, c, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinch.c b/usr/src/lib/libcurses/screen/_mvwinch.c new file mode 100644 index 0000000000..2e1c5a14c7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +mvwinch(WINDOW *win, int y, int x) +{ + return (wmove(win, y, x) == ERR ? (chtype) ERR : winch(win)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinchnst.c b/usr/src/lib/libcurses/screen/_mvwinchnst.c new file mode 100644 index 0000000000..d70c91d257 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinchnst.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinchnstr(WINDOW *win, int y, int x, chtype *s, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : winchnstr(win, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinchstr.c b/usr/src/lib/libcurses/screen/_mvwinchstr.c new file mode 100644 index 0000000000..cca9207253 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinchstr(WINDOW *win, int y, int x, chtype *str) +{ + return (wmove(win, y, x) == ERR ? ERR : winchstr(win, str)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinnstr.c b/usr/src/lib/libcurses/screen/_mvwinnstr.c new file mode 100644 index 0000000000..7ef9020999 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinnstr(WINDOW *win, int y, int x, char *s, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : winnstr(win, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinnwstr.c b/usr/src/lib/libcurses/screen/_mvwinnwstr.c new file mode 100644 index 0000000000..2031e41612 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : winnwstr(win, ws, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinsch.c b/usr/src/lib/libcurses/screen/_mvwinsch.c new file mode 100644 index 0000000000..23a4eeaaef --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinsch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinsch(WINDOW *win, int y, int x, chtype c) +{ + return (wmove(win, y, x) == ERR ? ERR : winsch(win, c)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinsnstr.c b/usr/src/lib/libcurses/screen/_mvwinsnstr.c new file mode 100644 index 0000000000..290d8f1f5c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinsnstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinsnstr(WINDOW *win, int y, int x, char *s, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : winsnstr(win, s, n)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinsnwstr.c b/usr/src/lib/libcurses/screen/_mvwinsnwstr.c new file mode 100644 index 0000000000..d2980586ad --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinsnwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinsnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : winsnwstr(win, ws, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinsstr.c b/usr/src/lib/libcurses/screen/_mvwinsstr.c new file mode 100644 index 0000000000..de687e6946 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinsstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinsstr(WINDOW *win, int y, int x, char *s) +{ + return (wmove(win, y, x) == ERR ? ERR : winsstr(win, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinstr.c b/usr/src/lib/libcurses/screen/_mvwinstr.c new file mode 100644 index 0000000000..32d910af59 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinstr(WINDOW *win, int y, int x, char *s) +{ + return (wmove(win, y, x) == ERR ? ERR : winstr(win, s)); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinswch.c b/usr/src/lib/libcurses/screen/_mvwinswch.c new file mode 100644 index 0000000000..73620f316e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinswch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinswch(WINDOW *win, int y, int x, chtype c) +{ + return ((wmove(win, y, x) == ERR ? ERR : winswch(win, c))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinswstr.c b/usr/src/lib/libcurses/screen/_mvwinswstr.c new file mode 100644 index 0000000000..fa7e829990 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinswstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinswstr(WINDOW *win, int y, int x, wchar_t *ws) +{ + return ((wmove(win, y, x) == ERR ? ERR : winswstr(win, ws))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinwch.c b/usr/src/lib/libcurses/screen/_mvwinwch.c new file mode 100644 index 0000000000..a05de5cdfd --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinwch.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +chtype +mvwinwch(WINDOW *win, int y, int x) +{ + return ((wmove(win, y, x) == ERR ? (chtype)ERR : winwch(win))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinwchnstr.c b/usr/src/lib/libcurses/screen/_mvwinwchnstr.c new file mode 100644 index 0000000000..d874aa6ecb --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinwchnstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinwchnstr(WINDOW *win, int y, int x, chtype *str, int n) +{ + return ((wmove(win, y, x) == ERR ? ERR : winwchnstr(win, str, n))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinwchstr.c b/usr/src/lib/libcurses/screen/_mvwinwchstr.c new file mode 100644 index 0000000000..422e115779 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinwchstr(WINDOW *win, int y, int x, chtype *str) +{ + return ((wmove(win, y, x) == ERR ? ERR : winwchstr(win, str))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwinwstr.c b/usr/src/lib/libcurses/screen/_mvwinwstr.c new file mode 100644 index 0000000000..bf683c0bfe --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwinwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwinwstr(WINDOW *win, int y, int x, wchar_t *ws) +{ + return ((wmove(win, y, x) == ERR ? ERR : winwstr(win, ws))); +} diff --git a/usr/src/lib/libcurses/screen/_mvwvline.c b/usr/src/lib/libcurses/screen/_mvwvline.c new file mode 100644 index 0000000000..7f9856fc5e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_mvwvline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +mvwvline(WINDOW *win, int y, int x, chtype c, int n) +{ + return (wmove(win, y, x) == ERR ? ERR : wvline(win, c, n)); +} diff --git a/usr/src/lib/libcurses/screen/_newterm.c b/usr/src/lib/libcurses/screen/_newterm.c new file mode 100644 index 0000000000..b988da3e20 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_newterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +SCREEN * +newterm(char *type, FILE *fout, FILE *fin) +{ + return (newscreen(type, 0, 0, 0, fout, fin)); +} diff --git a/usr/src/lib/libcurses/screen/_nl.c b/usr/src/lib/libcurses/screen/_nl.c new file mode 100644 index 0000000000..3a05db42f6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_nl.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +nl(void) +{ + return (_setnonl(FALSE)); +} diff --git a/usr/src/lib/libcurses/screen/_nocrmode.c b/usr/src/lib/libcurses/screen/_nocrmode.c new file mode 100644 index 0000000000..78c7378570 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_nocrmode.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +#undef nocrmode + +int +nocrmode(void) +{ + return (nocbreak()); +} diff --git a/usr/src/lib/libcurses/screen/_noecho.c b/usr/src/lib/libcurses/screen/_noecho.c new file mode 100644 index 0000000000..fecb75211d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_noecho.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +noecho(void) +{ + return (_setecho(FALSE)); +} diff --git a/usr/src/lib/libcurses/screen/_nonl.c b/usr/src/lib/libcurses/screen/_nonl.c new file mode 100644 index 0000000000..0d724b485b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_nonl.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +nonl(void) +{ + return (_setnonl(TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/_noqiflush.c b/usr/src/lib/libcurses/screen/_noqiflush.c new file mode 100644 index 0000000000..d94f668f8b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_noqiflush.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +void +noqiflush(void) +{ + _setqiflush(FALSE); +} diff --git a/usr/src/lib/libcurses/screen/_overlay.c b/usr/src/lib/libcurses/screen/_overlay.c new file mode 100644 index 0000000000..0617a2e92a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_overlay.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +overlay(WINDOW *src, WINDOW *dst) +{ + return (_overlap(src, dst, TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/_overwrite.c b/usr/src/lib/libcurses/screen/_overwrite.c new file mode 100644 index 0000000000..91d2404386 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_overwrite.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +overwrite(WINDOW *src, WINDOW *dst) +{ + return (_overlap(src, dst, FALSE)); +} diff --git a/usr/src/lib/libcurses/screen/_qiflush.c b/usr/src/lib/libcurses/screen/_qiflush.c new file mode 100644 index 0000000000..8001dfdd01 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_qiflush.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +void +qiflush(void) +{ + _setqiflush(TRUE); +} diff --git a/usr/src/lib/libcurses/screen/_refresh.c b/usr/src/lib/libcurses/screen/_refresh.c new file mode 100644 index 0000000000..70d4cd8065 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_refresh.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +refresh(void) +{ + return (wrefresh(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_resetterm.c b/usr/src/lib/libcurses/screen/_resetterm.c new file mode 100644 index 0000000000..441c50700d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_resetterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +resetterm(void) +{ + return (reset_shell_mode()); +} diff --git a/usr/src/lib/libcurses/screen/_saveterm.c b/usr/src/lib/libcurses/screen/_saveterm.c new file mode 100644 index 0000000000..6ae2b67feb --- /dev/null +++ b/usr/src/lib/libcurses/screen/_saveterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +saveterm(void) +{ + return (def_prog_mode()); +} diff --git a/usr/src/lib/libcurses/screen/_scr_init.c b/usr/src/lib/libcurses/screen/_scr_init.c new file mode 100644 index 0000000000..a2a5f9b74c --- /dev/null +++ b/usr/src/lib/libcurses/screen/_scr_init.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +scr_init(char *file) +{ + return (_scr_all(file, 0)); +} diff --git a/usr/src/lib/libcurses/screen/_scr_restore.c b/usr/src/lib/libcurses/screen/_scr_restore.c new file mode 100644 index 0000000000..63d4612aea --- /dev/null +++ b/usr/src/lib/libcurses/screen/_scr_restore.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +scr_restore(char *file) +{ + return (_scr_all(file, 1)); +} diff --git a/usr/src/lib/libcurses/screen/_scr_set.c b/usr/src/lib/libcurses/screen/_scr_set.c new file mode 100644 index 0000000000..bc9ed560f1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_scr_set.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +scr_set(char *file) +{ + return (_scr_all(file, 2)); +} diff --git a/usr/src/lib/libcurses/screen/_scrl.c b/usr/src/lib/libcurses/screen/_scrl.c new file mode 100644 index 0000000000..982d006e38 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_scrl.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +scrl(int n) +{ + return (wscrl(stdscr, n)); +} diff --git a/usr/src/lib/libcurses/screen/_scroll.c b/usr/src/lib/libcurses/screen/_scroll.c new file mode 100644 index 0000000000..2c9c4bca41 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_scroll.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +scroll(WINDOW *win) +{ + return (wscrl(win, 1)); +} diff --git a/usr/src/lib/libcurses/screen/_set_curterm.c b/usr/src/lib/libcurses/screen/_set_curterm.c new file mode 100644 index 0000000000..15dcc676e8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_set_curterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +TERMINAL * +set_curterm(TERMINAL *newterminal) +{ + return (setcurterm(newterminal)); +} diff --git a/usr/src/lib/libcurses/screen/_set_term.c b/usr/src/lib/libcurses/screen/_set_term.c new file mode 100644 index 0000000000..5b479c6120 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_set_term.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +SCREEN * +set_term(SCREEN *screen) +{ + return (setcurscreen(screen)); +} diff --git a/usr/src/lib/libcurses/screen/_setscrreg.c b/usr/src/lib/libcurses/screen/_setscrreg.c new file mode 100644 index 0000000000..24a262c0f5 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_setscrreg.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +setscrreg(int t, int b) +{ + return (wsetscrreg(stdscr, t, b)); +} diff --git a/usr/src/lib/libcurses/screen/_slk_init.c b/usr/src/lib/libcurses/screen/_slk_init.c new file mode 100644 index 0000000000..28fa2bb954 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_slk_init.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +slk_init(int f) +{ + return (slk_start((f == 0) ? 3 : 2, NULL)); +} diff --git a/usr/src/lib/libcurses/screen/_standend.c b/usr/src/lib/libcurses/screen/_standend.c new file mode 100644 index 0000000000..18ece3b3da --- /dev/null +++ b/usr/src/lib/libcurses/screen/_standend.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +standend(void) +{ + return (wstandend(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_standout.c b/usr/src/lib/libcurses/screen/_standout.c new file mode 100644 index 0000000000..74231a8829 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_standout.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +standout(void) +{ + return (wstandout(stdscr)); +} diff --git a/usr/src/lib/libcurses/screen/_subpad.c b/usr/src/lib/libcurses/screen/_subpad.c new file mode 100644 index 0000000000..b1a55b44b1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_subpad.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +WINDOW * +subpad(WINDOW *win, int l, int nc, int by, int bx) +{ + return (derwin(win, l, nc, by, bx)); +} diff --git a/usr/src/lib/libcurses/screen/_timeout.c b/usr/src/lib/libcurses/screen/_timeout.c new file mode 100644 index 0000000000..3a1d5c76bc --- /dev/null +++ b/usr/src/lib/libcurses/screen/_timeout.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +void +timeout(int tm) +{ + wtimeout(stdscr, tm); +} diff --git a/usr/src/lib/libcurses/screen/_touchline.c b/usr/src/lib/libcurses/screen/_touchline.c new file mode 100644 index 0000000000..817ea892c8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_touchline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +touchline(WINDOW *win, int y, int n) +{ + return (wtouchln(win, y, n, TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/_unctrl.c b/usr/src/lib/libcurses/screen/_unctrl.c new file mode 100644 index 0000000000..1186af4e12 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_unctrl.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include "curses_inc.h" + +char * +unctrl(int ch) +{ + return (_unctrl[(unsigned) ch]); +} diff --git a/usr/src/lib/libcurses/screen/_vline.c b/usr/src/lib/libcurses/screen/_vline.c new file mode 100644 index 0000000000..c7eae1ef8d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_vline.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +vline(chtype vertch, int num_chars) +{ + return (wvline(stdscr, vertch, num_chars)); +} diff --git a/usr/src/lib/libcurses/screen/_waddchstr.c b/usr/src/lib/libcurses/screen/_waddchstr.c new file mode 100644 index 0000000000..2a87fde20d --- /dev/null +++ b/usr/src/lib/libcurses/screen/_waddchstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +waddchstr(WINDOW *win, chtype *str) +{ + return (waddchnstr(win, str, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_waddstr.c b/usr/src/lib/libcurses/screen/_waddstr.c new file mode 100644 index 0000000000..620e9ed3ba --- /dev/null +++ b/usr/src/lib/libcurses/screen/_waddstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +waddstr(WINDOW *win, char *str) +{ + return (waddnstr(win, str, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_waddwchstr.c b/usr/src/lib/libcurses/screen/_waddwchstr.c new file mode 100644 index 0000000000..6ac82dfa8b --- /dev/null +++ b/usr/src/lib/libcurses/screen/_waddwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +waddwchstr(WINDOW *win, chtype *str) +{ + return (waddwchnstr(win, str, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_waddwstr.c b/usr/src/lib/libcurses/screen/_waddwstr.c new file mode 100644 index 0000000000..25f2954dc4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_waddwstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +waddwstr(WINDOW *win, wchar_t *ws) +{ + return (waddnwstr(win, ws, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_wclear.c b/usr/src/lib/libcurses/screen/_wclear.c new file mode 100644 index 0000000000..a4d9b3660e --- /dev/null +++ b/usr/src/lib/libcurses/screen/_wclear.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +wclear(WINDOW *win) +{ + win->_clear = TRUE; + return (werase(win)); +} diff --git a/usr/src/lib/libcurses/screen/_wdeleteln.c b/usr/src/lib/libcurses/screen/_wdeleteln.c new file mode 100644 index 0000000000..a232d321f5 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_wdeleteln.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +wdeleteln(WINDOW *win) +{ + return (winsdelln(win, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_werase.c b/usr/src/lib/libcurses/screen/_werase.c new file mode 100644 index 0000000000..aa5e8c89fc --- /dev/null +++ b/usr/src/lib/libcurses/screen/_werase.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +werase(WINDOW *win) +{ + (void) wmove(win, 0, 0); + return (wclrtobot(win)); +} diff --git a/usr/src/lib/libcurses/screen/_winsertln.c b/usr/src/lib/libcurses/screen/_winsertln.c new file mode 100644 index 0000000000..746133d921 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_winsertln.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +winsertln(WINDOW *win) +{ + return (winsdelln(win, 1)); +} diff --git a/usr/src/lib/libcurses/screen/_winsstr.c b/usr/src/lib/libcurses/screen/_winsstr.c new file mode 100644 index 0000000000..da5f69f376 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_winsstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +winsstr(WINDOW *win, char *str) +{ + return (winsnstr(win, str, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_winswstr.c b/usr/src/lib/libcurses/screen/_winswstr.c new file mode 100644 index 0000000000..39ae46ed21 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_winswstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +winswstr(WINDOW *win, wchar_t *ws) +{ + return (winsnwstr(win, ws, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_winwchstr.c b/usr/src/lib/libcurses/screen/_winwchstr.c new file mode 100644 index 0000000000..79c5f7e600 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_winwchstr.c @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +winwchstr(WINDOW *win, chtype *str) +{ + return (winwchnstr(win, str, -1)); +} diff --git a/usr/src/lib/libcurses/screen/_wstandend.c b/usr/src/lib/libcurses/screen/_wstandend.c new file mode 100644 index 0000000000..2aa353cb73 --- /dev/null +++ b/usr/src/lib/libcurses/screen/_wstandend.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +wstandend(WINDOW *win) +{ + (void) wattrset(win, A_NORMAL); + return (1); +} diff --git a/usr/src/lib/libcurses/screen/_wstandout.c b/usr/src/lib/libcurses/screen/_wstandout.c new file mode 100644 index 0000000000..a4450acb6a --- /dev/null +++ b/usr/src/lib/libcurses/screen/_wstandout.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define NOMACROS +#include <sys/types.h> +#include "curses_inc.h" + +int +wstandout(WINDOW *win) +{ + return (wattron(win, A_STANDOUT)); +} diff --git a/usr/src/lib/libcurses/screen/baudrate.c b/usr/src/lib/libcurses/screen/baudrate.c new file mode 100644 index 0000000000..5475d9babb --- /dev/null +++ b/usr/src/lib/libcurses/screen/baudrate.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ +#include <sys/types.h> +#include "curses_inc.h" + +int +baudrate(void) +{ + /*LINTED*/ + return ((int) SP->baud); +} diff --git a/usr/src/lib/libcurses/screen/can_change.c b/usr/src/lib/libcurses/screen/can_change.c new file mode 100644 index 0000000000..9b0f2a25ed --- /dev/null +++ b/usr/src/lib/libcurses/screen/can_change.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +bool +can_change_color(void) +{ + return (can_change); +} diff --git a/usr/src/lib/libcurses/screen/caps b/usr/src/lib/libcurses/screen/caps new file mode 100644 index 0000000000..9e7bd5ce99 --- /dev/null +++ b/usr/src/lib/libcurses/screen/caps @@ -0,0 +1,557 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# Copyright (c) 1988 AT&T +# All Rights Reserved + +# +# University Copyright- Copyright (c) 1982, 1986, 1988 +# The Regents of the University of California +# All Rights Reserved +# +# University Acknowledgment- Portions of this document are derived from +# software developed by the University of California, Berkeley, and its +# contributors. +# + +#ident "%Z%%M% %I% %E% SMI" + +# Be sure to add new capabilties at the END of the appropriate section! +--- begin bool +auto_left_margin, "bw" "bw" cub1 wraps from column 0 to last column +auto_right_margin, "am" "am" Terminal has automatic margins +no_esc_ctlc, "xsb" "xb" Beehive (f1=escape, f2=ctrl C) +ceol_standout_glitch, "xhp" "xs" Standout not erased by overwriting (hp) +eat_newline_glitch, "xenl" "xn" newline ignored after 80 cols (Concept) +erase_overstrike, "eo" "eo" Can erase overstrikes with a blank +generic_type, "gn" "gn" Generic line type (e.g. dialup, switch). +hard_copy, "hc" "hc" Hardcopy terminal +has_meta_key, "km" "km" Has a meta key (shift, sets parity bit) +has_status_line, "hs" "hs" Has extra "status line" +insert_null_glitch, "in" "in" Insert mode distinguishes nulls +memory_above, "da" "da" Display may be retained above the screen +memory_below, "db" "db" Display may be retained below the screen +move_insert_mode, "mir" "mi" Safe to move while in insert mode +move_standout_mode, "msgr" "ms" Safe to move in standout modes +over_strike, "os" "os" Terminal overstrikes +status_line_esc_ok, "eslok" "es" Escape can be used on the status line +dest_tabs_magic_smso, "xt" "xt" Tabs destructive, magic so char (t1061) +tilde_glitch, "hz" "hz" Hazeltine; can't print ~'s +transparent_underline, "ul" "ul" underline character overstrikes +xon_xoff, "xon" "xo" Terminal uses xon/xoff handshaking +needs_xon_xoff, "nxon" "nx" Padding won't work, xon/xoff required +prtr_silent, "mc5i" "5i" Printer won't echo on screen. +hard_cursor, "chts" "HC" Cursor is hard to see. +non_rev_rmcup, "nrrmc" "NR" Smcup does not reverse rmcup. +no_pad_char, "npc" "NP" Pad character doesn't exist. +non_dest_scroll_region, "ndscr" "ND" Scrolling region is non-destructive. +can_change, "ccc" "cc" Can re-define existing color +back_color_erase, "bce" "ut" Erases screen with current background +hue_lightness_saturation, "hls" "hl" HLS color notation is used (Tek) +# +# printer specific +# +col_addr_glitch, "xhpa" "YA" Only positive motion for hpa/mhpa caps +cr_cancels_micro_mode, "crxm" "YB" Using cr turns off micro mode +has_print_wheel, "daisy" "YC" Printer needs operator to change character set +row_addr_glitch, "xvpa" "YD" Only positive motion for vpa/mvpa caps +semi_auto_right_margin, "sam" "YE" Printing in last column causes cr +cpi_changes_res, "cpix" "YF" Changing char. pitch changes resolution +lpi_changes_res, "lpix" "YG" Changing line pitch changes resolution +# Add new Booleans before this line. +--- end bool + +--- begin num +columns, "cols" "co" Number of columns in a line +init_tabs, "it" "it" Tabs initially every # spaces. +lines, "lines" "li" Number of lines on screen or page +lines_of_memory, "lm" "lm" Lines of memory if > lines. 0 => varies +magic_cookie_glitch, "xmc" "sg" Number blank chars left by smso or rmso +padding_baud_rate, "pb" "pb" Lowest baud rate where padding needed +virtual_terminal, "vt" "vt" Virtual terminal number (CB/Unix) +width_status_line, "wsl" "ws" # columns in status line +num_labels, "nlab" "Nl" # of labels on screen (start at 1) +label_height, "lh" "lh" # rows in each label +label_width, "lw" "lw" # cols in each label +max_attributes, "ma" "ma" max combined video attributes terminal can display +# +# +# +maximum_windows, "wnum" "MW" Maximum number of defineable windows +max_colors, "colors" "Co" max # of color on the screen +max_pairs, "pairs" "pa" max # of color pairs on the screen +no_color_video, "ncv" "NC" Video attributes that cannot be used with colors +# +# printer specific +# +buffer_capacity, "bufsz" "Ya" Number of bytes buffered before printing +dot_vert_spacing, "spinv" "Yb" Spacing of pins vertically in pins per inch +dot_horz_spacing, "spinh" "Yc" Spacing of dots horizontally in dots per inch +max_micro_address, "maddr" "Yd" Maximum value in micro_..._address +max_micro_jump, "mjump" "Ye" Maximum value in parm_..._micro +micro_char_size, "mcs" "Yf" Character step size when in micro mode +micro_line_size, "mls" "Yg" Line step size when in micro mode +number_of_pins, "npins" "Yh" Number of pins in print-head +output_res_char, "orc" "Yi" Horizontal resolution in units per character +output_res_line, "orl" "Yj" Vertical resolution in units per line +output_res_horz_inch, "orhi" "Yk" Horizontal resolution in units per inch +output_res_vert_inch, "orvi" "Yl" Vertical resolution in units per inch +print_rate, "cps" "Ym" Print rate in characters per second +wide_char_size, "widcs" "Yn" Character step size when in double wide mode +# +# mouse support +# +buttons, "btns" "BT" Number of buttons on the mouse +# +# Additional printer nums +# +bit_image_entwining, "bitwin" "Yo" Number of passes for each bit-image row +bit_image_type, "bitype" "Yp" Type of bit-image device +# Add new numbers before this line. +--- end num + +--- begin str +back_tab, "cbt" "bt" Back tab +bell, "bel" "bl" Audible signal (bell) +carriage_return, "cr" "cr" Carriage return (*) +change_scroll_region, "csr" "cs" change to lines #1 thru #2 (vt100) (G) +clear_all_tabs, "tbc" "ct" Clear all tab stops. +clear_screen, "clear" "cl" Clear screen (*) +clr_eol, "el" "ce" Clear to end of line +clr_eos, "ed" "cd" Clear to end of display (*) +column_address, "hpa" "ch" Set cursor column (G) +command_character, "cmdch" "CC" Term. settable cmd char in prototype +cursor_address, "cup" "cm" Cursor motion to row #1 col #2 (G) +cursor_down, "cud1" "do" Down one line +cursor_home, "home" "ho" Home cursor (if no cup) +cursor_invisible, "civis" "vi" Make cursor invisible +cursor_left, "cub1" "le" Move cursor left one space. +cursor_mem_address, "mrcup" "CM" Memory relative cursor addressing. +cursor_normal, "cnorm" "ve" Make cursor appear normal (undo vs/vi) +cursor_right, "cuf1" "nd" Non-destructive space (cursor right) +cursor_to_ll, "ll" "ll" Last line, first column (if no cup) +cursor_up, "cuu1" "up" Upline (cursor up) +cursor_visible, "cvvis" "vs" Make cursor very visible +delete_character, "dch1" "dc" Delete character (*) +delete_line, "dl1" "dl" Delete line (*) +dis_status_line, "dsl" "ds" Disable status line +down_half_line, "hd" "hd" Half-line down (forward 1/2 linefeed) +enter_alt_charset_mode, "smacs" "as" Start alternate character set +enter_blink_mode, "blink" "mb" Turn on blinking +enter_bold_mode, "bold" "md" Turn on bold (extra bright) mode +enter_ca_mode, "smcup" "ti" String to begin programs that use cup +enter_delete_mode, "smdc" "dm" Delete mode (enter) +enter_dim_mode, "dim" "mh" Turn on half-bright mode +enter_insert_mode, "smir" "im" Insert mode (enter); +enter_secure_mode, "invis" "mk" Turn on blank mode (chars invisible) +enter_protected_mode, "prot" "mp" Turn on protected mode +enter_reverse_mode, "rev" "mr" Turn on reverse video mode +enter_standout_mode, "smso" "so" Begin stand out mode +enter_underline_mode, "smul" "us" Start underscore mode +erase_chars, "ech" "ec" Erase #1 characters (G) +exit_alt_charset_mode, "rmacs" "ae" End alternate character set +exit_attribute_mode, "sgr0" "me" Turn off all attributes +exit_ca_mode, "rmcup" "te" String to end programs that use cup +exit_delete_mode, "rmdc" "ed" End delete mode +exit_insert_mode, "rmir" "ei" End insert mode; +exit_standout_mode, "rmso" "se" End stand out mode +exit_underline_mode, "rmul" "ue" End underscore mode +flash_screen, "flash" "vb" Visible bell (may not move cursor) +form_feed, "ff" "ff" Hardcopy terminal page eject (*) +from_status_line, "fsl" "fs" Return from status line +init_1string, "is1" "i1" Terminal initialization string +init_2string, "is2" "is" Terminal initialization string +init_3string, "is3" "i3" Terminal initialization string +init_file, "if" "if" Name of file containing is +insert_character, "ich1" "ic" Insert character +insert_line, "il1" "al" Add new blank line (*) +insert_padding, "ip" "ip" Insert pad after character inserted (*) +key_backspace, "kbs" "kb" KEY_BACKSPACE, 0407, Sent by backspace key +key_catab, "ktbc" "ka" KEY_CATAB, 0526, Sent by clear-all-tabs key. +key_clear, "kclr" "kC" KEY_CLEAR, 0515, Sent by clear screen or erase key. +key_ctab, "kctab" "kt" KEY_CTAB, 0525, Sent by clear-tab key +key_dc, "kdch1" "kD" KEY_DC, 0512, Sent by delete character key. +key_dl, "kdl1" "kL" KEY_DL, 0510, Sent by delete line key. +key_down, "kcud1" "kd" KEY_DOWN, 0402, Sent by terminal down arrow key +key_eic, "krmir" "kM" KEY_EIC, 0514, Sent by rmir or smir in ins mode. +key_eol, "kel" "kE" KEY_EOL, 0517, Sent by clear-to-end-of-line key. +key_eos, "ked" "kS" KEY_EOS, 0516, Sent by clear-to-end-of-screen. +key_f0, "kf0" "k0" KEY_F(0), 0410, function key f0. +key_f1, "kf1" "k1" KEY_F(1), 0411, function key f1. +key_f10, "kf10" "k;" KEY_F(10), 0422, function key f10. +key_f2, "kf2" "k2" KEY_F(2), 0412, function key f2. +key_f3, "kf3" "k3" KEY_F(3), 0413, function key f3. +key_f4, "kf4" "k4" KEY_F(4), 0414, function key f4. +key_f5, "kf5" "k5" KEY_F(5), 0415, function key f5. +key_f6, "kf6" "k6" KEY_F(6), 0416, function key f6. +key_f7, "kf7" "k7" KEY_F(7), 0417, function key f7. +key_f8, "kf8" "k8" KEY_F(8), 0420, function key f8. +key_f9, "kf9" "k9" KEY_F(9), 0421, function key f9. +key_home, "khome" "kh" KEY_HOME, 0406, Sent by home key. +key_ic, "kich1" "kI" KEY_IC, 0513, Sent by ins char/enter mode key. +key_il, "kil1" "kA" KEY_IL, 0511, Sent by insert line. +key_left, "kcub1" "kl" KEY_LEFT, 0404, Sent by terminal left arrow key +key_ll, "kll" "kH" KEY_LL, 0533, Sent by home-down key +key_npage, "knp" "kN" KEY_NPAGE, 0522, Sent by next-page key +key_ppage, "kpp" "kP" KEY_PPAGE, 0523, Sent by previous-page key +key_right, "kcuf1" "kr" KEY_RIGHT, 0405, Sent by terminal right arrow key +key_sf, "kind" "kF" KEY_SF, 0520, Sent by scroll-forward/down key +key_sr, "kri" "kR" KEY_SR, 0521, Sent by scroll-backward/up key +key_stab, "khts" "kT" KEY_STAB, 0524, Sent by set-tab key +key_up, "kcuu1" "ku" KEY_UP, 0403, Sent by terminal up arrow key +keypad_local, "rmkx" "ke" Out of "keypad transmit" mode +keypad_xmit, "smkx" "ks" Put terminal in "keypad transmit" mode +lab_f0, "lf0" "l0" Labels on function key f0 if not f0 +lab_f1, "lf1" "l1" Labels on function key f1 if not f1 +lab_f10, "lf10" "la" Labels on function key f10 if not f10 +lab_f2, "lf2" "l2" Labels on function key f2 if not f2 +lab_f3, "lf3" "l3" Labels on function key f3 if not f3 +lab_f4, "lf4" "l4" Labels on function key f4 if not f4 +lab_f5, "lf5" "l5" Labels on function key f5 if not f5 +lab_f6, "lf6" "l6" Labels on function key f6 if not f6 +lab_f7, "lf7" "l7" Labels on function key f7 if not f7 +lab_f8, "lf8" "l8" Labels on function key f8 if not f8 +lab_f9, "lf9" "l9" Labels on function key f9 if not f9 +meta_off, "rmm" "mo" Turn off "meta mode" +meta_on, "smm" "mm" Turn on "meta mode" (8th bit) +newline, "nel" "nw" Newline (behaves like cr followed by lf) +pad_char, "pad" "pc" Pad character (rather than null) +parm_dch, "dch" "DC" Delete #1 chars (G*) +parm_delete_line, "dl" "DL" Delete #1 lines (G*) +parm_down_cursor, "cud" "DO" Move cursor down #1 lines. (G*) +parm_ich, "ich" "IC" Insert #1 blank chars (G*) +parm_index, "indn" "SF" Scroll forward #1 lines. (G) +parm_insert_line, "il" "AL" Add #1 new blank lines (G*) +parm_left_cursor, "cub" "LE" Move cursor left #1 spaces (G) +parm_right_cursor, "cuf" "RI" Move cursor right #1 spaces. (G*) +parm_rindex, "rin" "SR" Scroll backward #1 lines. (G) +parm_up_cursor, "cuu" "UP" Move cursor up #1 lines. (G*) +pkey_key, "pfkey" "pk" Prog funct key #1 to type string #2 +pkey_local, "pfloc" "pl" Prog funct key #1 to execute string #2 +pkey_xmit, "pfx" "px" Prog funct key #1 to xmit string #2 +print_screen, "mc0" "ps" Print contents of the screen +prtr_off, "mc4" "pf" Turn off the printer +prtr_on, "mc5" "po" Turn on the printer +repeat_char, "rep" "rp" Repeat char #1 #2 times. (G*) +reset_1string, "rs1" "r1" Reset terminal completely to sane modes. +reset_2string, "rs2" "r2" Reset terminal completely to sane modes. +reset_3string, "rs3" "r3" Reset terminal completely to sane modes. +reset_file, "rf" "rf" Name of file containing reset string. +restore_cursor, "rc" "rc" Restore cursor to position of last sc. +row_address, "vpa" "cv" Like hpa but sets row. (G) +save_cursor, "sc" "sc" Save cursor position. +scroll_forward, "ind" "sf" Scroll text up +scroll_reverse, "ri" "sr" Scroll text down +set_attributes, "sgr" "sa" Define the video attributes (G9) +set_tab, "hts" "st" Set a tab in all rows, current column. +set_window, "wind" "wi" Current window is lines #1-#2 cols #3-#4 +tab, "ht" "ta" Tab to next 8 space hardware tab stop. +to_status_line, "tsl" "ts" Go to status line, col #1 +underline_char, "uc" "uc" Underscore one char and move past it +up_half_line, "hu" "hu" Half-line up (reverse 1/2 linefeed) +init_prog, "iprog" "iP" Path name of program for init. +key_a1, "ka1" "K1" KEY_A1, 0534, Upper left of keypad +key_a3, "ka3" "K3" KEY_A3, 0535, Upper right of keypad +key_b2, "kb2" "K2" KEY_B2, 0536, Center of keypad +key_c1, "kc1" "K4" KEY_C1, 0537, Lower left of keypad +key_c3, "kc3" "K5" KEY_C3, 0540, Lower right of keypad +prtr_non, "mc5p" "pO" Turn on the printer for #1 bytes. +char_padding, "rmp" "rP" Like ip but when in replace mode +acs_chars, "acsc" "ac" Graphic charset pairs aAbBcC - def=vt100 +plab_norm, "pln" "pn" Prog label #1 to show string #2 +key_btab, "kcbt" "kB" KEY_BTAB, 0541, Back tab key +enter_xon_mode, "smxon" "SX" Turn on xon/xoff handshaking +exit_xon_mode, "rmxon" "RX" Turn off xon/xoff handshaking +enter_am_mode, "smam" "SA" Turn on automatic margins +exit_am_mode, "rmam" "RA" Turn off automatic margins +xon_character, "xonc" "XN" X-on character +xoff_character, "xoffc" "XF" X-off character +ena_acs, "enacs" "eA" Enable alternate char set +label_on, "smln" "LO" Turn on soft labels +label_off, "rmln" "LF" Turn off soft labels +key_beg, "kbeg" "@1" KEY_BEG, 0542, beg(inning) key +key_cancel, "kcan" "@2" KEY_CANCEL, 0543, cancel key +key_close, "kclo" "@3" KEY_CLOSE, 0544, close key +key_command, "kcmd" "@4" KEY_COMMAND, 0545, cmd (command) key +key_copy, "kcpy" "@5" KEY_COPY, 0546, copy key +key_create, "kcrt" "@6" KEY_CREATE, 0547, create key +key_end, "kend" "@7" KEY_END, 0550, end key +key_enter, "kent" "@8" KEY_ENTER, 0527, Enter/send (unreliable) +key_exit, "kext" "@9" KEY_EXIT, 0551, exit key +key_find, "kfnd" "@0" KEY_FIND, 0552, find key +key_help, "khlp" "%1" KEY_HELP, 0553, help key +key_mark, "kmrk" "%2" KEY_MARK, 0554, mark key +key_message, "kmsg" "%3" KEY_MESSAGE, 0555, message key +key_move, "kmov" "%4" KEY_MOVE, 0556, move key +key_next, "knxt" "%5" KEY_NEXT, 0557, next object key +key_open, "kopn" "%6" KEY_OPEN, 0560, open key +key_options, "kopt" "%7" KEY_OPTIONS, 0561, options key +key_previous, "kprv" "%8" KEY_PREVIOUS, 0562, previous object key +key_print, "kprt" "%9" KEY_PRINT, 0532, print or copy +key_redo, "krdo" "%0" KEY_REDO, 0563, redo key +key_reference, "kref" "&1" KEY_REFERENCE, 0564, ref(erence) key +key_refresh, "krfr" "&2" KEY_REFRESH, 0565, refresh key +key_replace, "krpl" "&3" KEY_REPLACE, 0566, replace key +key_restart, "krst" "&4" KEY_RESTART, 0567, restart key +key_resume, "kres" "&5" KEY_RESUME, 0570, resume key +key_save, "ksav" "&6" KEY_SAVE, 0571, save key +key_suspend, "kspd" "&7" KEY_SUSPEND, 0627, suspend key +key_undo, "kund" "&8" KEY_UNDO, 0630, undo key +key_sbeg, "kBEG" "&9" KEY_SBEG, 0572, shifted beginning key +key_scancel, "kCAN" "&0" KEY_SCANCEL, 0573, shifted cancel key +key_scommand, "kCMD" "*1" KEY_SCOMMAND, 0574, shifted command key +key_scopy, "kCPY" "*2" KEY_SCOPY, 0575, shifted copy key +key_screate, "kCRT" "*3" KEY_SCREATE, 0576, shifted create key +key_sdc, "kDC" "*4" KEY_SDC, 0577, shifted delete char key +key_sdl, "kDL" "*5" KEY_SDL, 0600, shifted delete line key +key_select, "kslt" "*6" KEY_SELECT, 0601, select key +key_send, "kEND" "*7" KEY_SEND, 0602, shifted end key +key_seol, "kEOL" "*8" KEY_SEOL, 0603, shifted clear line key +key_sexit, "kEXT" "*9" KEY_SEXIT, 0604, shifted exit key +key_sfind, "kFND" "*0" KEY_SFIND, 0605, shifted find key +key_shelp, "kHLP" "#1" KEY_SHELP, 0606, shifted help key +key_shome, "kHOM" "#2" KEY_SHOME, 0607, shifted home key +key_sic, "kIC" "#3" KEY_SIC, 0610, shifted input key +key_sleft, "kLFT" "#4" KEY_SLEFT, 0611, shifted left arrow key +key_smessage, "kMSG" "%a" KEY_SMESSAGE, 0612, shifted message key +key_smove, "kMOV" "%b" KEY_SMOVE, 0613, shifted move key +key_snext, "kNXT" "%c" KEY_SNEXT, 0614, shifted next key +key_soptions, "kOPT" "%d" KEY_SOPTIONS, 0615, shifted options key +key_sprevious, "kPRV" "%e" KEY_SPREVIOUS, 0616, shifted prev key +key_sprint, "kPRT" "%f" KEY_SPRINT, 0617, shifted print key +key_sredo, "kRDO" "%g" KEY_SREDO, 0620, shifted redo key +key_sreplace, "kRPL" "%h" KEY_SREPLACE, 0621, shifted replace key +key_sright, "kRIT" "%i" KEY_SRIGHT, 0622, shifted right arrow +key_srsume, "kRES" "%j" KEY_SRSUME, 0623, shifted resume key +key_ssave, "kSAV" "!1" KEY_SSAVE, 0624, shifted save key +key_ssuspend, "kSPD" "!2" KEY_SSUSPEND, 0625, shifted suspend key +key_sundo, "kUND" "!3" KEY_SUNDO, 0626, shifted undo key +req_for_input, "rfi" "RF" send next input char (for ptys) +key_f11, "kf11" "F1" KEY_F(11), 0423, function key f11. +key_f12, "kf12" "F2" KEY_F(12), 0424, function key f12. +key_f13, "kf13" "F3" KEY_F(13), 0425, function key f13. +key_f14, "kf14" "F4" KEY_F(14), 0426, function key f14. +key_f15, "kf15" "F5" KEY_F(15), 0427, function key f15. +key_f16, "kf16" "F6" KEY_F(16), 0430, function key f16. +key_f17, "kf17" "F7" KEY_F(17), 0431, function key f17. +key_f18, "kf18" "F8" KEY_F(18), 0432, function key f18. +key_f19, "kf19" "F9" KEY_F(19), 0433, function key f19. +key_f20, "kf20" "FA" KEY_F(20), 0434, function key f20. +key_f21, "kf21" "FB" KEY_F(21), 0435, function key f21. +key_f22, "kf22" "FC" KEY_F(22), 0436, function key f22. +key_f23, "kf23" "FD" KEY_F(23), 0437, function key f23. +key_f24, "kf24" "FE" KEY_F(24), 0440, function key f24. +key_f25, "kf25" "FF" KEY_F(25), 0441, function key f25. +key_f26, "kf26" "FG" KEY_F(26), 0442, function key f26. +key_f27, "kf27" "FH" KEY_F(27), 0443, function key f27. +key_f28, "kf28" "FI" KEY_F(28), 0444, function key f28. +key_f29, "kf29" "FJ" KEY_F(29), 0445, function key f29. +key_f30, "kf30" "FK" KEY_F(30), 0446, function key f30. +key_f31, "kf31" "FL" KEY_F(31), 0447, function key f31. +key_f32, "kf32" "FM" KEY_F(32), 0450, function key f32. +key_f33, "kf33" "FN" KEY_F(33), 0451, function key f33. +key_f34, "kf34" "FO" KEY_F(34), 0452, function key f34. +key_f35, "kf35" "FP" KEY_F(35), 0453, function key f35. +key_f36, "kf36" "FQ" KEY_F(36), 0454, function key f36. +key_f37, "kf37" "FR" KEY_F(37), 0455, function key f37. +key_f38, "kf38" "FS" KEY_F(38), 0456, function key f38. +key_f39, "kf39" "FT" KEY_F(39), 0457, function key f39. +key_f40, "kf40" "FU" KEY_F(40), 0460, function key f40. +key_f41, "kf41" "FV" KEY_F(41), 0461, function key f41. +key_f42, "kf42" "FW" KEY_F(42), 0462, function key f42. +key_f43, "kf43" "FX" KEY_F(43), 0463, function key f43. +key_f44, "kf44" "FY" KEY_F(44), 0464, function key f44. +key_f45, "kf45" "FZ" KEY_F(45), 0465, function key f45. +key_f46, "kf46" "Fa" KEY_F(46), 0466, function key f46. +key_f47, "kf47" "Fb" KEY_F(47), 0467, function key f47. +key_f48, "kf48" "Fc" KEY_F(48), 0470, function key f48. +key_f49, "kf49" "Fd" KEY_F(49), 0471, function key f49. +key_f50, "kf50" "Fe" KEY_F(50), 0472, function key f50. +key_f51, "kf51" "Ff" KEY_F(51), 0473, function key f51. +key_f52, "kf52" "Fg" KEY_F(52), 0474, function key f52. +key_f53, "kf53" "Fh" KEY_F(53), 0475, function key f53. +key_f54, "kf54" "Fi" KEY_F(54), 0476, function key f54. +key_f55, "kf55" "Fj" KEY_F(55), 0477, function key f55. +key_f56, "kf56" "Fk" KEY_F(56), 0500, function key f56. +key_f57, "kf57" "Fl" KEY_F(57), 0501, function key f57. +key_f58, "kf58" "Fm" KEY_F(58), 0502, function key f58. +key_f59, "kf59" "Fn" KEY_F(59), 0503, function key f59. +key_f60, "kf60" "Fo" KEY_F(60), 0504, function key f60. +key_f61, "kf61" "Fp" KEY_F(61), 0505, function key f61. +key_f62, "kf62" "Fq" KEY_F(62), 0506, function key f62. +key_f63, "kf63" "Fr" KEY_F(63), 0507, function key f63. +clr_bol, "el1" "cb" Clear to beginning of line, inclusive +clear_margins, "mgc" "MC" Clear left and right soft margins +set_left_margin, "smgl" "ML" Set soft left margin +set_right_margin, "smgr" "MR" Set soft right margin +label_format, "fln" "Lf" Label format +# +# +# +set_clock, "sclk" "SC" Set time-of-day clock +display_clock, "dclk" "DK" Display time-of-day clock +remove_clock, "rmclk" "RC" Remove time-of-day clock +create_window, "cwin" "CW" Define win #1 to go from #2,#3 to #4,#5 +goto_window, "wingo" "WG" Got to window #1 +hangup, "hup" "HU" Hang-up phone +dial_phone, "dial" "DI" Dial phone number #1 +quick_dial, "qdial" "QD" Dial phone number #1, without progress detection +tone, "tone" "TO" Select touch tone dialing +pulse, "pulse" "PU" Select pulse dialing +flash_hook, "hook" "fh" Flash the switch hook +fixed_pause, "pause" "PA" Pause for 2-3 seconds +wait_tone, "wait" "WA" Wait for dial tone +user0, "u0" "u0" User string 0 +user1, "u1" "u1" User string 1 +user2, "u2" "u2" User string 2 +user3, "u3" "u3" User string 3 +user4, "u4" "u4" User string 4 +user5, "u5" "u5" User string 5 +user6, "u6" "u6" User string 6 +user7, "u7" "u7" User string 7 +user8, "u8" "u8" User string 8 +user9, "u9" "u9" User string 9 +orig_pair, "op" "op" Original color-pair +orig_colors, "oc" "oc" Original colors +initialize_color, "initc" "Ic" Initialize the definition of color +initialize_pair, "initp" "Ip" Initialize color pair +set_color_pair, "scp" "sp" Set color pair +set_foreground, "setf" "Sf" Set foreground color using RGB escape +set_background, "setb" "Sb" Set background color using RGB escape +# +# printer specific +# +change_char_pitch, "cpi" "ZA" Change no. characters per inch +change_line_pitch, "lpi" "ZB" Change no. lines per inch +change_res_horz, "chr" "ZC" Change horizontal resolution +change_res_vert, "cvr" "ZD" Change vertical resolution +define_char, "defc" "ZE" Define a character in a character set +enter_doublewide_mode, "swidm" "ZF" Enable double wide printing +enter_draft_quality, "sdrfq" "ZG" Set draft quality print +enter_italics_mode, "sitm" "ZH" Enable italics +enter_leftward_mode, "slm" "ZI" Enable leftward carriage motion +enter_micro_mode, "smicm" "ZJ" Enable micro motion capabilities +enter_near_letter_quality, "snlq" "ZK" Set near-letter quality print +enter_normal_quality, "snrmq" "ZL" Set normal quality print +enter_shadow_mode, "sshm" "ZM" Enable shadow printing +enter_subscript_mode, "ssubm" "ZN" Enable subscript printing +enter_superscript_mode, "ssupm" "ZO" Enable superscript printing +enter_upward_mode, "sum" "ZP" Enable upward carriage motion +exit_doublewide_mode, "rwidm" "ZQ" Disable double wide printing +exit_italics_mode, "ritm" "ZR" Disable italics +exit_leftward_mode, "rlm" "ZS" Enable rightward (normal) carriage motion +exit_micro_mode, "rmicm" "ZT" Disable micro motion capabilities +exit_shadow_mode, "rshm" "ZU" Disable shadow printing +exit_subscript_mode, "rsubm" "ZV" Disable subscript printing +exit_superscript_mode, "rsupm" "ZW" Disable superscript printing +exit_upward_mode, "rum" "ZX" Enable downward (normal) carriage motion +micro_column_address, "mhpa" "ZY" Like column_address for micro adjustment +micro_down, "mcud1" "ZZ" Like cursor_down for micro adjustment +micro_left, "mcub1" "Za" Like cursor_left for micro adjustment +micro_right, "mcuf1" "Zb" Like cursor_right for micro adjustment +micro_row_address, "mvpa" "Zc" Like row_address for micro adjustment +micro_up, "mcuu1" "Zd" Like cursor_up for micro adjustment +order_of_pins, "porder" "Ze" Matches software bits to print-head pins +parm_down_micro, "mcud" "Zf" Like parm_down_cursor for micro adjust. +parm_left_micro, "mcub" "Zg" Like parm_left_cursor for micro adjust. +parm_right_micro, "mcuf" "Zh" Like parm_right_cursor for micro adjust. +parm_up_micro, "mcuu" "Zi" Like parm_up_cursor for micro adjust. +select_char_set, "scs" "Zj" Select character set +set_bottom_margin, "smgb" "Zk" Set soft bottom margin at current line +set_bottom_margin_parm, "smgbp" "Zl" Set soft bottom margin +set_left_margin_parm, "smglp" "Zm" Set soft left margin +set_right_margin_parm, "smgrp" "Zn" Set soft right margin +set_top_margin, "smgt" "Zo" Set soft top margin at current line +set_top_margin_parm, "smgtp" "Zp" Set soft top margin +start_bit_image, "sbim" "Zq" Start printing bit image graphics +start_char_set_def, "scsd" "Zr" Start definition of a character set +stop_bit_image, "rbim" "Zs" End printing bit image graphics (use tputs) +stop_char_set_def, "rcsd" "Zt" End definition of a character set +subscript_characters, "subcs" "Zu" List of ``subscript-able'' characters +superscript_characters, "supcs" "Zv" List of ``superscript-able'' characters +these_cause_cr, "docr" "Zw" Printing any of these chars causes cr +zero_motion, "zerom" "Zx" No motion for the subsequent character +char_set_names, "csnm" "Zy" List of character set names +# +# end of SVR3.2 strings +# +# mouse support +# +key_mouse, "kmous" "Km" KEY_MOUSE, 0631, Mouse event has occured +mouse_info, "minfo" "Mi" Mouse status information +req_mouse_pos, "reqmp" "RQ" Request mouse position report +get_mouse, "getm" "Gm" Curses should get button events +# +# ANSI color strings and FK x-mit plus label +# +set_a_foreground, "setaf" "AF" Set foreground color using ANSI escape +set_a_background, "setab" "AB" Set background color using ANSI escape +pkey_plab, "pfxl" "xl" Prog key #1 to xmit string #2 and show string #3 +# +# multiple codeset support +# +device_type, "devt" "dv" Indicate language/codeset support +code_set_init, "csin" "ci" Init sequence for multiple codesets +set0_des_seq, "s0ds" "s0" Shift into codeset 0 (EUC set 0, ASCII) +set1_des_seq, "s1ds" "s1" Shift into codeset 1 +set2_des_seq, "s2ds" "s2" Shift into codeset 2 +set3_des_seq, "s3ds" "s3" Shift into codeset 3 +# +# Additional printer support +# +set_lr_margin, "smglr" "ML" Sets both left and right margins +set_tb_margin, "smgtb" "MT" Sets both top and bottom margins +bit_image_repeat, "birep" "Xy" Repeat bit-image cell #1 #2 times (use tparm) +bit_image_newline, "binel" "Zz" Move to next row of the bit image (use tparm) +bit_image_carriage_return, "bicr" "Yv" Move to beginning of same row (use tparm) +color_names, "colornm" "Yw" Give name for color #1 +define_bit_image_region, "defbi" "Yx" Define rectangular bit-image region (use tparm) +end_bit_image_region, "endbi" "Yy" End a bit-image region (use tparm) +set_color_band, "setcolor" "Yz" Change to ribbon color #1 +set_page_length, "slines" "YZ" Set page length to #1 lines (use tparm) +# +# Locus Merge terminfo strings required for PC scancode devices +# +display_pc_char, "dispc" "S1" Display PC character +enter_pc_charset_mode, "smpch" "S2" Enter PC character display mode +exit_pc_charset_mode, "rmpch" "S3" Disable PC character display mode +enter_scancode_mode, "smsc" "S4" Enter PC scancode mode +exit_scancode_mode, "rmsc" "S5" Disable PC scancode mode +pc_term_options, "pctrm" "S6" PC terminal options +scancode_escape, "scesc" "S7" Escape for scancode emulation +alt_scancode_esc, "scesa" "S8" Alternate escape for scancode emulation +# +# Addition capabilities needed for X/Curses +# +enter_horizontal_hl_mode, "ehhlm" "??" Horizontal highlight mode +enter_left_hl_mode, "elhlm" "??" Left highlight mode +enter_low_hl_mode, "elohlm" "??" Low highlight mode +enter_right_hl_mode, "erhlm" "??" Right highlight mode +enter_top_hl_mode, "ethlm" "??" Top highlight mode +enter_vertical_hl_mode, "evhlm" "??" Vertical highlight mode +set_a_attributes, "sgr1" "??" Define second set of attributes #1-#6 +set_pglen_inch, "slength" "YI" Set page length to #1/100 of an inch +# Add new Strings before this line. +--- end str diff --git a/usr/src/lib/libcurses/screen/cbreak.c b/usr/src/lib/libcurses/screen/cbreak.c new file mode 100644 index 0000000000..dce15a57c6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/cbreak.c @@ -0,0 +1,107 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ +#include <sys/types.h> +#include "curses_inc.h" + +int +cbreak(void) +{ + /* + * This optimization is here because till SVR3.1 curses did not come up + * in cbreak mode and now it does. Therefore, most programs when they + * call cbreak won't pay for it since we'll know we're in the right + * mode. + */ + + if (cur_term->_fl_rawmode != 1) { +#ifdef SYSV + /* + * You might ask why ICRNL has anything to do with cbreak. + * The problem is that there are function keys that send + * a carriage return (some hp's). Curses cannot virtualize + * these function keys if CR is being mapped to a NL. Sooo, + * when we start a program up we unmap those but if you are + * in nocbreak then we map them back. The reason for that is that + * if a getch or getstr is done and you are in nocbreak the tty + * driver won't return until it sees a new line and since we've + * turned it off any program that has nl() and nocbreak() would + * force the user to type a NL. The problem with the function keys + * only gets solved if you are in cbreak mode which is OK + * since program taking action on a function key is probably + * in cbreak because who would expect someone to press a function + * key and then return ????? + */ + + PROGTTYS.c_iflag &= ~ICRNL; + PROGTTYS.c_lflag &= ~ICANON; + PROGTTYS.c_cc[VMIN] = 1; + PROGTTYS.c_cc[VTIME] = 0; +#else + PROGTTY.sg_flags |= (CBREAK | CRMOD); +#endif + +#ifdef DEBUG +#ifdef SYSV + if (outf) + fprintf(outf, "cbreak(), file %x, flags %x\n", + cur_term->Filedes, PROGTTYS.c_lflag); +#else + if (outf) + fprintf(outf, "cbreak(), file %x, flags %x\n", + cur_term->Filedes, PROGTTY.sg_flags); +#endif +#endif + cur_term->_fl_rawmode = 1; + cur_term->_delay = -1; + (void) reset_prog_mode(); +#ifdef FIONREAD + cur_term->timeout = 0; +#endif /* FIONREAD */ + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/cexpand.c b/usr/src/lib/libcurses/screen/cexpand.c new file mode 100644 index 0000000000..a97f9e6ff6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/cexpand.c @@ -0,0 +1,250 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <stdlib.h> +#include "print.h" + +#define BACKSLASH '\\' +#define BACKBACK "\\\\" + +extern char *strcat(); + +static char retbuffer[1024]; +static char ret2buffer[1024]; + +/* + * Remove the padding sequences from the input string. + * Return the new string without the padding sequences + * and the padding itself in padbuffer. + */ +char +*rmpadding(char *str, char *padbuffer, int *padding) +{ + static char rmbuffer[1024]; + register char ch; + register char *pbufptr; + register char *retptr = rmbuffer; + char *svbufptr; + int padbylines = 0; + int paddigits = 0; + int paddecimal = 0; + + padbuffer[0] = rmbuffer[0] = '\0'; + if (padding) + *padding = 0; + if (str == NULL) + return (rmbuffer); + + while (ch = (*str++ & 0377)) + switch (ch) { + case '$': + if (*str == '<') { + svbufptr = ++str; /* skip '<' */ + + /* copy number */ + pbufptr = padbuffer; + for (; *str && isdigit(*str); str++) { + *svbufptr++ = *str; + *pbufptr++ = *str; + } + *pbufptr = '\0'; + paddigits += atoi(padbuffer); + /* check for decimal */ + if (*str == '.') { + str++; + pbufptr = padbuffer; + for (; *str && isdigit(ch); + str++) { + *svbufptr++ = *str; + *pbufptr++ = *str; + } + *pbufptr = '\0'; + paddecimal += atoi(padbuffer); + } + for (; (*str == '*') || (*str == '/'); + str++) { + if (*str == '*') + padbylines = 1; + /* Termcap does not support mandatory padding */ + /* marked with /. Just remove it. */ + else { + extern char *progname; + (void) fprintf(stderr, + "%s: mandatory " + "padding removed\n", + progname); + } + } + /* oops, not a padding spec after all */ + /* put us back after the '$<' */ + if (*str != '>') { + str = svbufptr; + *retptr++ = '$'; + *retptr++ = '<'; + } else + str++; /* skip the '>' */ + /* Flag padding info that is not at the end */ + /* of the string. */ + if (*str != '\0') { + extern char *progname; + (void) fprintf(stderr, + "%s: padding information " + "moved to end\n", progname); + } + } else + *retptr++ = ch; + break; + + default: + *retptr++ = ch; + } + *retptr = '\0'; + + if (paddecimal > 10) { + paddigits += paddecimal / 10; + paddecimal %= 10; + } + + if (paddigits > 0 && paddecimal > 0) + (void) sprintf(padbuffer, "%d.%d", paddigits, paddecimal); + else if (paddigits > 0) + (void) sprintf(padbuffer, "%d", paddigits); + else if (paddecimal > 0) + (void) sprintf(padbuffer, ".%d", paddecimal); + if (padbylines) + (void) strcat(padbuffer, "*"); + if (padding) + *padding = paddecimal; + return (rmbuffer); +} + +/* + * Convert a character, making appropriate changes to make it printable + * for a termcap source entry. Change escape, tab, etc., into their + * appropriate equivalents. Return the number of characters printed. + */ +char +*cconvert(char *string) +{ + register int c; + register char *retptr = retbuffer; + + retbuffer[0] = '\0'; + if (string == NULL) + return (retbuffer); + + while (c = *string++) { + /* should check here to make sure that there is enough room */ + /* in retbuffer and realloc it if necessary. */ + c &= 0377; + /* we ignore the return value from sprintf because BSD/V7 */ + /* systems return a (char *) rather than an int. */ + if (c >= 0200) { + (void) sprintf(retptr, "\\%.3o", c); retptr += 4; } + else if (c == '\033') { + (void) sprintf(retptr, "\\E"); retptr += 2; } + else if (c == '\t') { + (void) sprintf(retptr, "\\t"); retptr += 2; } + else if (c == '\b') { + (void) sprintf(retptr, "\\b"); retptr += 2; } + else if (c == '\f') { + (void) sprintf(retptr, "\\f"); retptr += 2; } + else if (c == '\n') { + (void) sprintf(retptr, "\\n"); retptr += 2; } + else if (c == '\r') { + (void) sprintf(retptr, "\\r"); retptr += 2; } + + /* unfortunately \: did not work */ + else if (c == ':') { + (void) sprintf(retptr, "\\072"); retptr += 4; } + else if (c == '^') { + (void) sprintf(retptr, "\\^"); retptr += 2; } + else if (c == BACKSLASH) { + (void) sprintf(retptr, BACKBACK); retptr += 2; } + else if (c < ' ' || c == 0177) { + (void) sprintf(retptr, "^%c", c ^ 0100); retptr += 2; } + else { + (void) sprintf(retptr, "%c", c); retptr++; } + } + *retptr = '\0'; + return (retbuffer); +} + +/* + * Convert the terminfo string into a termcap string. + * Most of the work is done by rmpadding() above and cconvert(); this + * function mainly just pieces things back together. A pointer to the + * return buffer is returned. + * + * NOTE: Some things can not be done at all: converting the terminfo + * parameterized strings into termcap parameterized strings. + */ + +char +*cexpand(char *str) +{ + char padbuffer[512]; + char *retptr; + + retptr = rmpadding(str, padbuffer, (int *)0); + (void) sprintf(ret2buffer, "%s%s", padbuffer, cconvert(retptr)); + + return (ret2buffer); +} + +/* + * Print out a string onto a stream, changing unprintables into + * termcap printables. + */ +int +cpr(FILE *stream, char *string) +{ + register char *ret; + if (string != NULL) { + ret = cexpand(string); + (void) fprintf(stream, "%s", ret); + return (strlen(ret)); + } else + return (0); +} diff --git a/usr/src/lib/libcurses/screen/chkinput.c b/usr/src/lib/libcurses/screen/chkinput.c new file mode 100644 index 0000000000..152daf6c81 --- /dev/null +++ b/usr/src/lib/libcurses/screen/chkinput.c @@ -0,0 +1,185 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * chkinput() + * + * Routine to check to see if any input is waiting. + * It returns a 1 if there is input waiting, and a zero if + * no input is waiting. + * + * This function replaces system calls to ioctl() with the FIONREAD + * parameter. It enables curses to stop a screen refresh whenever + * a character is input. + * Standard BTL UNIX 4.0 or 5.0 does not handle FIONREAD. + * Changes have been made to 'wrefresh.c' to + * call this routine as "_inputpending = chkinput()". + * (delay.c and getch.c also use FIONREAD for nodelay, select and fast peek, + * but these routines have not been changed). + * + * Philip N. Crusius - July 20, 1983 + * Modified to handle various systems March 9, 1984 by Mark Horton. + */ + +#include <unistd.h> +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef FIONREAD +#define HAVE_CHK + +int +_chkinput(void) +{ + int i; + + ioctl(SP->check_fd, FIONREAD, &i); + return (i > 0); +} +#endif /* FIONREAD */ + +#ifdef SELECT +#ifndef HAVE_CHK +#define HAVE_CHK + +int +_chkinput(void) +{ + int ifds, ofds, efds, n; + struct timeval tv; + + ifds = 1 << SP->check_fd; + ofds = efds = 0; + tv.tv_sec = tv.t_usec = 0; + n = select(20, &ifds, &ofds, &efds, &tv); + return (n > 0); +} +#endif /* HAVE_CHK */ +#endif /* SELECT */ + +#ifndef HAVE_CHK +#ifdef SYSV + +int +_chkinput(void) +{ + unsigned char c; /* character input */ + + /* + * Only check typeahead if the user is using our input + * routines. This is because the read below will put + * stuff into the inputQ that will never be read and the + * screen will never get updated from now on. + * This code should GO AWAY when a poll() or FIONREAD can + * be done on the file descriptor as then the check + * will be non-destructive. + */ + + if (!cur_term->fl_typeahdok || + (cur_term->_chars_on_queue == INP_QSIZE) || + (cur_term->_check_fd < 0)) { + goto bad; + } + + /* If input is waiting in curses queue, return (TRUE). */ + + if ((int)cur_term->_chars_on_queue > 0) { +#ifdef DEBUG + if (outf) { + (void) fprintf(outf, "Found a character on the input " + "queue\n"); + _print_queue(); + } +#endif /* DEBUG */ + goto good; + } + + if (read(cur_term->_check_fd, (char *)&c, 1) > 0) { +#ifdef DEBUG + if (outf) { + (void) fprintf(outf, "Reading ahead\n"); + } +#endif /* DEBUG */ + /* + * A character was waiting. Put it at the end + * of the curses queue and return 1 to show that + * input is waiting. + */ +#ifdef DEBUG + if (outf) + _print_queue(); +#endif /* DEBUG */ + cur_term->_input_queue[cur_term->_chars_on_queue++] = c; +good: + return (TRUE); + } else { + /* No input was waiting so return 0. */ +#ifdef DEBUG + if (outf) + (void) fprintf(outf, "No input waiting\n"); +#endif /* DEBUG */ +bad: + return (FALSE); + } +} +#else /* SYSV */ +int +_chkinput() +{ + return (FALSE); +} +#endif /* SYSV */ +#endif /* HAVE_CHK */ + +#ifdef DEBUG +void +_print_queue() /* FOR DEBUG ONLY */ +{ + int i, j = cur_term->_chars_on_queue; + chtype *inputQ = cur_term->_input_queue; + + if (outf) + for (i = 0; i < j; i++) + (void) fprintf(outf, "inputQ[%d] = %c\n", i, inputQ[i]); +} +#endif /* DEBUG */ diff --git a/usr/src/lib/libcurses/screen/clearok.c b/usr/src/lib/libcurses/screen/clearok.c new file mode 100644 index 0000000000..04eb3f0b8c --- /dev/null +++ b/usr/src/lib/libcurses/screen/clearok.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +clearok(WINDOW *win, bool bf) +{ + win->_clear = bf; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/color_cont.c b/usr/src/lib/libcurses/screen/color_cont.c new file mode 100644 index 0000000000..0ba0e423a4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/color_cont.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +color_content(short color, short *r, short *g, short *b) +{ + _Color *ctp; + + if (color < 0 || color > COLORS || !can_change || + (ctp = cur_term->_color_tbl) == (_Color *) NULL) + return (ERR); + + ctp += color; + *r = ctp->r; + *g = ctp->g; + *b = ctp->b; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/compiler.h b/usr/src/lib/libcurses/screen/compiler.h new file mode 100644 index 0000000000..c1d6f82be0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/compiler.h @@ -0,0 +1,204 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _COMPILER_H +#define _COMPILER_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * COPYRIGHT NOTICE + * + * This software is copyright(C) 1982 by Pavel Curtis + * + * Permission is granted to reproduce and distribute + * this file by any means so long as no fee is charged + * above a nominal handling fee and so long as this + * notice is always included in the copies. + * + * Other rights are reserved except as explicitly granted + * by written permission of the author. + * Pavel Curtis + * Computer Science Dept. + * 405 Upson Hall + * Cornell University + * Ithaca, NY 14853 + * + * Ph- (607) 256-4934 + * + * Pavel.Cornell@Udel-Relay(ARPAnet) + * decvax!cornell!pavel (UUCPnet) + */ + + +/* + * compiler.h - Global variables and structures for the terminfo + * compiler. + * + * $Header: RCS/compiler.v Revision 2.1 82/10/25 14:46:04 pavel Exp$ + * + * $Log: RCS/compiler.v $ + * Revision 2.1 82/10/25 14:46:04 pavel + * Added Copyright Notice + * + * Revision 2.0 82/10/24 15:17:20 pavel + * Beta-one Test Release + * + * Revision 1.3 82/08/23 22:30:09 pavel + * The REAL Alpha-one Release Version + * + * Revision 1.2 82/08/19 19:10:10 pavel + * Alpha Test Release One + * + * Revision 1.1 82/08/12 18:38:11 pavel + * Initial revision + * + */ + +#include <stdio.h> +#include <signal.h> /* use this file to determine if this is SVR4.0 system */ +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifndef EXTERN /* for machines w/o multiple externs */ +#define EXTERN extern +#endif /* EXTERN */ + +#define SINGLE /* only one terminal (actually none) */ + +extern char *destination; /* destination directory for object files */ + +EXTERN long start_time; /* time at start of compilation */ + +EXTERN int curr_line; /* current line # in input */ +EXTERN long curr_file_pos; /* file offset of current line */ + +EXTERN int debug_level; /* level of debugging output */ + +#define DEBUG(level, fmt, a1) \ + if (debug_level >= level)\ + fprintf(stderr, fmt, a1); + + /* + * These are the types of tokens returned by the scanner. + * The first three are also used in the hash table of capability + * names. The scanner returns one of these values after loading + * the specifics into the global structure curr_token. + * + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ + +#define MAXBOOLS 64 /* Maximum # of boolean caps we can handle */ +#define MAXNUMS 64 /* Maximum # of numeric caps we can handle */ +#define MAXSTRINGS 512 /* Maximum # of string caps we can handle */ + + /* + * The global structure in which the specific parts of a + * scanned token are returned. + * + */ + +struct token +{ + char *tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char *tk_valstring; /* value of capability (if a string) */ +}; + +EXTERN struct token curr_token; + + /* + * The file comp_captab.c contains an array of these structures, + * one per possible capability. These are then made into a hash + * table array of the same structures for use by the parser. + * + */ + +struct name_table_entry +{ + struct name_table_entry *nte_link; + char *nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + short nte_index; /* index of associated variable in its array */ +}; + +extern struct name_table_entry cap_table[]; +extern struct name_table_entry *cap_hash_table[]; + +extern int Captabsize; +extern int Hashtabsize; +extern int BoolCount; +extern int NumCount; +extern int StrCount; + +#define NOTFOUND ((struct name_table_entry *)0) + /* + * Function types + * + */ + +struct name_table_entry *find_entry(); /* look up entry in hash table */ + +int next_char(); +int trans_string(); + +#ifdef SIGSTOP /* SVR4.0 and beyond */ +#define SRCDIR "/usr/share/lib/terminfo" +#else +#define SRCDIR "/usr/lib/terminfo" +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _COMPILER_H */ diff --git a/usr/src/lib/libcurses/screen/copyright.h b/usr/src/lib/libcurses/screen/copyright.h new file mode 100644 index 0000000000..bb980e8301 --- /dev/null +++ b/usr/src/lib/libcurses/screen/copyright.h @@ -0,0 +1,40 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" diff --git a/usr/src/lib/libcurses/screen/copywin.c b/usr/src/lib/libcurses/screen/copywin.c new file mode 100644 index 0000000000..427c2fd0b4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/copywin.c @@ -0,0 +1,183 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * This routine writes parts of Srcwin onto Dstwin, + * either non-destructively (over_lay = TRUE) or destructively + * (over_lay = FALSE). + */ + +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +int +copywin(WINDOW *Srcwin, WINDOW *Dstwin, + int minRowSrc, int minColSrc, int minRowDst, + int minColDst, int maxRowDst, int maxColDst, + int over_lay) +{ + int ySrc, yDst, which_copy, t; + int height = (maxRowDst - minRowDst) + 1, + width = (maxColDst - minColDst) + 1; + chtype **_yDst = Dstwin->_y, **_ySrc = Srcwin->_y, + bkSrc = Srcwin->_bkgd, atDst = Dstwin->_attrs, + *spSrc, *spDst, *epSrc, *epDst, *savepS, + *savepD, width_bytes, numcopied; + +#ifdef DEBUG + if (outf) + fprintf(outf, "copywin(%0.2o, %0.2o);\n", Srcwin, Dstwin); +#endif /* DEBUG */ + + /* + * If we are going to be copying from curscr, + * first offset into curscr the offset the Dstwin knows about. + */ + if (Srcwin == curscr) + minRowSrc += Dstwin->_yoffset; + + /* + * There are three types of copy. + * 0 - Straight memcpy allowed + * 1 - We have to first check to see if the source character is a blank + * 2 - Dstwin has attributes or bkgd that must changed + * on a char-by-char basis. + */ + if ((which_copy = (over_lay) ? 1 : + (2 * ((Dstwin->_attrs != A_NORMAL) || + (Dstwin->_bkgd != _BLNKCHAR)))) == 0) + width_bytes = width * (int)sizeof (chtype); + + /* for each Row */ + for (ySrc = minRowSrc, yDst = minRowDst; height-- > 0; ySrc++, yDst++) { + if (which_copy) { + spSrc = &_ySrc[ySrc][minColSrc]; + spDst = &_yDst[yDst][minColDst]; + numcopied = width; + + epSrc = savepS = &_ySrc[ySrc][maxColDst]; + epDst = savepD = &_yDst[yDst][maxColDst]; + /* only copy into an area bounded by whole characters */ + for (; spDst <= epDst; spSrc++, spDst++) + if (!ISCBIT(*spDst)) + break; + if (spDst > epDst) + continue; + for (; epDst >= spDst; --epDst, --epSrc) + if (!ISCBIT(*epDst)) + break; + t = _curs_scrwidth[TYPE(RBYTE(*epDst))] - 1; + if (epDst+t <= savepD) + epDst += t, epSrc += t; + else + epDst -= 1, epSrc -= 1; + if (epDst < spDst) + continue; + /* don't copy partial characters */ + for (; spSrc <= epSrc; ++spSrc, ++spDst) + if (!ISCBIT(*spSrc)) + break; + if (spSrc > epSrc) + continue; + for (; epSrc >= spSrc; --epSrc, --epDst) + if (!ISCBIT(*epSrc)) + break; + t = _curs_scrwidth[TYPE(RBYTE(*epSrc))] - 1; + if (epSrc+t <= savepS) + epSrc += t, epDst += t; + else + epSrc -= 1, epDst -= 1; + if (epSrc < spSrc) + continue; + /* make sure that the copied-to place is clean */ + if (ISCBIT(*spDst)) + (void) _mbclrch(Dstwin, minRowDst, + /*LINTED*/ + (intptr_t)(spDst - *_yDst[yDst])); + if (ISCBIT(*epDst)) + (void) _mbclrch(Dstwin, minRowDst, + /*LINTED*/ + (intptr_t)(epDst - *_yDst[yDst])); + /*LINTED*/ + numcopied = (chtype) (epDst - spDst + 1); + + if (which_copy == 1) { /* overlay */ + for (; numcopied-- > 0; spSrc++, spDst++) + /* Check to see if the char is a "blank/bkgd". */ + if (*spSrc != bkSrc) + *spDst = *spSrc | atDst; + } else { + for (; numcopied-- > 0; spSrc++, spDst++) + *spDst = *spSrc | atDst; + } + } else { + /* ... copy all chtypes */ + (void) memcpy((char *)&_yDst[yDst][minColDst], + (char *)&_ySrc[ySrc][minColSrc], width_bytes); + } + + /* note that the line has changed */ + if (minColDst < Dstwin->_firstch[yDst]) + /*LINTED*/ + Dstwin->_firstch[yDst] = (short)minColDst; + if (maxColDst > Dstwin->_lastch[yDst]) + /*LINTED*/ + Dstwin->_lastch[yDst] = (short)maxColDst; + } + +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + (*_y16update)(Dstwin, (maxRowDst - minRowDst) + 1, + (maxColDst - minColDst) + 1, minRowDst, minColDst); + } +#endif /* _VR3_COMPAT_CODE */ + + /* note that something in Dstwin has changed */ + Dstwin->_flags |= _WINCHANGED; + + if (Dstwin->_sync) + wsyncup(Dstwin); + + return (Dstwin->_immed ? wrefresh(Dstwin) : OK); +} diff --git a/usr/src/lib/libcurses/screen/curs_set.c b/usr/src/lib/libcurses/screen/curs_set.c new file mode 100644 index 0000000000..d47b141f0e --- /dev/null +++ b/usr/src/lib/libcurses/screen/curs_set.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Change the style of cursor in use. */ + +int +curs_set(int visibility) +{ + int ret = cur_term->_cursorstate; + char **cursor_seq = cur_term->cursor_seq; + + if ((visibility < 0) || (visibility > 2) || (!cursor_seq[visibility])) + ret = ERR; + else + if (visibility != ret) + (void) tputs(cursor_seq[cur_term->_cursorstate = + /*LINTED*/ + (char)visibility], 0, _outch); + (void) fflush(SP->term_file); + return (ret); +} diff --git a/usr/src/lib/libcurses/screen/curserr.c b/usr/src/lib/libcurses/screen/curserr.c new file mode 100644 index 0000000000..403123ba14 --- /dev/null +++ b/usr/src/lib/libcurses/screen/curserr.c @@ -0,0 +1,73 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" +#include "_curs_gettext.h" + +char *curs_err_strings[4]; +static int first_curs_err_message = 0; + +void +curserr(void) +{ + if (first_curs_err_message == 0) { + first_curs_err_message = 1; + curs_err_strings[0] = + _curs_gettext("I don't know how to deal with your \"%s\" terminal"); + curs_err_strings[1] = + _curs_gettext("I need to know a more specific terminal type " + "than \"%s\""); + curs_err_strings[2] = +#ifdef DEBUG + "malloc returned NULL in function \"%s\""; +#else + _curs_gettext("malloc returned NULL"); +#endif /* DEBUG */ + } + + (void) fprintf(stderr, _curs_gettext("Sorry, ")); + (void) fprintf(stderr, curs_err_strings[curs_errno], curs_parm_err); + (void) fprintf(stderr, ".\r\n"); +} diff --git a/usr/src/lib/libcurses/screen/curses.c b/usr/src/lib/libcurses/screen/curses.c new file mode 100644 index 0000000000..ef71dd5cb9 --- /dev/null +++ b/usr/src/lib/libcurses/screen/curses.c @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* Define global variables */ + +#include <sys/types.h> +#include "curses_inc.h" + +WINDOW *stdscr, *curscr, *_virtscr; +int LINES, COLS, TABSIZE, COLORS, COLOR_PAIRS; +short curs_errno = -1; +int (*_setidln)(void), (*_useidln)(void), + (*_quick_ptr)(WINDOW *, chtype); +int (*_do_slk_ref)(void), (*_do_slk_tch)(void), (*_do_slk_noref)(void); +void (*_rip_init)(void); /* to initialize rip structures */ +void (*_slk_init)(void); /* to initialize slk structures */ +SCREEN *SP; +MOUSE_STATUS Mouse_status = {-1, -1, {BUTTON_RELEASED, BUTTON_RELEASED, + BUTTON_RELEASED}, 0}; + +#ifdef _VR3_COMPAT_CODE +void (*_y16update)(WINDOW *, int, int, int, int); +chtype *acs32map; + +#undef acs_map +_ochtype *acs_map; +#else /* _VR3_COMPAT_CODE */ +chtype *acs_map; +#endif /* _VR3_COMPAT_CODE */ + +char *curses_version = "SVR4", curs_parm_err[32]; +bool _use_env = TRUE; + +#ifdef DEBUG +FILE *outf = stderr; /* debug output file */ +#endif /* DEBUG */ + +short _csmax, /* max size of a multi-byte character */ + _scrmax; /* max size of a multi-column character */ +bool _mbtrue; /* a true multi-byte character */ diff --git a/usr/src/lib/libcurses/screen/curses.ed b/usr/src/lib/libcurses/screen/curses.ed new file mode 100644 index 0000000000..292ada4764 --- /dev/null +++ b/usr/src/lib/libcurses/screen/curses.ed @@ -0,0 +1,1444 @@ +e keycaps +H +g/.*KEY_/s//KEY_/ +g/KEY_F([1-9]/d +g'\(KEY_[^,]*\),[ ]*\([0-9][0-9]*\),[ ]*\(.*\)'s''#define \1 \2 /* \3 */' +w ./tmp/keycaps +e !sort +2n ./tmp/keycaps +g'\(KEY_[^ ] \)'s''\1 ' +g'\(KEY_[^ ][^ ] \)'s''\1 ' +g'\(KEY_[^ ][^ ][^ ] \)'s''\1 ' +1i +/* Funny "characters" enabled for various special function keys for input */ +/* This list is created from caps and curses.ed. Do not edit it! */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* break key (unreliable) */ +. +/KEY_F(0)/s//KEY_F0 / +a +#define KEY_F(n) (KEY_F0+(n)) /* Space for 64 function keys */ + /* is reserved. */ +. +/KEY_ENTER/a +#define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* reset or hard reset (unreliable) */ +. +/KEY_A1/i + /* The keypad is arranged like this: */ + /* a1 up a3 */ + /* left b2 right */ + /* c1 down c3 */ +. +$a +#define KEY_MAX 0777 /* Maximum curses key */ +. +1i +#ifndef _CURSES_H +#define _CURSES_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * curses.h - this file is automatically made from caps and + * curses.ed. Don't make changes directly to curses.h! + */ + +#include <widec.h> + +#include <stdio.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSMAX 4 + +/* + * This trick is used to distinguish between SYSV and V7 systems. + * We assume that L_ctermid is only defined in stdio.h in SYSV + * systems, but not in V7 or Berkeley UNIX. + */ +#ifdef L_ctermid +#ifdef SYSV +#undef SYSV +#endif +#define SYSV +#endif +/* Some V7 systems define L_ctermid - we list those here */ +#ifdef BSD +#undef SYSV +#endif + +#ifdef SYSV + +#include <termio.h> +typedef struct termio SGTTY; +typedef struct termios SGTTYS; + +#else /* !SYSV */ + +#ifndef _SGTTYB_ +#include <sgtty.h> +#endif /* _SGTTYB_ */ +typedef struct sgttyb SGTTY; + +/* + * Here we attempt to improve portability by providing some #defines + * for SYSV functions on non-SYSV systems. + */ +#define memcpy(dst, src, len) bcopy((src), (dst), (len)) +#define strchr index +#define strrchr rindex +#endif /* SYSV */ + +/* + * bool is a built-in type in standard C++ and as such is not + * defined here when using standard C++. However, the GNU compiler + * fixincludes utility nonetheless creates it's own version of this + * header for use by gcc and g++. In that version it adds a redundant + * guard for __cplusplus. To avoid the creation of a gcc/g++ specific + * header we need to include the following magic comment: + * + * we must use the C++ compiler's type + * + * The above comment should not be removed or changed until GNU + * gcc/fixinc/inclhack.def is updated to bypass this header. + */ +#if !defined(__cplusplus) && !defined(_BOOL) +typedef char bool; +#endif /* !defined(__cplusplus) && !defined(_BOOL) */ + +#define _VR3_COMPAT_CODE +/* + * chtype is the type used to store a character together with attributes. + * It can be set to "char" to save space, or "long" to get more attributes. + */ +#ifdef CHTYPE +typedef CHTYPE chtype; +#else +#ifdef _LP64 +typedef unsigned int chtype; +#else +typedef unsigned long chtype; +#endif /* _LP64 */ +#endif /* CHTYPE */ + +/* + * Define for the 'old' definition of chtype is required + * when we are running in compatibility mode + */ +#ifdef _VR3_COMPAT_CODE +typedef unsigned short _ochtype; +#endif + +/* TRUE and FALSE get defined so many times, */ +/* let's not get in the way of other definitions. */ +#if !defined(TRUE) || ((TRUE) != 1) +#define TRUE (1) +#endif +#if !defined(FALSE) || ((FALSE) != 0) +#define FALSE (0) +#endif +#if !defined(ERR) || ((ERR) != -1) +#define ERR (-1) +#endif +#if !defined(OK) || ((OK) != 0) +#define OK (0) +#endif + +/* short-hand notations */ +typedef struct _win_st WINDOW; +typedef struct screen SCREEN; +typedef struct _Mouse MOUSE_STATUS; + +struct _win_st +{ + short _cury, _curx; /* current coordinates */ + short _maxy, _maxx; /* max coordinates */ + short _begy, _begx; /* (0,0) screen coordinates */ + char _flags; + short _yoffset; /* actual begy is _begy+_yoffset */ + bool _clear, /* clearok() info */ + _leave, /* leaveok() info */ + _immed, /* window in immediate mode */ + _sync; /* auto syncup of parent */ + WINDOW *_padwin; /* "pad" area for current window */ +#ifdef _VR3_COMPAT_CODE + _ochtype **_y16; /* MUST stay at this offset in WINDOW */ +#endif + short *_firstch; /* first change in line */ + short *_lastch; /* last change in line */ + short _tmarg, _bmarg; /* scrolling region bounds */ + /* MUST stay at this offset in WINDOW */ + unsigned _scroll : 1; /* scrollok() info */ + unsigned _use_idl : 1; + unsigned _use_keypad : 1; + unsigned _notimeout : 1; + unsigned _use_idc : 1; + chtype _attrs; /* current window attributes */ + chtype _bkgd; /* background, normally blank */ + int _delay; /* delay period on wgetch */ + /* 0: for nodelay */ + /* <0: for infinite delay */ + /* >0: delay time in millisec */ + short _ndescs; /* number of descendants */ + short _parx, _pary; /* coords relative to parent (0,0) */ + WINDOW *_parent; /* the parent if this is a subwin */ + chtype **_y; /* lines of data */ + short _nbyte; /* number of bytes to come */ + short _index; /* index to hold coming char */ + char _waitc[CSMAX]; /* array to hold partial m-width char */ + bool _insmode; /* TRUE for inserting, */ + /* FALSE for adding */ +}; + +/* _lastch is initially set to this, _firstch is set to win->_maxx */ +#define _NOCHANGE -1 +#define _INFINITY 16000 /* no line can be longer than this */ + +/* values for win->_flags */ +#define _ISPAD 001 +#define _WINCHANGED 002 +#define _WINMOVED 004 +#define _WINSDEL 010 +#define _CANT_BE_IMMED 020 +#define _WIN_ADD_ONE 040 +#define _WIN_INS_ONE 100 + +struct _Mouse { + int x, y; + short button[3]; + int changes; +}; + +#define CURS_STUPID 0 +#define CURS_UNKNOWN 1 +#define CURS_BAD_MALLOC 2 + +/* + * Various tricks to shut up lint about things that are perfectly fine. + */ +#if defined(__lint) && !defined(CURSES) /* if not internal to curses source */ +struct screen { + int _nobody_; +}; +#endif /* __lint */ + +/* common external variables */ + +extern int LINES, COLS, TABSIZE, COLORS, COLOR_PAIRS; + +extern short curs_errno; + +extern WINDOW *stdscr, *curscr; + +extern MOUSE_STATUS Mouse_status; + +extern char ttytype[]; + +extern char curs_parm_err[], + *curs_err_strings[]; + +/* Function declarations */ + +#ifdef _VR3_COMPAT_CODE + +extern _ochtype *acs_map; +extern chtype *acs32map; + +/* definitions for Vr3 source compatibility */ + +#define initscr initscr32 +#define newterm newterm32 +#define waddch w32addch +#define wechochar w32echochar +#define pechochar p32echochar +#define winsch w32insch +#define vidputs vid32puts +#define vidattr vid32attr +#define wattroff w32attroff +#define wattron w32attron +#define wattrset w32attrset +#define acs_map acs32map +#define box box32 + +#ifdef __STDC__ +extern WINDOW *initscr(void); +extern SCREEN *newterm(char *, FILE *, FILE *); +#else +extern WINDOW *initscr(); +extern SCREEN *newterm(); +#endif + +/* declarations for mini-curses */ + +#ifdef __STDC__ +extern WINDOW *m_initscr(void); + +extern SCREEN *m_newterm(char *, FILE *, FILE *); + +extern int m_addch(int), m_addstr(char *), m_clear(void), m_erase(void), + m_move(int, int), m_refresh(void); + +#else /* __STDC__ */ +extern WINDOW *m_initscr(); + +extern SCREEN *m_newterm(); + +extern int m_addch(), m_addstr(), m_clear(), m_erase(), + m_move(), m_refresh(); + +#endif /* __STDC__ */ + +#else /* _VR3_COMPAT_CODE */ + +extern chtype *acs_map; + +#endif /* _VR3_COMPAT_CODE */ + +#ifdef __STDC__ + +extern SCREEN *newscreen(char *, int, int, int, FILE *, FILE *); +extern SCREEN *setcurscreen(SCREEN *); + +extern WINDOW *initscr(void); +extern WINDOW *newwin(int, int, int, int); +extern WINDOW *newpad(int, int); +extern WINDOW *derwin(WINDOW *, int, int, int, int); +extern WINDOW *dupwin(WINDOW *); +extern WINDOW *getwin(FILE *); + +extern int wgetch(WINDOW *); /* it can return KEY_*, for instance. */ + +extern char *longname(void); /* long name of terminal */ +extern char *termname(void); /* effective terminal name */ +extern char *keyname(int); /* name of token returned by wgetch() */ +extern char *slk_label(int); +extern char erasechar(void); +extern char killchar(void); +extern char *unctrl(int); + +extern chtype termattrs(void); + +extern void vidupdate(chtype, chtype, int (*)(char)); +extern void wsyncup(WINDOW *); +extern void wsyncdown(WINDOW *); +extern void delscreen(SCREEN *); +extern void curserr(void); +extern void _setqiflush(int); +extern void wcursyncup(WINDOW *); + +extern int cbreak(void); +extern int nocbreak(void); +extern int reset_prog_mode(void); +extern int reset_shell_mode(void); +extern int def_prog_mode(void); +extern int _setecho(int); +extern int _setnonl(int); +extern int def_shell_mode(void); +extern int raw(void); +extern int savetty(void); +extern int traceon(void); +extern int _meta(int); +extern int traceoff(void); +extern int noraw(void); +extern int flushinp(void); +extern int _getsyx(int *, int *); +extern int _ring(bool); +extern int resetty(void); +extern int ripoffline(int, int (*)(WINDOW *, int)); +extern int setsyx(int, int); +extern int slk_refresh(void); +extern int slk_restore(void); +extern int wstandend(WINDOW *); +extern int wstandout(WINDOW *); +extern int wattroff(WINDOW *, chtype); +extern int wattron(WINDOW *, chtype); +extern int wattrset(WINDOW *, chtype); +extern int wrefresh(WINDOW *); + +extern int copywin(WINDOW *, WINDOW *, int, int, int, int, int, int, int); +extern int curs_set(int); +extern int delay_output(int); +extern int delwin(WINDOW *); +extern int doupdate(void); +extern int drainio(int); +extern int endwin(void); +extern int isendwin(void); +extern int baudrate(void); +extern int has_ic(void); +extern int has_il(void); +extern int keypad(WINDOW *, bool); +extern int mvcur(int, int, int, int); + +extern int mvprintw(int, int, ...); +extern int mvscanw(int, int, ...); +extern int mvwprintw(WINDOW *, int, int, ...); +extern int mvwscanw(WINDOW *, int, int, ...); +extern int printw(char *, ...); +extern int scanw(char *, ...); +extern int wprintw(WINDOW *, ...); +extern int wscanw(WINDOW *, ...); + + /* __va_list is the ANSI-C safe definition of the */ + /* va_list type as allowed to be defined in stdlib.h. */ + /* <stdio.h> provides the nested include of <va_list.h> */ + /* which provides this namespace safe definition. */ + /* Either <stdarg.h> or <varargs.h> must be included to */ + /* use these interfaces. */ + +extern int vwprintw(WINDOW *, char *, __va_list); +extern int vwscanw(WINDOW *, char *, __va_list); + +extern int mvwin(WINDOW *, int, int); +extern int mvderwin(WINDOW *, int, int); +extern int napms(int); +extern int newkey(char *, short, bool); +extern int filter(void); +extern int pechochar(WINDOW *, chtype); +extern int pnoutrefresh(WINDOW *, int, int, int, int, int, int); +extern int prefresh(WINDOW *, int, int, int, int, int, int); + +extern int putwin(WINDOW *, FILE *); +extern int wredrawln(WINDOW *, int, int); +extern int scr_dump(char *); +extern int setupterm(char *, int, int *); + +extern int slk_attron(chtype); +extern int slk_attroff(chtype); +extern int slk_attrset(chtype); +extern int slk_clear(void); +extern int slk_noutrefresh(void); +extern int slk_set(int, char *, int); +extern int slk_start(int, int *); +extern int slk_touch(void); +extern int start_color(void); +extern int typeahead(int); + +extern bool can_change_color(void); +extern bool has_colors(void); + +extern int waddch(WINDOW *, chtype); +extern int waddchnstr(WINDOW *, chtype *, int); +extern int waddnstr(WINDOW *, char *, int); +extern int wbkgd(WINDOW *, chtype); +extern int wborder(WINDOW *, chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +extern int wclrtobot(WINDOW *); +extern int wclrtoeol(WINDOW *); +extern int wdelch(WINDOW *); +extern int wechochar(WINDOW *, chtype); +extern int wgetstr(WINDOW *, char *); +extern int wgetnstr(WINDOW *, char *, int); +extern int whline(WINDOW *, chtype, int); +extern int wvline(WINDOW *, chtype, int); +extern int winchnstr(WINDOW *, chtype *, int); +extern int winchstr(WINDOW *, chtype *); +extern int winnstr(WINDOW *, char *, int); +extern int winsch(WINDOW *, chtype); +extern int winsdelln(WINDOW *, int); /* internal */ +extern int winsnstr(WINDOW *, char *, int); +extern int winstr(WINDOW *, char *); +extern int wmove(WINDOW *, int, int); +extern int wnoutrefresh(WINDOW *); +extern int wredrawln(WINDOW *, int, int); +extern int wscrl(WINDOW *, int); +extern int wsetscrreg(WINDOW *, int, int); +extern int wtouchln(WINDOW *, int, int, int); + +extern int crmode(void); +extern int nocrmode(void); +extern int ungetch(int); + +extern int mouse_set(long int); +extern int mouse_on(long int); +extern int mouse_off(long int); +extern int request_mouse_pos(void); +extern int map_button(unsigned long); + +extern void wmouse_position(WINDOW *, int *, int *); + +extern unsigned long getmouse(void), getbmap(void); + + /* the following declarations take integers as arguments */ + /* to keep the CI5 compiler happy. what we really want */ + /* to pass is given in comments. (by the way, we don't */ + /* save anything by passing short or bool, since compiler */ + /* expands them to integers any way */ + +extern int pair_content(short, short *, short *); +extern int color_content(short, short *, short *, short *); /* as above */ +extern int init_color(short, short, short, short); +extern int init_pair(short, short, short); +extern int idlok(WINDOW *, bool); + +extern void immedok(WINDOW *, bool); + +extern chtype winwch(WINDOW *); + +extern int pechowchar(WINDOW *, chtype); +extern int ungetwch(const wchar_t); +extern int waddnwstr(WINDOW *, wchar_t *, int); +extern int waddwch(WINDOW *, chtype); +extern int waddwchnstr(WINDOW *, chtype *, int); +extern int wechowchar(WINDOW *, chtype); +extern int wgetnwstr(WINDOW *, wchar_t *, int); +extern int wgetwch(WINDOW *); +extern int wgetwstr(WINDOW *, wchar_t *); +extern int winnwstr(WINDOW *, wchar_t *, int); +extern int winsnwstr(WINDOW *, wchar_t *, int); +extern int winswch(WINDOW *, chtype); +extern int winwchnstr(WINDOW *, chtype *, int); +extern int winwstr(WINDOW *, wchar_t *); + +#else /* __STDC__ */ + +extern SCREEN *newscreen(), /* termname, lines, cols, tabsiz, fout, fin */ + *setcurscreen(); /* screenptr */ + +extern WINDOW *initscr(), + *newwin(), /* nlines, ncols, begy, begx */ + *newpad(), /* nlines, ncols */ + *derwin(), /* orig, nlines, ncols, begy, begx */ + *dupwin(), /* orig */ + *getwin(); /* file */ + +extern int wgetch(); /* because it can return KEY_*, for instance. */ + +extern char *longname(), /* long name of terminal */ + *termname(), /* effective terminal name */ + *keyname(), /* (int) name of token returned by wgetch() */ + *slk_label(), /* index */ + erasechar(), + killchar(), + *unctrl(); + +extern chtype termattrs(); + +extern void vidupdate(), wsyncup(), wsyncdown(), + delkeymap(), + delscreen(), curserr(), + _setqiflush(), + immedok(), + wcursyncup(); + +extern int cbreak(), nocbreak(), + reset_prog_mode(), reset_shell_mode(), def_prog_mode(), + _setecho(), _setnonl(), + def_shell_mode(), raw(), + savetty(), traceon(), _meta(), + traceoff(), noraw(), flushinp(), _getsyx(), + _ring(), resetty(), ripoffline(), setsyx(), slk_refresh(), + slk_restore(), wstandend(), wstandout(), + wattroff(), wattron(), wattrset(), wrefresh(); + +extern int color_cont(), copywin(), curs_set(), delay_output(), delwin(), + doupdate(), drainio(), endwin(), isendwin(), + baudrate(), has_ic(), has_il(), idlok(), + init_color(), init_pair(), keypad(), mvcur(); + +extern int mvprintw(), mvscanw(), mvwprintw(), mvwscanw(), + printw(), scanw(), wprintw(), wscanw(), vwprintw(), vwscanw(); + +extern int mvwin(), mvderwin(), napms(), newkey(), filter(), + pair_content(), pechochar(), pnoutrefresh(), prefresh(); + +extern int putwin(), wredrawln(), scr_dump(), setupterm(); + +extern int slk_attrof(), slk_attrof(), slk_attrset(), + slk_clear(), slk_noutrefresh(), slk_set(), + slk_start(), slk_touch(), start_color(), + typeahead(); + +extern bool can_change_color(), has_colors(); + +extern int waddch(), waddchnstr(), waddnstr(), wbkgd(), + wborder(), wclrtobot(), wclrtoeol(), wdelch(), wechochar(), + wgetstr(), wgetnstr(), whline(), wvline(), winchnstr(), + winchstr(), winnstr(), winsch(), + winsdelln(), /* internal */ + winsnstr(), winstr(), wmove(), wnoutrefresh(), wredrawln(), + wscrl(), wsetscrreg(), wtouchln(); + +extern int crmode(), nocrmode(), ungetch(); + +extern int mouse_set(), mouse_on(), mouse_off(), + request_mouse_pos(), map_button(); + +extern void wmouse_position(); + +extern unsigned long getmouse(), getbmap(); + +extern chtype winwch(); + +extern int pechowchar(), ungetwch(), waddnwstr(), waddwch(), + waddwchnstr(), wechowchar(), wgetnwstr(), wgetwch(), + wgetwstr(), winnwstr(), winsnwstr(), winswch(), + winwchnstr(), winwstr(); + +#endif /* __STDC__ */ + +#define getsyx(y, x) _getsyx(&(y), &(x)) + +/* + * Functions to get at the window structure. + */ + +#define getyx(win, y, x) ((y) = getcury(win), (x) = getcurx(win)) +#define getbegyx(win, y, x) ((y) = getbegy(win), (x) = getbegx(win)) +#define getmaxyx(win, y, x) ((y) = getmaxy(win), (x) = getmaxx(win)) +#define getparyx(win, y, x) ((y) = getpary(win), (x) = getparx(win)) + +#if defined(CURS_PERFORMANCE) && !defined(__lint) +#define getcury(win) ((win)->_cury) +#define getcurx(win) ((win)->_curx) +#define getbegy(win) ((win)->_begy) +#define getbegx(win) ((win)->_begx) +#define getmaxy(win) ((win)->_maxy) +#define getmaxx(win) ((win)->_maxx) +#define getpary(win) ((win)->_pary) +#define getparx(win) ((win)->_parx) +#define getbkgd(win) ((win)->_bkgd) +#define getattrs(win) ((win)->_attrs) +#else /* defined(CURS_PERFORMANCE) && !defined(__lint) */ + +#ifdef __STDC__ +extern int getcury(WINDOW *); +extern int getcurx(WINDOW *); +extern int getbegy(WINDOW *); +extern int getbegx(WINDOW *); +extern int getmaxy(WINDOW *); +extern int getmaxx(WINDOW *); +extern int getpary(WINDOW *); +extern int getparx(WINDOW *); + +extern chtype getbkgd(WINDOW *); +extern chtype getattrs(WINDOW *); + +#else /* __STDC__ */ +extern int getcury(), getcurx(), getbegy(), getbegx(), + getmaxy(), getmaxx(), getpary(), getparx(); + +extern chtype getbkgd(), getattrs(); + +#endif /* __STDC__ */ +#endif /* defined(CURS_PERFORMANCE) && !defined(__lint) */ + +#if defined(NOMACROS) || defined(__lint) + +#ifdef __STDC__ + +extern SCREEN *newterm(char *, FILE *, FILE *); +extern SCREEN *set_term(SCREEN *); + +extern WINDOW *subpad(WINDOW *, int, int, int, int); +extern WINDOW *subwin(WINDOW *, int, int, int, int); + +extern char *unctrl(int); + +extern chtype inch(void); +extern chtype winch(WINDOW *); +extern chtype mvinch(int, int); +extern chtype mvwinch(WINDOW *, int, int); + +extern int addch(chtype); +extern int addchnstr(chtype *, int); +extern int addchstr(chtype *); +extern int addnstr(char *, int); +extern int addstr(char *); +extern int attroff(chtype); +extern int attron(chtype); +extern int attrset(chtype); +extern int beep(void); +extern int bkgd(chtype); +extern int border(chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +extern int box(WINDOW *, chtype, chtype); +extern int clear(void); +extern int clearok(WINDOW *, bool); +extern int clrtobot(void); +extern int clrtoeol(void); +extern int crmode(void); +extern int delch(void); +extern int deleteln(void); +extern int echo(void); +extern int echochar(chtype); +extern int erase(void); +extern int fixterm(void); +extern int flash(void); +extern int garbagedlines(WINDOW *, int, int); +extern int garbagedwin(WINDOW *); +extern int getch(void); +extern int getstr(char *); +extern int gettmode(void); +extern int halfdelay(int); +extern int hline(chtype, int); +extern int inchnstr(chtype *, int); +extern int inchstr(chtype *); +extern int innstr(char *, int); +extern int insch(chtype); +extern int insdelln(int); +extern int insertln(void); +extern int insnstr(char *, int); +extern int insstr(char *); +extern int instr(char *); +extern int intrflush(WINDOW *, int); +extern int is_linetouched(WINDOW *, int); +extern int is_wintouched(WINDOW *); +extern int leaveok(WINDOW *, bool); +extern int meta(WINDOW *, int); +extern int move(int, int); +extern int mvaddch(int, int, chtype); +extern int mvaddchnstr(int, int, chtype *, int); +extern int mvaddchstr(int, int, chtype *); +extern int mvaddnstr(int, int, char *, int); +extern int mvaddstr(int, int, char *); +extern int mvdelch(int, int); +extern int mvgetch(int, int); +extern int mvgetstr(int, int, char *); +extern int mvhline(int, int, chtype, int); +extern int mvinchnstr(int, int, chtype *, int); +extern int mvinchstr(int, int, chtype *); +extern int mvinnstr(int, int, char *, int); +extern int mvinsch(int, int, chtype); +extern int mvinsnstr(int, int, char *, int); +extern int mvinsstr(int, int, char *); +extern int mvinstr(int, int, char *); +extern int mvvline(int, int, chtype, int); +extern int mvwaddch(WINDOW *, int, int, chtype); +extern int mvwaddchnstr(WINDOW *, int, int, chtype *, int); +extern int mvwaddchstr(WINDOW *, int, int, chtype *); +extern int mvwaddnstr(WINDOW *, int, int, char *, int); +extern int mvwaddstr(WINDOW *, int, int, char *); +extern int mvwdelch(WINDOW *, int, int); +extern int mvwgetch(WINDOW *, int, int); +extern int mvwgetstr(WINDOW *, int, int, char *); +extern int mvwhline(WINDOW *, int, int, chtype, int); +extern int mvwinchnstr(WINDOW *, int, int, chtype *, int); +extern int mvwinchstr(WINDOW *, int, int, chtype *); +extern int mvwinnstr(WINDOW *, int, int, char *, int); +extern int mvwinsch(WINDOW *, int, int, chtype); +extern int mvwinsnstr(WINDOW *, int, int, char *, int); +extern int mvwinsstr(WINDOW *, int, int, char *); +extern int mvwinstr(WINDOW *, int, int, char *); +extern int mvwvline(WINDOW *, int, int, chtype, int); +extern int nl(void); +extern int nocrmode(void); +extern int nodelay(WINDOW *, bool); +extern int noecho(void); +extern int nonl(void); +extern int notimeout(WINDOW *, bool); +extern int overlay(WINDOW *, WINDOW *); +extern int overwrite(WINDOW *, WINDOW *); +extern int redrawwin(WINDOW *); +extern int refresh(void); +extern int resetterm(void); +extern int saveterm(void); +extern int scr_init(char *); +extern int scr_restore(char *); +extern int scr_set(char *); +extern int scrl(int); +extern int scroll(WINDOW *); +extern int scrollok(WINDOW *, bool); +extern int setscrreg(int, int); +extern int setterm(char *); +extern int slk_init(int); +extern int standend(void); +extern int standout(void); +extern int syncok(WINDOW *, bool); +extern int touchline(WINDOW *, int, int); +extern int touchwin(WINDOW *); +extern int untouchwin(WINDOW *); +extern int vline(chtype, int); +extern int waddchstr(WINDOW *, chtype *); +extern int waddstr(WINDOW *, char *); +extern int wclear(WINDOW *); +extern int wdeleteln(WINDOW *); +extern int werase(WINDOW *); +extern int winchstr(WINDOW *, chtype *); +extern int winsertln(WINDOW *); +extern int winsstr(WINDOW *, char *); +extern int winstr(WINDOW *, char *); +extern int wstandend(WINDOW *); +extern int wstandout(WINDOW *); + +extern void bkgdset(chtype); +extern void idcok(WINDOW *, bool); +extern void noqiflush(void); +extern void wbkgdset(WINDOW *, chtype); +extern void qiflush(void); +extern void timeout(int); +extern void wtimeout(WINDOW *, int); +extern void use_env(int); /* int sb. char */ + +extern chtype inwch(void); +extern chtype mvinwch(int, int); +extern chtype mvwinwch(WINDOW *, int, int); + +extern int addnwstr(wchar_t *, int); +extern int addwch(chtype); +extern int addwchnstr(chtype *, int); +extern int addwchstr(chtype *); +extern int addwstr(wchar_t *); +extern int echowchar(chtype); +extern int getnwstr(wchar_t *, int); +extern int getwch(void); +extern int getwstr(wchar_t *); +extern int innwstr(wchar_t *, int); +extern int insnwstr(wchar_t *, int); +extern int inswch(chtype); +extern int inswstr(wchar_t *); +extern int inwchnstr(chtype *, int); +extern int inwchstr(chtype *); +extern int inwstr(wchar_t *); +extern int mvaddnwstr(int, int, wchar_t *, int); +extern int mvaddwch(int, int, chtype); +extern int mvaddwchnstr(int, int, chtype *, int); +extern int mvaddwchstr(int, int, chtype *); +extern int mvaddwstr(int, int, wchar_t *); +extern int mvgetnwstr(int, int, wchar_t *, int); +extern int mvgetwch(int, int); +extern int mvgetwstr(int, int, wchar_t *); +extern int mvinnwstr(int, int, wchar_t *, int); +extern int mvinsnwstr(int, int, wchar_t *, int); +extern int mvinswch(int, int, chtype); +extern int mvinswstr(int, int, wchar_t *); +extern int mvinwchnstr(int, int, chtype *, int); +extern int mvinwchstr(int, int, chtype *); +extern int mvinwstr(int, int, wchar_t *); +extern int mvwaddnwstr(WINDOW *, int, int, wchar_t *, int); +extern int mvwaddwch(WINDOW *, int, int, chtype); +extern int mvwaddwchnstr(WINDOW *, int, int, chtype *, int); +extern int mvwaddwchstr(WINDOW *, int, int, chtype *); +extern int mvwaddwstr(WINDOW *, int, int, wchar_t *); +extern int mvwgetnwstr(WINDOW *, int, int, wchar_t *, int); +extern int mvwgetwch(WINDOW *, int, int); +extern int mvwgetwstr(WINDOW *, int, int, wchar_t *); +extern int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); +extern int mvwinsnwstr(WINDOW *, int, int, wchar_t *, int); +extern int mvwinswch(WINDOW *, int, int, chtype); +extern int mvwinswstr(WINDOW *, int, int, wchar_t *); +extern int mvwinwchnstr(WINDOW *, int, int, chtype *, int); +extern int mvwinwchstr(WINDOW *, int, int, chtype *); +extern int mvwinwstr(WINDOW *, int, int, wchar_t *); +extern int waddwchstr(WINDOW *, chtype *); +extern int waddwstr(WINDOW *, wchar_t *); +extern int winswstr(WINDOW *, wchar_t *); +extern int winwchstr(WINDOW *, chtype *); + +#else /* __STDC__ */ + +extern SCREEN *newterm(), /* termname, fout, fin */ +extern SCREEN *set_term(); /* screenptr */ + +extern WINDOW *subpad(), +extern WINDOW *subwin(); + +extern chtype inch(), winch(), mvinch(), mvwinch(); + +extern char *unctrl(); + +extern int addch(), addchnstr(), addchstr(), addnstr(), addstr(), + attroff(), attron(), attrset(), beep(), bkgd(), + border(), box(), clear(), clearok(), clrtobot(), clrtoeol(), + crmode(), delch(), deleteln(), echo(), echochar(), + erase(), +/* MORE */ fixterm(), + flash(), garbagedlines(), garbagedwin(), + getch(), getstr(), gettmode(), halfdelay(), hline(), + inchnstr(), inchstr(), innstr(), insch(), + insdelln(), insertln(), insnstr(), insstr(), instr(), + intrflush(), + is_linetouched(), is_wintouched(), leaveok(), meta(), + move(), mvaddch(), mvaddchnstr(), mvaddchstr(), mvaddnstr(), + mvaddstr(), mvdelch(), mvgetch(), mvgetstr(), mvhline(), + mvinchnstr(), mvinchstr(), mvinnstr(), mvinsch(), mvinsnstr(), + mvinsstr(), mvinstr(), mvvline(), mvwaddch(), mvwaddchnstr(), + mvwaddchstr(), mvwaddnstr(), mvwaddstr(), mvwdelch(), + mvwgetch(), mvwgetstr(), mvwhline(), mvwinchnstr(), + mvwinchstr(), mvwinnstr(), mvwinsch(), mvwinsnstr(), + mvwinsstr(), mvwinstr(), mvwvline(), + nl(), nocrmode(), nodelay(), + noecho(), nonl(), notimeout(), + overlay(), overwrite(), redrawwin(), refresh(), + resetterm(), saveterm(), scr_init(), + scr_restore(), scr_set(), scrl(), + scroll(), scrollok(), setscrreg(), setterm(), + slk_init(), standend(), standout(), + syncok(), touchline(), touchwin(), untouchwin(), vline(), + waddchstr(), waddstr(), wclear(), + wdeleteln(), werase(), winchstr(), winsertln(), + winsstr(), winstr(), wstandend(), wstandout(); + +extern void bkgdset(), wbkgdset(), idcok(), noqiflush(), + qiflush(), timeout(), wtimeout(), use_env(); + +extern unsigned long getmouse(), getbmap(); + +extern chtype inwch(), mvinwch(), mvwinwch(); + +extern int addnwstr(), addwch(), addwchnstr(), addwchstr(), + addwstr(), echowchar(), getnwstr(), getwch(), + getwstr(), innwstr(), insnwstr(), inswch(), + inswstr(), inwchnstr(), inwchstr(), inwstr(), + mvaddnwstr(), mvaddwch(), mvaddwchnstr(), mvaddwchstr(), + mvaddwstr(), mvgetnwstr(), mvgetwch(), mvgetwstr(), + mvinnwstr(), mvinsnwstr(), mvinswch(), mvinswstr(), + mvinwchnstr(), mvinwchstr(), mvinwstr(), mvwaddnwstr(), + mvwaddwch(), mvwaddwchnstr(), mvwaddwchstr(), mvwaddwstr(), + mvwgetnwstr(), mvwgetwch(), mvwgetwstr(), mvwinnwstr(), + mvwinsnwstr(), mvwinswch(), mvwinswstr(), mvwinwchnstr(), + mvwinwchstr(), mvwinwstr(), waddwchstr(), waddwstr(), + winswstr(), winwchstr(); + +#endif /* __STDC__ */ + +#else /* NOMACROS || __lint */ + +/* + * The defines from here down to the #endif for NOMACROS + * define macros, which may be more efficient than their + * function versions. The functions may be accessed by defining + * NOMACROS in C code. This is useful for debugging purposes. + */ + +#include <unctrl.h> + +/* pseudo functions for stdscr */ +#define addch(ch) waddch(stdscr, ch) +#define addnstr(s, n) waddnstr(stdscr, s, n) +#define addstr(str) waddstr(stdscr, str) +#define attroff(at) wattroff(stdscr, at) +#define attron(at) wattron(stdscr, at) +#define attrset(at) wattrset(stdscr, at) +#define bkgd(c) wbkgd(stdscr, c) +#define border(ls, rs, ts, bs, tl, tr, bl, br) \ + wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define delch() wdelch(stdscr) +#define deleteln() wdeleteln(stdscr) +#define echochar(ch) wechochar(stdscr, ch) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr, str) +#define inch() winch(stdscr) +#define insch(c) winsch(stdscr, c) +#define insdelln(id) winsdelln(stdscr, id) +#define insertln() winsertln(stdscr) +#define insnstr(s, n) winsnstr(stdscr, s, n) +#define insstr(s) winsstr(stdscr, s) +#define move(y, x) wmove(stdscr, y, x) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, n) +#define setscrreg(t, b) wsetscrreg(stdscr, t, b) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(tm) wtimeout(stdscr, tm) +#define hline(c, num) whline(stdscr, c, num) +#define vline(c, num) wvline(stdscr, c, num) +#define addchstr(str) waddchstr(stdscr, str) +#define addchnstr(str, n) waddchnstr(stdscr, str, n) +#define instr(str) winstr(stdscr, (str)) +#define innstr(str, n) winnstr(stdscr, (str), (n)) +#define inchstr(str) winchstr(stdscr, str) +#define inchnstr(str, n) winchnstr(stdscr, str, n) +#define bkgdset(c) wbkgdset(stdscr, c) + +#define addnwstr(ws, n) waddnwstr(stdscr, ws, n) +#define addwch(ch) waddwch(stdscr, ch) +#define addwchnstr(str, n) waddwchnstr(stdscr, str, n) +#define addwchstr(str) waddwchstr(stdscr, str) +#define addwstr(ws) waddwstr(stdscr, ws) +#define echowchar(ch) wechowchar(stdscr, ch) +#define getnwstr(ws, n) wgetnwstr(stdscr, ws, n) +#define getwch() wgetwch(stdscr) +#define getwstr(ws) wgetwstr(stdscr, ws) +#define innwstr(ws, n) winnwstr(stdscr, ws, n) +#define insnwstr(ws, n) winsnwstr(stdscr, ws, n) +#define inswch(c) winswch(stdscr, c) +#define inswstr(ws) winswstr(stdscr, ws) +#define inwch() winwch(stdscr) +#define inwchnstr(str, n) winwchnstr(stdscr, str, n) +#define inwchstr(str) winwchstr(stdscr, str) +#define inwstr(ws) winwstr(stdscr, ws) + +#define adjcurspos() wadjcurspos(stdscr) +#define movenextch() wmovenextch(stdscr) +#define moveprevch() wmoveprevch(stdscr) + +/* functions to define environment flags of a window */ +#ifdef CURS_PERFORMANCE +#define wbkgdset(win, c) \ + (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | \ + (c & A_ATTRIBUTES))), ((win)->_bkgd = (c))) +#define syncok(win, bf) ((win)->_parent ? (win)->_sync = (bf) : ERR) +#define notimeout(win, bf) \ + (((win)->_notimeout = ((bf) ? TRUE : FALSE)), OK) +#define clearok(win, bf) (((win)->_clear = (bf)), OK) +#define leaveok(win, bf) (((win)->_leave = (bf)), OK) +#define scrollok(win, bf) (((win)->_scroll = ((bf) ? TRUE : FALSE)), OK) +#define idcok(win, bf) ((win)->_use_idc = ((bf) ? TRUE : FALSE)) +#define nodelay(win, bf) (((win)->_delay = (bf) ? 0 : -1), OK) +#define is_wintouched(win) ((win)->_flags & _WINCHANGED) +#define is_linetouched(win, line) \ + ((((line) >= (win)->_maxy) || ((line) < 0)) ? ERR : \ + (((win)->_firstch[(line)] == _INFINITY) ? FALSE : TRUE)) + +#define subwin(win, nl, nc, by, bx) \ + derwin((win), (nl), (nc), (by-win->_begy), (bx-win->_begx)) +#define touchwin(win) wtouchln((win), 0, (win)->_maxy, TRUE) +#define redrawwin(win) wredrawln((win), 0, (win)->_maxy) +#define winchstr(win, str) \ + winchnstr((win), str, ((win)->_maxx - (win)->_curx)) +#define winstr(win, str) \ + winnstr((win), str, ((win)->_maxx - (win)->_curx)) +#define untouchwin(win) wtouchln((win), 0, ((win)->_maxy), FALSE) +#define winch(win) ((win)->_y[(win)->_cury][(win)->_curx]) + +#define wtimeout(win, tm) ((win)->_delay = (tm)) +#define use_env(bf) (_use_env = (bf)) + +#else /* CURS_PERFORMANCE */ + +#ifdef __STDC__ + +extern void wbkgdset(WINDOW *, chtype); +extern void idcok(WINDOW *, bool); +extern void wtimeout(WINDOW *, int); +extern void use_env(int); /* int sb. char */ + +extern int syncok(WINDOW *, bool); +extern int notimeout(WINDOW *, bool); +extern int clearok(WINDOW *, bool); +extern int leaveok(WINDOW *, bool); +extern int scrollok(WINDOW *, bool); +extern int nodelay(WINDOW *, bool); +extern int is_linetouched(WINDOW *, int); +extern int is_wintouched(WINDOW *); +extern int touchwin(WINDOW *); +extern int redrawwin(WINDOW *); +extern int winchstr(WINDOW *, chtype *); +extern int winstr(WINDOW *, char *); +extern int untouchwin(WINDOW *); + +extern chtype winch(WINDOW *); + +extern WINDOW *subwin(WINDOW *, int, int, int, int); + +#else /* __STDC__ */ + +extern void wbkgdset(), idcok(), wtimeout(), use_env(); + +extern int syncok(), notimeout(), clearok(), leaveok(), + scrollok(), nodelay(), is_linetouched(), is_wintouched(), + touchwin(), redrawwin(), winchstr(), winstr(), + untouchwin(); + +extern chtype winch(); + +extern WINDOW *subwin(); + +#endif /* __STDC__ */ + +#endif /* CURS_PERFORMANCE */ + +/* functions for move and update */ +#define mvaddch(y, x, ch) \ + mvwaddch(stdscr, y, x, ch) +#define mvaddnstr(y, x, s, n) \ + mvwaddnstr(stdscr, y, x, s, n) +#define mvaddstr(y, x, str) \ + mvwaddstr(stdscr, y, x, str) +#define mvdelch(y, x) \ + mvwdelch(stdscr, y, x) +#define mvgetch(y, x) \ + mvwgetch(stdscr, y, x) +#define mvgetstr(y, x, str) \ + mvwgetstr(stdscr, y, x, str) +#define mvinch(y, x) \ + mvwinch(stdscr, y, x) +#define mvinsch(y, x, c) \ + mvwinsch(stdscr, y, x, c) +#define mvinsnstr(y, x, s, n) \ + mvwinsnstr(stdscr, y, x, s, n) +#define mvinsstr(y, x, s) \ + mvwinsstr(stdscr, y, x, s) +#define mvaddchstr(y, x, str) \ + mvwaddchstr(stdscr, y, x, str) +#define mvaddchnstr(y, x, str, n) \ + mvwaddchnstr(stdscr, y, x, str, n) +#define mvinstr(y, x, str) \ + mvwinstr(stdscr, y, x, (str)) +#define mvinnstr(y, x, str, n) \ + mvwinnstr(stdscr, y, x, (str), (n)) +#define mvinchstr(y, x, str) \ + mvwinchstr(stdscr, y, x, str) +#define mvinchnstr(y, x, str, n) \ + mvwinchnstr(stdscr, y, x, str, n) +#define mvhline(y, x, c, num) \ + mvwhline(stdscr, y, x, c, num) +#define mvvline(y, x, c, num) \ + mvwvline(stdscr, y, x, c, num) + +#define mvaddnwstr(y, x, ws, n) \ + mvwaddnwstr(stdscr, y, x, ws, n) +#define mvaddwch(y, x, ch) \ + mvwaddwch(stdscr, y, x, ch) +#define mvaddwchnstr(y, x, str, n) \ + mvwaddwchnstr(stdscr, y, x, str, n) +#define mvaddwchstr(y, x, str) \ + mvwaddwchstr(stdscr, y, x, str) +#define mvaddwstr(y, x, ws) \ + mvwaddwstr(stdscr, y, x, ws) +#define mvgetnwstr(y, x, ws, n) \ + mvwgetnwstr(stdscr, y, x, ws, n) +#define mvgetwch(y, x) \ + mvwgetwch(stdscr, y, x) +#define mvgetwstr(y, x, ws) \ + mvwgetwstr(stdscr, y, x, ws) +#define mvinnwstr(y, x, ws, n) \ + mvwinnwstr(stdscr, y, x, ws, n) +#define mvinsnwstr(y, x, ws, n) \ + mvwinsnwstr(stdscr, y, x, ws, n) +#define mvinswch(y, x, c) \ + mvwinswch(stdscr, y, x, c) +#define mvinswstr(y, x, ws) \ + mvwinswstr(stdscr, y, x, ws) +#define mvinwch(y, x) \ + mvwinwch(stdscr, y, x) +#define mvinwchnstr(y, x, str, n) \ + mvwinwchnstr(stdscr, y, x, str, n) +#define mvinwchstr(y, x, str) \ + mvwinwchstr(stdscr, y, x, str) +#define mvinwstr(y, x, ws) \ + mvwinwstr(stdscr, y, x, ws) + +#define mvwaddch(win, y, x, ch) \ + (wmove(win, y, x) == ERR ? ERR : waddch(win, ch)) +#define mvwaddnstr(win, y, x, s, n) \ + (wmove(win, y, x) == ERR ? ERR : waddnstr(win, s, n)) +#define mvwaddstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : waddstr(win, str)) +#define mvwdelch(win, y, x) \ + (wmove(win, y, x) == ERR ? ERR : wdelch(win)) +#define mvwgetch(win, y, x) \ + (wmove(win, y, x) == ERR ? ERR : wgetch(win)) +#define mvwgetstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : wgetstr(win, str)) +#define mvwinch(win, y, x) \ + (wmove(win, y, x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinsch(win, y, x, c) \ + (wmove(win, y, x) == ERR ? ERR : winsch(win, c)) +#define mvwinsnstr(win, y, x, s, n) \ + (wmove(win, y, x) == ERR ? ERR : winsnstr(win, s, n)) +#define mvwinsstr(win, y, x, s) \ + (wmove(win, y, x) == ERR ? ERR : winsstr(win, s)) +#define mvwhline(win, y, x, c, num) \ + (wmove(win, y, x) == ERR ? ERR : whline(win, c, num)) +#define mvwvline(win, y, x, c, num) \ + (wmove(win, y, x) == ERR ? ERR : wvline(win, c, num)) +#define mvwaddchstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : waddchstr(win, str)) +#define mvwaddchnstr(win, y, x, str, n) \ + (wmove(win, y, x) == ERR ? ERR : waddchnstr(win, str, n)) +#define mvwinstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : winstr(win, str)) +#define mvwinnstr(win, y, x, str, n) \ + (wmove(win, y, x) == ERR ? ERR : winnstr(win, str, n)) +#define mvwinchstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : winchstr(win, str)) +#define mvwinchnstr(win, y, x, str, n) \ + (wmove(win, y, x) == ERR ? ERR : winchnstr(win, str, n)) +#define mvwaddnwstr(win, y, x, ws, n) \ + (wmove(win, y, x) == ERR ? ERR : waddnwstr(win, ws, n)) +#define mvwaddwch(win, y, x, ch) \ + (wmove(win, y, x) == ERR ? ERR : waddwch(win, ch)) +#define mvwaddwchnstr(win, y, x, str, n) \ + (wmove(win, y, x) == ERR ? ERR : waddwchnstr(win, str, n)) +#define mvwaddwchstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : waddwchstr(win, str)) +#define mvwaddwstr(win, y, x, ws) \ + (wmove(win, y, x) == ERR ? ERR : waddwstr(win, ws)) +#define mvwgetnwstr(win, y, x, ws, n) \ + (wmove(win, y, x) == ERR ? ERR : wgetnwstr(win, ws, n)) +#define mvwgetwch(win, y, x) \ + (wmove(win, y, x) == ERR ? ERR : wgetwch(win)) +#define mvwgetwstr(win, y, x, ws) \ + (wmove(win, y, x) == ERR ? ERR : wgetwstr(win, ws)) +#define mvwinnwstr(win, y, x, ws, n) \ + (wmove(win, y, x) == ERR ? ERR : winnwstr(win, ws, n)) +#define mvwinsnwstr(win, y, x, ws, n) \ + (wmove(win, y, x) == ERR ? ERR : winsnwstr(win, ws, n)) +#define mvwinswch(win, y, x, c) \ + (wmove(win, y, x) == ERR ? ERR : winswch(win, c)) +#define mvwinswstr(win, y, x, ws) \ + (wmove(win, y, x) == ERR ? ERR : winswstr(win, ws)) +#define mvwinwch(win, y, x) \ + (wmove(win, y, x) == ERR ?(chtype) ERR : winwch(win)) +#define mvwinwchnstr(win, y, x, str, n) \ + (wmove(win, y, x) == ERR ? ERR : winwchnstr(win, str, n)) +#define mvwinwchstr(win, y, x, str) \ + (wmove(win, y, x) == ERR ? ERR : winwchstr(win, str)) +#define mvwinwstr(win, y, x, ws) \ + (wmove(win, y, x) == ERR ? ERR : winwstr(win, ws)) + +#define waddwchstr(win, str) waddwchnstr(win, str, -1) +#define winwchstr(win, str) winwchnstr(win, str, -1) +#define waddwstr(win, ws) waddnwstr(win, ws, -1) +#define winswstr(win, ws) winsnwstr(win, ws, -1) + +#ifdef CURS_MACROS +#define overlay(src, dst) _overlap((src), (dst), TRUE) +#define overwrite(src, dst) _overlap((src), (dst), FALSE) +#define wdeleteln(win) winsdelln((win), -1) +#define winsertln(win) winsdelln((win), 1) +#define wstandend(win) wattrset((win), A_NORMAL) +#define wstandout(win) wattron((win), A_STANDOUT) +#define beep() _ring(TRUE) +#define flash() _ring(FALSE) +#define scroll(win) wscrl((win), 1) +#define slk_init(f) slk_start(((f == 0) ? 3 : 2), NULL) +#define scr_init(file) _scr_all(file, 0) +#define scr_restore(file) _scr_all(file, 1) +#define scr_set(file) _scr_all(file, 2) +#define subpad(win, nl, nc, by, bx) derwin((win), (nl), (nc), (by), (bx)) +#define box(win, v, h) wborder((win), (v), (v), (h), (h), 0, 0, 0, 0) +#define newterm(type, fout, fin) newscreen((type), 0, 0, 0, (fout), (fin)) +#define touchline(win, y, n) wtouchln((win), (y), (n), TRUE) + +#define waddstr(win, str) waddnstr((win), (str), -1) +#define werase(win) (wmove((win), 0, 0), wclrtobot(win)) +#define wclear(win) (clearok((win), TRUE), werase(win)) +#define intrflush(win, flag) _setqiflush(flag) +#define meta(win, flag) _meta(flag) + +#define setterm(name) setupterm((name), 1, (char *)NULL) +#define gettmode() (OK) +#define halfdelay(tens) ttimeout((tens)*100) + +#define echo() _setecho(TRUE) +#define noecho() _setecho(FALSE) +#define nl() _setnonl(FALSE) +#define nonl() _setnonl(TRUE) + +#else /* CURS_MACROS */ + +#ifdef __STDC__ + +extern int overlay(WINDOW *, WINDOW *); +extern int overwrite(WINDOW *, WINDOW *); +extern int wdeleteln(WINDOW *); +extern int winsertln(WINDOW *); +extern int wstandend(WINDOW *); +extern int wstandout(WINDOW *); +extern int beep(void); +extern int flash(void); +extern int scroll(WINDOW *); +extern int slk_init(int); +extern int scr_init(char *); +extern int scr_restore(char *); +extern int box(WINDOW *, chtype, chtype); +extern int touchline(WINDOW *, int, int); +extern int waddstr(WINDOW *, char *); +extern int werase(WINDOW *); +extern int wclear(WINDOW *); +extern int intrflush(WINDOW *, int); +extern int meta(WINDOW *, int); +extern int setterm(char *); +extern int gettmode(void); +extern int halfdelay(int); +extern int echo(void); +extern int noecho(void); +extern int nl(void); +extern int nonl(void); + +extern WINDOW *subpad(WINDOW *, int, int, int, int); + +extern SCREEN *newterm(char *, FILE *, FILE *); + +#else /* __STDC__ */ + +extern int overlay(), overwrite(), wdeleteln(), winsertln(), + wstandend(), wstandout(), beep(), flash(), + scroll(), slk_init(), scr_init(), scr_restore(), + box(), touchline(), waddstr(), werase(), + wclear(), intrflush(), meta(), setterm(), gettmode(), + halfdelay(), echo(), noecho(), nl(), nonl(); + +extern WINDOW *subpad(); + +extern SCREEN *newterm(); + +#endif /* __STDC__ */ +#endif /* CURS_MACROS */ + +#define garbagedlines wredrawln +#define garbagedwin redrawwin + +#define crmode cbreak +#define nocrmode nocbreak +#define saveterm def_prog_mode +#define fixterm reset_prog_mode +#define resetterm reset_shell_mode + +#define waddchstr(win, str) waddchnstr((win), (str), -1) +#define winsstr(win, str) winsnstr((win), (str), -1) + +/* iocontrol functions */ +#define qiflush() _setqiflush(TRUE) +#define noqiflush() _setqiflush(FALSE) + +#define set_term setcurscreen + +#endif /* NOMACROS || __lint */ + +/* + * Standard alternate character set. The current ACS world is evolving, + * so we support only a widely available subset: the line drawing characters + * from the VT100, plus a few from the Teletype 5410v1. Eventually there + * may be support of more sophisticated ACS line drawing, such as that + * in the Teletype 5410, the HP line drawing set, and the like. There may + * be support for some non line oriented characters as well. + * + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ + +#define ACS_BSSB (acs_map['l']) +#define ACS_SSBB (acs_map['m']) +#define ACS_BBSS (acs_map['k']) +#define ACS_SBBS (acs_map['j']) +#define ACS_SBSS (acs_map['u']) +#define ACS_SSSB (acs_map['t']) +#define ACS_SSBS (acs_map['v']) +#define ACS_BSSS (acs_map['w']) +#define ACS_BSBS (acs_map['q']) +#define ACS_SBSB (acs_map['x']) +#define ACS_SSSS (acs_map['n']) + +/* + * Human readable names for the most commonly used characters. + * "Upper", "right", etc. are chosen to be consistent with the vt100 manual. + */ + +#define ACS_ULCORNER ACS_BSSB +#define ACS_LLCORNER ACS_SSBB +#define ACS_URCORNER ACS_BBSS +#define ACS_LRCORNER ACS_SBBS +#define ACS_RTEE ACS_SBSS +#define ACS_LTEE ACS_SSSB +#define ACS_BTEE ACS_SSBS +#define ACS_TTEE ACS_BSSS +#define ACS_HLINE ACS_BSBS +#define ACS_VLINE ACS_SBSB +#define ACS_PLUS ACS_SSSS +#define ACS_S1 (acs_map['o']) /* scan line 1 */ +#define ACS_S9 (acs_map['s']) /* scan line 9 */ +#define ACS_DIAMOND (acs_map['`']) /* diamond */ +#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */ +#define ACS_DEGREE (acs_map['f']) /* degree symbol */ +#define ACS_PLMINUS (acs_map['g']) /* plus/minus */ +#define ACS_BULLET (acs_map['~']) /* bullet */ + /* Teletype 5410v1 symbols */ +#define ACS_LARROW (acs_map[',']) /* arrow pointing left */ +#define ACS_RARROW (acs_map['+']) /* arrow pointing right */ +#define ACS_DARROW (acs_map['.']) /* arrow pointing down */ +#define ACS_UARROW (acs_map['-']) /* arrow pointing up */ +#define ACS_BOARD (acs_map['h']) /* board of squares */ +#define ACS_LANTERN (acs_map['i']) /* lantern symbol */ +#define ACS_BLOCK (acs_map['0']) /* solid square block */ + +. +$a + +/* + * The definition for 'reg' is not standard, and is provided for + * compatibility reasons. User's are discouraged from using this. + */ +#define reg register + +/* Various video attributes */ +#define A_STANDOUT 000010000000 +#define _STANDOUT A_STANDOUT /* for compatability with old curses */ +#define A_UNDERLINE 000020000000 +#define A_REVERSE 000040000000 +#define A_BLINK 000100000000 +#define A_DIM 000200000000 +#define A_BOLD 000400000000 +#define A_ALTCHARSET 001000000000 + +/* The next two are subject to change so don't depend on them */ +#define A_INVIS 010000000000 +#define A_PROTECT 020000000000U + +#define A_NORMAL 000000000000 +#define A_ATTRIBUTES 031777700000U /* 0xCFFF8000 */ +#define A_CHARTEXT 006000077777 /* 0x30007FFF */ +#define A_COLOR 000007700000 + +#define A_WATTRIBUTES 031770000000U /* 0xCFE00000 */ +#define A_WCHARTEXT 006007777777 /* 0x301FFFFF */ + +#define COLOR_PAIR(n) ((n) << 15) +#define PAIR_NUMBER(n) (((n) & A_COLOR) >> 15) + +/* definition of 8 basic color */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* mouse related macros: don't change these definitions or bit-masks. */ +/* they are interdependent (used by _map_button() in tgetch() */ +#define BUTTON_RELEASED 0 +#define BUTTON_PRESSED 1 +#define BUTTON_CLICKED 2 +#define BUTTON_DOUBLE_CLICKED 3 +#define BUTTON_TRIPLE_CLICKED 4 + +#define MOUSE_X_POS (Mouse_status.x) +#define MOUSE_Y_POS (Mouse_status.y) +#define A_BUTTON_CHANGED (Mouse_status.changes & 7) +#define MOUSE_MOVED (Mouse_status.changes & 8) +#define MOUSE_POS_REPORT (Mouse_status.changes & 16) +#define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1))) +#define BUTTON_STATUS(x) (Mouse_status.button[(x)-1]) + +/* definition of mouse bit-masks */ +#define BUTTON1_RELEASED 000000000001 +#define BUTTON1_PRESSED 000000000002 +#define BUTTON1_CLICKED 000000000004 +#define BUTTON1_DOUBLE_CLICKED 000000000010 +#define BUTTON1_TRIPLE_CLICKED 000000000020 +#define BUTTON2_RELEASED 000000000040 +#define BUTTON2_PRESSED 000000000100 +#define BUTTON2_CLICKED 000000000200 +#define BUTTON2_DOUBLE_CLICKED 000000000400 +#define BUTTON2_TRIPLE_CLICKED 000000001000 +#define BUTTON3_RELEASED 000000002000 +#define BUTTON3_PRESSED 000000004000 +#define BUTTON3_CLICKED 000000010000 +#define BUTTON3_DOUBLE_CLICKED 000000020000 +#define BUTTON3_TRIPLE_CLICKED 000000040000 +#define ALL_MOUSE_EVENTS 000000077777 +#define REPORT_MOUSE_POSITION 000000100000 + +#ifdef __cplusplus +} +#endif + +#endif /* _CURSES_H */ +. +0r copyright.h +/copyright\.h/d +. +1,$s/\@(\#)curses\.ed/\@(\#)curses\.h/ +w curses.h diff --git a/usr/src/lib/libcurses/screen/curses_inc.h b/usr/src/lib/libcurses/screen/curses_inc.h new file mode 100644 index 0000000000..f85438e775 --- /dev/null +++ b/usr/src/lib/libcurses/screen/curses_inc.h @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _CURSES_INC_H +#define _CURSES_INC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Internal header file for the library + * + */ + +/* LINTLIBRARY */ + +#define CURSES /* We are internal to curses */ + +#include "curses.h" +#include "term.h" +#include "curshdr.h" +#include "unctrl.h" +#include "curses_wchar.h" + +#endif /* _CURSES_INC_H */ diff --git a/usr/src/lib/libcurses/screen/curses_wchar.h b/usr/src/lib/libcurses/screen/curses_wchar.h new file mode 100644 index 0000000000..f54411750c --- /dev/null +++ b/usr/src/lib/libcurses/screen/curses_wchar.h @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#ifndef _CURSES_WCHAR_H +#define _CURSES_WCHAR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define P00 WCHAR_CS0 /* Code Set 0 */ +#define P11 WCHAR_CS1 /* Code Set 1 */ +#define P01 WCHAR_CS2 /* Code Set 2 */ +#define P10 WCHAR_CS3 /* Code Set 3 */ + +#ifdef __STDC__ +#define _ctype __ctype +#endif +extern unsigned char _ctype[]; + +#define _mbyte _ctype[520] + +#ifdef __cplusplus +} +#endif + +#endif /* _CURSES_WCHAR_H */ diff --git a/usr/src/lib/libcurses/screen/curshdr.h b/usr/src/lib/libcurses/screen/curshdr.h new file mode 100644 index 0000000000..712014acc0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/curshdr.h @@ -0,0 +1,327 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _CURSHDR_H +#define _CURSHDR_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define _NOHASH (-1) /* if the hash value is unknown */ +#define _REDRAW (-2) /* if line need redrawn */ +#define _BLANK (-3) /* if line is blank */ +#define _THASH (123) /* base hash if clash with other hashes */ +#define _KEY (01) +#define _MACRO (02) + +#define _INPUTPENDING cur_term->_iwait +#define _PUTS(x, y) (void) tputs(x, y, _outch) +#define _VIDS(na, oa) (vidupdate((na), (oa), _outch), curscr->_attrs = (na)) +#define _ONINSERT() (_PUTS(enter_insert_mode, 1), SP->phys_irm = TRUE) +#define _OFFINSERT() (_PUTS(exit_insert_mode, 1), SP->phys_irm = FALSE) +#define _STRNOTEQ(a, b) (a == NULL ? (b != NULL) : \ + (b == NULL ? 1 : strcmp(a, b))) + +/* + * IC and IL overheads and costs should be set to this + * value if the corresponding feature is missing + */ + +#define LARGECOST 500 + +typedef struct +{ + short icfixed; /* Insert char fixed overhead */ + short dcfixed; /* Delete char fixed overhead */ + short Insert_character; + short Delete_character; + short Cursor_home; + short Cursor_to_ll; + short Cursor_left; + short Cursor_right; + short Cursor_down; + short Cursor_up; + short Carriage_return; + short Tab; + short Back_tab; + short Clr_eol; + short Clr_bol; + short Parm_ich; + short Parm_dch; + short Parm_left_cursor; + short Parm_up_cursor; + short Parm_down_cursor; + short Parm_right_cursor; + short Cursor_address; + short Row_address; +} COSTS; + +#define _COST(field) (SP->term_costs.field) + +/* Soft label keys */ + +#define LABMAX 16 /* max number of labels allowed */ +#define LABLEN 8 /* max length of each label */ + +typedef struct +{ + WINDOW *_win; /* the window to display labels */ + char _ldis[LABMAX][LABLEN+1]; /* labels suitable to display */ + char _lval[LABMAX][LABLEN+1]; /* labels' true values */ + short _labx[LABMAX]; /* where to display labels */ + short _num; /* actual number of labels */ + short _len; /* real length of labels */ + bool _changed; /* TRUE if some labels changed */ + bool _lch[LABMAX]; /* change status */ +} SLK_MAP; + +struct screen +{ + unsigned fl_echoit : 1; /* in software echo mode */ + unsigned fl_endwin : 2; /* has called endwin */ + unsigned fl_meta : 1; /* in meta mode */ + unsigned fl_nonl : 1; /* do not xlate input \r-> \n */ + unsigned yesidln : 1; /* has idln capabilities */ + unsigned dmode : 1; /* Terminal has delete mode */ + unsigned imode : 1; /* Terminal has insert mode */ + unsigned ichok : 1; /* Terminal can insert characters */ + unsigned dchok : 1; /* Terminal can delete characters */ + unsigned sid_equal : 1; /* enter insert and delete mode equal */ + unsigned eid_equal : 1; /* exit insert and delete mode equal */ + unsigned phys_irm : 1; /* in insert mode or not */ + long baud; /* baud rate of this tty */ + short kp_state; /* 1 iff keypad is on, else 0 */ + short Yabove; /* How many lines are above stdscr */ + short lsize; /* How many lines decided by newscreen */ + short csize; /* How many columns decided by newscreen */ + short tsize; /* How big is a tab decided by newscreen */ + WINDOW *std_scr; /* primary output screen */ + WINDOW *cur_scr; /* what's physically on the screen */ + WINDOW *virt_scr; /* what's virtually on the screen */ + int *cur_hash; /* hash table of curscr */ + int *virt_hash; /* hash table of virtscr */ + TERMINAL *tcap; /* TERMINFO info */ + FILE *term_file; /* File to write on for output. */ + FILE *input_file; /* Where to get keyboard input */ + SLK_MAP *slk; /* Soft label information */ + char **_mks; /* marks, only used with xhp terminals */ + COSTS term_costs; /* costs of various capabilities */ + SGTTY save_tty_buf; /* saved termio state of this tty */ +#ifdef SYSV + SGTTYS save_tty_bufs; /* saved termios state of this tty */ +#endif + char **_color_mks; /* marks, only used with color xhp terminals */ + unsigned long _trap_mbe; /* trap these mouse button events */ + unsigned long _map_mbe_to_key; /* map selected buttons on top of */ + /* slk's to function keys */ +}; + +extern SCREEN *SP; +extern WINDOW *_virtscr; + +#ifdef DEBUG +#ifndef outf +extern FILE *outf; +#endif /* outf */ +#endif /* DEBUG */ + +extern short cswidth[], /* byte size of multi-byte chars */ + _curs_scrwidth[]; /* display size */ +extern short _csmax, + _scrmax; +extern bool _mbtrue; + +#define MBIT 0200 /* indicator for a multi-byte char */ +#define CBIT 002000000000 /* indicator for a continuing col */ +#define RBYTE(x) ((x) & 0377) +#define LBYTE(x) (((x) >> 8) & 0177) +#define ISMBIT(x) ((x) & MBIT) +#define SETMBIT(x) ((x) |= MBIT) +#define CLRMBIT(x) ((x) &= ~MBIT) +#define ISCBIT(x) ((x) & CBIT) +#define SETCBIT(x) ((x) |= CBIT) +#define CLRCBIT(x) ((x) &= ~CBIT) +#define TYPE(x) ((x) == SS2 ? 1 : (x) == SS3 ? 2 : ISMBIT(x) ? 0 : 3) +#define TRIM 037777777777 /* 0xFFFFFFFF */ + +/* terminfo magic number */ +#define MAGNUM 0432 + +/* curses screen dump magic number */ +#define SVR2_DUMP_MAGIC_NUMBER 0433 +#define SVR3_DUMP_MAGIC_NUMBER 0434 + +/* Getting the baud rate is different on the two systems. */ + +#ifdef SYSV +#define _BR(x) (x.c_cflag & CBAUD) +#define _BRS(x) (cfgetospeed(&x)) +#include <values.h> +#else /* SYSV */ +#define BITSPERBYTE 8 +#define MAXINT 32767 +#define _BR(x) (x.sg_ispeed) +#endif /* SYSV */ + +#define _BLNKCHAR ' ' +#define _CTRL(c) (c | 0100) +#define _ATTR(c) ((c) & A_ATTRIBUTES) +#define _CHAR(c) ((c) & A_CHARTEXT) + +/* + * combine CHAR par of the character with the attributes of the window. + * Two points: 1) If character is blank, usebackground instead + * 2) If character contains color, delete color from + * window attribute. + */ + +#define _WCHAR(w, c) (_CHAR((c) == _BLNKCHAR ? (w)->_bkgd : (c))| \ + (((c) & A_COLOR) ? ((w)->_attrs & ~A_COLOR) : \ + ((w)->_attrs))) + +#define _DARKCHAR(c) ((c) != _BLNKCHAR) +#define _UNCTRL(c) ((c) ^ 0100) + +/* blank lines info of curscr */ +#define _BEGNS curscr->_firstch +#define _ENDNS curscr->_lastch + +/* hash tables */ +#define _CURHASH SP->cur_hash +#define _VIRTHASH SP->virt_hash + +/* top/bot line changed */ +#define _VIRTTOP _virtscr->_parx +#define _VIRTBOT _virtscr->_pary + +/* video marks */ +#define _MARKS SP->_mks +#define _COLOR_MARKS SP->_color_mks + +#define _NUMELEMENTS(x) (sizeof (x)/sizeof (x[0])) + +#ifdef _VR3_COMPAT_CODE +/* + * #define _TO_OCHTYPE(x) ((_ochtype)(((x&A_ATTRIBUTES)>>9)| \ + * (x&0x0000007FUL))) + */ +#define _TO_OCHTYPE(x) ((_ochtype)(((x&A_ATTRIBUTES)>>9)|(x&0177))) +#define _FROM_OCHTYPE(x) ((chtype) ((x&0177) | ((x&0177600)<<9))) +extern void (*_y16update)(WINDOW *, int, int, int, int); +#endif /* _VR3_COMPAT_CODE */ + +/* functions for screen updates */ + +extern int (*_setidln)(void); +extern int (*_useidln)(void); +extern int (*_quick_ptr)(WINDOW *, chtype); +extern int (_quick_echo)(WINDOW *, chtype); + +/* min/max functions */ + +#define _MIN(a, b) ((a) < (b) ? (a) : (b)) +#define _MAX(a, b) ((a) > (b) ? (a) : (b)) + +extern int (*_do_slk_ref)(void); +extern int (*_do_slk_tch)(void); +extern int (*_do_slk_noref)(void); +extern int _image(WINDOW *); +extern int _outch(char); +extern int _outwch(chtype); +extern int _chkinput(void); +extern int _curs_mbtowc(wchar_t *, const char *, size_t); +extern int _curs_wctomb(char *, wchar_t); +extern int _delay(int, int (*)(char)); +extern int _mbaddch(WINDOW *, chtype, chtype); +extern int _mbclrch(WINDOW *, int, int); +extern int _mbinsshift(WINDOW *, int), _mbvalid(WINDOW *); +extern int _padjust(WINDOW *, int, int, int, int, int, int); +extern int _prefresh(int (*)(WINDOW *), WINDOW *, int, int, int, + int, int, int); +extern int _overlap(WINDOW *, WINDOW *, int); +extern int _scr_all(char *, int); +extern int _slk_update(void); +extern int _tcsearch(char *, short [], char *[], int, int); +extern int _vsscanf(char *, char *, __va_list); +extern int force_doupdate(void); +extern int init_acs(void); +extern int mbscrw(int); +extern int mbeucw(int); +extern int scr_ll_dump(FILE *); +extern int scr_reset(FILE *, int); +extern int setkeymap(void); +extern int ttimeout(int); +extern int wadjcurspos(WINDOW *); +extern int wcscrw(wchar_t); +extern int wmbmove(WINDOW *, int, int); + +extern chtype tgetch(int); + +extern WINDOW *_makenew(int, int, int, int); + +extern void (*_slk_init)(void); +extern void (*_rip_init)(void); +extern void delkeymap(TERMINAL *); +extern void mbgetwidth(void); +extern void memSset(chtype *, chtype, int); +extern void _blast_keys(TERMINAL *); +extern void _init_costs(void); +extern void _init_HP_pair(short, short, short); +extern void _update_old_y_area(WINDOW *, int, int, int, int); + +extern char *tparm_p0(char *); +extern char *tparm_p1(char *, long); +extern char *tparm_p2(char *, long, long); +extern char *tparm_p3(char *, long, long, long); +extern char *tparm_p4(char *, long, long, long, long); +extern char *tparm_p7(char *, long, long, long, long, long, long, long); + + +extern char *infotocap(char *, int *); +extern char *_strcode2byte(wchar_t *, char *, int); +extern char *wmbinch(WINDOW *, int, int); + +#ifdef __cplusplus +} +#endif + +#endif /* _CURSHDR_H */ diff --git a/usr/src/lib/libcurses/screen/def_prog.c b/usr/src/lib/libcurses/screen/def_prog.c new file mode 100644 index 0000000000..a1c3fe105b --- /dev/null +++ b/usr/src/lib/libcurses/screen/def_prog.c @@ -0,0 +1,69 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <unistd.h> +#include "curses_inc.h" + +int +def_prog_mode(void) +{ + /* ioctl errors are ignored so pipes work */ +#ifdef SYSV + if ((prog_istermios = ioctl(cur_term -> Filedes, + TCGETS, &(PROGTTYS))) < 0) { + int i; + + (void) ioctl(cur_term -> Filedes, TCGETA, &(PROGTTY)); + PROGTTYS.c_lflag = PROGTTY.c_lflag; + PROGTTYS.c_oflag = PROGTTY.c_oflag; + PROGTTYS.c_iflag = PROGTTY.c_iflag; + PROGTTYS.c_cflag = PROGTTY.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTYS.c_cc[i] = PROGTTY.c_cc[i]; + } +#else + (void) ioctl(cur_term -> Filedes, TIOCGETP, &(PROGTTY)); +#endif + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/delay.c b/usr/src/lib/libcurses/screen/delay.c new file mode 100644 index 0000000000..2c6f50e662 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delay.c @@ -0,0 +1,102 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * The following array gives the number of tens of milliseconds per + * character for each speed as returned by gtty. Thus since 300 + * baud returns a 7, there are 33.3 milliseconds per char at 300 baud. + */ +static short tmspc10[] = + { + /* 0 50 75 110 134.5 150 200 300 baud */ + 0, 2000, 1333, 909, 743, 666, 500, 333, + /* 600 1200 1800 2400 4800 9600 19200 38400 baud */ + 166, 83, 55, 41, 20, 10, 5, 2, + /* 57600, 76800, 115200, 153600, 230400 307200 baud */ + 2, 1, 1, 1, 1, 1, + /* 460800 baud */ + 1 + }; + +/* + * Insert a delay into the output stream for "delay/10" milliseconds. + * Round up by a half a character frame, and then do the delay. + * Too bad there are no user program accessible programmed delays. + * Transmitting pad characters slows many terminals down and also + * loads the system. + */ + +int +_delay(int delay, int (*outc)(char)) +{ + int mspc10; + char pc; + int outspeed; + + /* if there is no pad character, then just return */ + if (no_pad_char) + goto good; + +#ifdef SYSV + outspeed = _BRS(PROGTTYS); +#else /* SYSV */ + outspeed = _BR(PROGTTY); +#endif /* SYSV */ + if (outspeed <= 0 || outspeed >= + (sizeof (tmspc10) / sizeof (tmspc10[0]))) + return (ERR); + + mspc10 = tmspc10[outspeed]; + delay += mspc10 / 2; + if (pad_char) + pc = *pad_char; + else + pc = 0; + for (delay /= mspc10; delay-- > 0; ) + (*outc)(pc); +good: + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/delay_out.c b/usr/src/lib/libcurses/screen/delay_out.c new file mode 100644 index 0000000000..cdcb780992 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delay_out.c @@ -0,0 +1,73 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Code for various kinds of delays. Most of this is nonportable and + * requires various enhancements to the operating system, so it won't + * work on all systems. It is included in curses to provide a portable + * interface, and so curses itself can use it for function keys. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Delay the output for ms milliseconds. + * Note that this is NOT the same as a high resolution sleep. It will + * cause a delay in the output but will not necessarily suspend the + * processor. For applications needing to sleep for 1/10th second, + * this is not a usable substitute. It causes a pause in the displayed + * output, for example, for the eye wink in snake. It is disrecommended + * for "delay" to be much more than 1/2 second, especially at high + * baud rates, because of all the characters it will output. Note + * that due to system delays, the actual pause could be even more. + * You can't get a decent pac-man game with this routine. + */ + +int +delay_output(int ms) +{ + extern int _outchar(char); + + return (_delay(ms * 10, _outchar)); +} diff --git a/usr/src/lib/libcurses/screen/delkey.c b/usr/src/lib/libcurses/screen/delkey.c new file mode 100644 index 0000000000..547d5b0800 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delkey.c @@ -0,0 +1,112 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* Delete keys matching pat or key from the key map. */ + +int +delkey(char *sends, int keyval) +{ + _KEY_MAP *kp, **kpp = cur_term->_keys, **fpp, **dpp; + int mask = 0, cmp, numkeys = cur_term->_ksz; + int counter = 0, i, num_deleted_keys = 0; + short *lkorder = &(cur_term->_lastkey_ordered), + *first_macro = &(cur_term->_first_macro), + *lmorder = &(cur_term->_lastmacro_ordered); + + /* for ease of determination of key to delete */ + if (sends) + mask |= 01; + if (keyval >= 0) + mask |= 02; + + /* check each key */ + while (++counter < numkeys) { + kp = *kpp; + cmp = 0; + if (sends && (strcmp(sends, kp->_sends) == 0)) + cmp |= 01; + if (kp->_keyval == keyval) + cmp |= 02; + + /* found one to delete */ + if (cmp == mask) { + num_deleted_keys++; + /* + * If it was an externally created key, then the address + * of the sequence will be right after the structure. + * See the malloc in newkey. + */ + if (kp->_sends == ((char *)kp + sizeof (_KEY_MAP))) + free(kp); + + /* shift left other keys */ + i = (numkeys - counter) - 1; + for (fpp = kpp, dpp = kpp + 1; i > 0; i--, fpp++, dpp++) + *fpp = *dpp; + if (counter <= *lmorder) { + if (counter < *first_macro) { + if (counter <= *lkorder) + (*lkorder)--; + (*first_macro)--; + } + (*lmorder)--; + } + } else + kpp++; + } + +/* Check if we've crossed boundary and/or hit 0 */ + + if ((cur_term->_ksz -= num_deleted_keys) == 0) + (void) delkeymap(cur_term); + else + cur_term->_keys = (_KEY_MAP **) realloc((char *) + cur_term->_keys, (unsigned)cur_term->_ksz); + + return (num_deleted_keys); +} diff --git a/usr/src/lib/libcurses/screen/delkeymap.c b/usr/src/lib/libcurses/screen/delkeymap.c new file mode 100644 index 0000000000..36e87fbda0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delkeymap.c @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */ + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +/* + * Delete a key table + */ + +void +delkeymap(TERMINAL *terminal) +{ + _KEY_MAP **kpp, *kp; + int numkeys = terminal->_ksz; + + /* free key slots */ + for (kpp = terminal->_keys; numkeys-- > 0; kpp++) { + kp = *kpp; + if (kp->_sends == ((char *) (kp + sizeof (_KEY_MAP)))) + free(kp); + } + + if (terminal->_keys != NULL) { + free(terminal->_keys); + if (terminal->internal_keys != NULL) + free(terminal->internal_keys); + } + _blast_keys(terminal); +} diff --git a/usr/src/lib/libcurses/screen/delscreen.c b/usr/src/lib/libcurses/screen/delscreen.c new file mode 100644 index 0000000000..8b241edf3a --- /dev/null +++ b/usr/src/lib/libcurses/screen/delscreen.c @@ -0,0 +1,81 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +void +delscreen(SCREEN *screen) +{ +#ifdef DEBUG + if (outf) + fprintf(outf, "delscreen: screen %x\n", screen); +#endif /* DEBUG */ + /* + * All these variables are tested first because we may be called + * by newscreen which hasn't yet allocated them. + */ + if (screen->tcap) + (void) delterm(screen->tcap); + if (screen->cur_scr) + (void) delwin(screen->cur_scr); + if (screen->std_scr) + (void) delwin(screen->std_scr); + if (screen->virt_scr) + (void) delwin(screen->virt_scr); + if (screen->slk) { + if (screen->slk->_win) + (void) delwin(screen->slk->_win); + free(screen->slk); + } + if (screen->_mks) { + if (*screen->_mks) + free(*screen->_mks); + free((char *)screen->_mks); + } + if (screen->cur_hash) + free((char *)screen->cur_hash); + free((char *)screen); +} diff --git a/usr/src/lib/libcurses/screen/delterm.c b/usr/src/lib/libcurses/screen/delterm.c new file mode 100644 index 0000000000..ed18699330 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delterm.c @@ -0,0 +1,81 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Relinquish the storage associated with "terminal". + */ +extern TERMINAL _first_term; +extern char _called_before; +extern char _frst_tblstr[]; + +int +delterm(TERMINAL *terminal) +{ + if (!terminal) + return (ERR); + (void) delkeymap(terminal); + if (terminal->_check_fd >= 0) + (void) close(terminal->_check_fd); + if (terminal == &_first_term) { + /* next setupterm can re-use static areas */ + _called_before = FALSE; + if (terminal->_strtab != _frst_tblstr) + free((char *)terminal->_strtab); + } else { + free((char *)terminal->_bools); + free((char *)terminal->_nums); + free((char *)terminal->_strs); + free((char *)terminal->_strtab); + free((char *)terminal); + } + if (terminal->_pairs_tbl) + free((char *) terminal->_pairs_tbl); + if (terminal->_color_tbl) + free((char *) terminal->_color_tbl); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/delwin.c b/usr/src/lib/libcurses/screen/delwin.c new file mode 100644 index 0000000000..651f646923 --- /dev/null +++ b/usr/src/lib/libcurses/screen/delwin.c @@ -0,0 +1,99 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* This routine deletes a _window and releases it back to the system. */ + +int +delwin(WINDOW *win) +{ + int i; + WINDOW *par; + + /* If we have children don't delte the window. */ + if (win->_ndescs > 0) + return (ERR); + + /* + * If window is a pad, delete the padwin associated with it. + * NOTE: We shouldn't care that the recursive call will decrement + * ndescs for this window, since the window will be deleted anyhow. + */ + + if (win->_padwin) { + win->_padwin->_maxy = win->_maxy; + (void) delwin(win->_padwin); + } + if (win->_parent == NULL) { + /* Delete all the memory associated with this window. */ + for (i = win->_maxy; i-- > 0; ) { + free((char *)win->_y[i]); +#ifdef _VR3_COMPAT_CODE + if (_y16update) + free((char *)win->_y16[i]); +#endif /* _VR3_COMPAT_CODE */ + } + } else { + /* + * We are a subwin and we don't want to delete the memory since + * it's shared by other windows. We do want to decrement the + * descendant count so that if there are no children left to a + * particular window winsdelln.c will run in fast mode (look there). + */ + for (par = win->_parent; par != NULL; par = par->_parent) + par->_ndescs--; + } + +#ifdef _VR3_COMPAT_CODE + if (_y16update) + free((char *)win->_y16); +#endif /* _VR3_COMPAT_CODE */ + + free((char *)win->_y); + free((char *)win->_firstch); + free((char *)win); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/derwin.c b/usr/src/lib/libcurses/screen/derwin.c new file mode 100644 index 0000000000..dc4e9c093e --- /dev/null +++ b/usr/src/lib/libcurses/screen/derwin.c @@ -0,0 +1,114 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Make a derived window of an existing window. The two windows + * share the same character image. + * orig: the original window + * nl, nc: numbers of lines and columns + * by, bx: coordinates for upper-left corner of the derived + * window in the coord system of the parent window. + */ + +WINDOW * +derwin(WINDOW *orig, int num_lines, int nc, int by, int bx) +{ + int y; + WINDOW *win = (WINDOW *) NULL, *par; + chtype **w_y, **o_y; +#ifdef _VR3_COMPAT_CODE + _ochtype **w_y16, **o_y16; +#endif /* _VR3_COMPAT_CODE */ + + /* make sure window fits inside the original one */ + if (by < 0 || (by + num_lines) > orig->_maxy || bx < 0 || + (bx + nc) > orig->_maxx) + goto done; + if (nc == 0) + nc = orig->_maxx - bx; + if (num_lines == 0) + num_lines = orig->_maxy - by; + + /* Create the window skeleton */ + if ((win = _makenew(num_lines, nc, by + orig->_begy, + bx + orig->_begx)) == NULL) + goto done; + + /* inheritance */ + /*LINTED*/ + win->_parx = (short) bx; + /*LINTED*/ + win->_pary = (short) by; + win->_bkgd = orig->_bkgd; + win->_attrs = orig->_attrs; + w_y = win->_y; + o_y = orig->_y; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + int hby = by; + + w_y16 = win ->_y16; + o_y16 = orig->_y16; + + for (y = 0; y < num_lines; y++, hby++) + w_y16[y] = o_y16[hby] + bx; + } +#endif /* _VR3_COMPAT_CODE */ + + for (y = 0; y < num_lines; y++, by++) + w_y[y] = o_y[by] + bx; + + win->_yoffset = orig->_yoffset; + + /* update descendant number of ancestors */ + win->_parent = orig; + for (par = win->_parent; par != NULL; par = par->_parent) + par->_ndescs += 1; + +done: + return (win); +} diff --git a/usr/src/lib/libcurses/screen/doupdate.c b/usr/src/lib/libcurses/screen/doupdate.c new file mode 100644 index 0000000000..8488e996e8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/doupdate.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Doupdate is a real function because _virtscr + * is not accessible to application programs. + */ + +int +doupdate(void) +{ + return (wrefresh(_virtscr)); +} diff --git a/usr/src/lib/libcurses/screen/draino.c b/usr/src/lib/libcurses/screen/draino.c new file mode 100644 index 0000000000..6f27c8e33d --- /dev/null +++ b/usr/src/lib/libcurses/screen/draino.c @@ -0,0 +1,130 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <unistd.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Code for various kinds of delays. Most of this is nonportable and + * requires various enhancements to the operating system, so it won't + * work on all systems. It is included in curses to provide a portable + * interface, and so curses itself can use it for function keys. + */ + +#define NAPINTERVAL 100 +/* + * Wait until the output has drained enough that it will only take + * ms more milliseconds to drain completely. + * Needs Berkeley TIOCOUTQ ioctl. Returns ERR if impossible. + */ + +int +draino(int ms) +{ +#ifdef TIOCOUTQ +#define _DRAINO + /* number of chars = that many ms */ + long ncneeded; + + /* 10 bits/char, 1000 ms/sec, baudrate in bits/sec */ + ncneeded = SP->baud * ms / (10 * 1000); + /*CONSTCOND*/ + while (TRUE) { + int rv; /* ioctl return value */ + int ncthere = 0; /* number of chars actually in */ + /* output queue */ + + rv = ioctl(cur_term->Filedes, TIOCOUTQ, &ncthere); +#ifdef DEBUG + if (outf) + fprintf(outf, "draino: rv %d, ncneeded %d, " + "ncthere %d\n", rv, ncneeded, ncthere); +#endif /* DEBUG */ + if (rv < 0) + return (ERR); /* ioctl didn't work */ + if (ncthere <= ncneeded) + return (OK); + (void) napms(NAPINTERVAL); + } +#else /* TIOCOUTQ */ + +#ifdef TCSETAW +#define _DRAINO + /* + * SYSV simulation - waits until the entire queue is empty, + * then sets the state to what it already is (e.g. no-op). + * Unfortunately this only works if ms is zero. + */ + if (ms <= 0) { +#ifdef SYSV + if (prog_istermios < 0) { + int i; + + PROGTTY.c_lflag = PROGTTYS.c_lflag; + PROGTTY.c_oflag = PROGTTYS.c_oflag; + PROGTTY.c_iflag = PROGTTYS.c_iflag; + PROGTTY.c_cflag = PROGTTYS.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTY.c_cc[i] = PROGTTYS.c_cc[i]; + (void) ioctl(cur_term->Filedes, TCSETAW, &PROGTTY); + } else + (void) ioctl(cur_term->Filedes, TCSETSW, &PROGTTYS); +#else /* SYSV */ + (void) ioctl(cur_term->Filedes, TCSETAW, &PROGTTY); +#endif /* SYSV */ + return (OK); + } else + return (ERR); +#endif /* TCSETAW */ +#endif /* TIOCOUTQ */ + +#ifndef _DRAINO + /* + * No way to fake it, so we return failure. + * Used #else to avoid warning from compiler about unreached stmt + */ + return (ERR); +#endif /* _DRAINO */ +/*NOTREACHED*/ +} diff --git a/usr/src/lib/libcurses/screen/dupwin.c b/usr/src/lib/libcurses/screen/dupwin.c new file mode 100644 index 0000000000..9c4463492c --- /dev/null +++ b/usr/src/lib/libcurses/screen/dupwin.c @@ -0,0 +1,159 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Duplicate a window. + * + * SS: calling makenew to allocate a new window is wastefull, since + * makenew initializes all the variables, and then we re-initialize + * the desired values to these variables. + */ + +WINDOW * +dupwin(WINDOW *win) +{ + WINDOW *new; + int i, ncolumns = win->_maxx, nlines = win->_maxy; + size_t line_size = nlines * sizeof (short); + chtype **wincp, **newcp; + int ncolsav = ncolumns; + + /* allocate storage for new window and do block copy of */ + /* old one into new */ + + if ((new = (WINDOW *) malloc(sizeof (WINDOW))) == NULL) + goto out0; + + (void) memcpy(new, win, sizeof (WINDOW)); + + /* allocate storage for "malloced" fields of the new window */ + + if ((new->_firstch = (short *)malloc((unsigned)2 * line_size)) == NULL) + goto out1; + else + win->_lastch = win->_firstch + nlines; + + if ((new->_y = (chtype **) malloc(nlines * sizeof (chtype *))) == + NULL) { + /* + * We put the free's here rather than after the image call, this + * is because _image free's all the rest of the malloc'ed areas. + */ + free((char *)new->_firstch); +out1: + free((char *)new); + goto out0; + } + + if (_image(new) == ERR) { +out0: + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "dupwin"); + curserr(); +#endif /* DEBUG */ + return ((WINDOW *) NULL); + } + + /* copy information from "malloced" areas of the old window into new */ + + wincp = win->_y; + newcp = new->_y; + for (i = 0; i < nlines; ++i, ++wincp, ++newcp) { + chtype *ws, *we, *ns, *ne, wc; + int n; + + ws = *wincp; + we = ws + ncolsav - 1; + /* skip partial characters */ + for (; ws <= we; ++ws) + if (!ISCBIT(*ws)) + break; + for (; we >= ws; --we) + if (!ISCBIT(*we)) + break; + if (we >= ws) { + wc = *we; + n = _curs_scrwidth[TYPE(wc)]; + if ((we + n) <= (*wincp + ncolsav)) + we += n; + ns = *newcp + (ws - *wincp); + ne = *newcp + (we - *wincp); + (void) memcpy((char *)ns, (char *)ws, + (ne-ns)*sizeof (chtype)); + } else + ns = ne = *newcp + ncolsav; + /* fill the rest with background chars */ + wc = win->_bkgd; + for (ws = *newcp; ws < ns; ++ws) + *ws = wc; + for (ws = *newcp+ncolsav-1; ws >= ne; --ws) + *ws = wc; + } + + (void) memcpy((char *)new->_firstch, (char *)win->_firstch, + 2 * line_size); + + new->_flags |= _WINCHANGED; + new->_ndescs = 0; + /* + * Just like we don't create this window as a subwin if the one + * sent is, we don't create a padwin. Besides, if the user + * calls p*refresh a padwin will be created then. + */ + new->_padwin = new->_parent = (WINDOW *) NULL; + new->_pary = new->_parx = -1; + + new->_index = win->_index; + new->_nbyte = win->_nbyte; + new->_insmode = win->_insmode; + (void) memcpy((char *)new->_waitc, (char *)win->_waitc, + _csmax * sizeof (char)); + + return (new); +} diff --git a/usr/src/lib/libcurses/screen/endwin.c b/usr/src/lib/libcurses/screen/endwin.c new file mode 100644 index 0000000000..391c0e115c --- /dev/null +++ b/usr/src/lib/libcurses/screen/endwin.c @@ -0,0 +1,174 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* Clean things up before exiting. */ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR2_COMPAT_CODE +char _endwin = 0; +#endif /* _VR2_COMPAT_CODE */ + +int +isendwin(void) +{ + /* + * The test below must stay at TRUE because the value of 2 + * has special meaning to wrefresh but does not mean that + * endwin has been called. + */ + if (SP && (SP->fl_endwin == TRUE)) + return (TRUE); + else + return (FALSE); +} + +int +endwin(void) +{ + /* make sure we're in program mode */ + if (SP->fl_endwin) { + /* If endwin is equal to 2 it means we just did a newscreen. */ + if (SP->fl_endwin == TRUE) { + (void) reset_prog_mode(); + if (SP->kp_state) + (void) tputs(keypad_xmit, 1, _outch); + if (SP->fl_meta) + (void) tputs(meta_on, 1, _outch); + if (cur_term->_cursorstate != 1) + _PUTS(cur_term->cursor_seq + [cur_term->_cursorstate], 0); + } + _PUTS(enter_ca_mode, 1); + (void) tputs(ena_acs, 1, _outch); + if (exit_attribute_mode) + _PUTS(tparm_p0(exit_attribute_mode), 1); + else + /* + * If there is no exit_attribute mode, then vidupdate + * could only possibly turn off one of the below three + * so that's all we ask it turn off. + */ + vidupdate(A_NORMAL, + (A_ALTCHARSET | A_STANDOUT | A_UNDERLINE), _outch); + + SP->fl_endwin = FALSE; + +#ifdef _VR2_COMPAT_CODE + _endwin = (char) FALSE; +#endif /* _VR2_COMPAT_CODE */ + } + + /* See comment above why this test is explicitly against TRUE. */ + if (SP->fl_endwin == TRUE) + return (ERR); + + /* Flush out any output not output due to typeahead. */ + if (_INPUTPENDING) + (void) force_doupdate(); + + /* Close things down. */ + (void) ttimeout(-1); + if (SP->fl_meta) + (void) tputs(meta_off, 1, _outch); + (void) mvcur(curscr->_cury, curscr->_curx, curscr->_maxy - 1, 0); + + if (SP->kp_state) + (void) tputs(keypad_local, 1, _outch); + if (cur_term->_cursorstate != 1) + (void) tputs(cursor_normal, 0, _outch); + + /* don't bother turning off colors: it will be done later anyway */ + curscr->_attrs &= ~A_COLOR; /* SS: colors */ + + if ((curscr->_attrs != A_NORMAL) && + (magic_cookie_glitch < 0) && (!ceol_standout_glitch)) + _VIDS(A_NORMAL, curscr->_attrs); + + if (SP->phys_irm) + _OFFINSERT(); + + SP->fl_endwin = TRUE; + +#ifdef _VR2_COMPAT_CODE + _endwin = TRUE; +#endif /* _VR2_COMPAT_CODE */ + + curscr->_clear = TRUE; + (void) reset_shell_mode(); + (void) tputs(exit_ca_mode, 0, _outch); + + /* restore colors and default color pair. SS: colors */ + if (orig_colors) + (void) tputs(orig_colors, 1, _outch); + if (orig_pair) + (void) tputs(tparm_p0(orig_pair), 1, _outch); + + /* SS-mouse: free the mouse. */ + + if (get_mouse) + (void) tputs(tparm_p1(get_mouse, 0), 1, _outch); + + (void) fflush(SP->term_file); + + return (OK); +} + +int +force_doupdate(void) +{ + char chars_onQ = cur_term->_chars_on_queue; + int ret; + + /* + * This will cause _chkinput to return FALSE which will force wrefresh + * to think there is no input waiting and it will finish its refresh. + */ + + cur_term->_chars_on_queue = INP_QSIZE; + ret = doupdate(); + cur_term->_chars_on_queue = chars_onQ; + return (ret); +} diff --git a/usr/src/lib/libcurses/screen/erasechar.c b/usr/src/lib/libcurses/screen/erasechar.c new file mode 100644 index 0000000000..3fee94b3c4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/erasechar.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +char +erasechar(void) +{ +#ifdef SYSV + return (SHELLTTYS.c_cc[VERASE]); +#else + return (SHELLTTY.sg_erase); +#endif +} diff --git a/usr/src/lib/libcurses/screen/flushinp.c b/usr/src/lib/libcurses/screen/flushinp.c new file mode 100644 index 0000000000..fd75262e6d --- /dev/null +++ b/usr/src/lib/libcurses/screen/flushinp.c @@ -0,0 +1,83 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <unistd.h> +#include <sys/types.h> +#include "curses_inc.h" + +int +flushinp(void) +{ +#ifdef DEBUG + if (outf) + fprintf(outf, "flushinp(), file %x, SP %x\n", + cur_term->Filedes, SP); +#endif /* DEBUG */ + +#ifdef SYSV + (void) ioctl(cur_term -> Filedes, TCFLSH, 0); +#else /* SYSV */ + /* for insurance against someone using their own buffer: */ + (void) ioctl(cur_term -> Filedes, TIOCGETP, &(PROGTTY)); + + /* + * SETP waits on output and flushes input as side effect. + * Really want an ioctl like TCFLSH but Berkeley doesn't have one. + */ + (void) ioctl(cur_term -> Filedes, TIOCSETP, &(PROGTTY)); +#endif /* SYSV */ + + /* + * Get rid of any typeahead which was read(). + * Leave characters which were ungetch()'d. + */ + cur_term->_chars_on_queue = cur_term->_ungotten; + + /* + * Have to doupdate() because, if we have stopped output due to + * typeahead, now that typeahead is gone, so we had better catch up. + */ + if (_INPUTPENDING) + (void) doupdate(); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/getattrs.c b/usr/src/lib/libcurses/screen/getattrs.c new file mode 100644 index 0000000000..46c2cfa472 --- /dev/null +++ b/usr/src/lib/libcurses/screen/getattrs.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +chtype +getattrs(WINDOW *win) +{ + return (win->_attrs); +} diff --git a/usr/src/lib/libcurses/screen/getbegyx.c b/usr/src/lib/libcurses/screen/getbegyx.c new file mode 100644 index 0000000000..cd775639cf --- /dev/null +++ b/usr/src/lib/libcurses/screen/getbegyx.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +getbegy(WINDOW *win) +{ + return (win->_begy); +} + +int +getbegx(WINDOW *win) +{ + return (win->_begx); +} diff --git a/usr/src/lib/libcurses/screen/getbkgd.c b/usr/src/lib/libcurses/screen/getbkgd.c new file mode 100644 index 0000000000..4a16eb13c0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/getbkgd.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +chtype +getbkgd(WINDOW *win) +{ + return (win->_bkgd); +} diff --git a/usr/src/lib/libcurses/screen/getmaxyx.c b/usr/src/lib/libcurses/screen/getmaxyx.c new file mode 100644 index 0000000000..52d9b473ed --- /dev/null +++ b/usr/src/lib/libcurses/screen/getmaxyx.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +getmaxy(WINDOW *win) +{ + return (win->_maxy); +} + +int +getmaxx(WINDOW *win) +{ + return (win->_maxx); +} diff --git a/usr/src/lib/libcurses/screen/getparyx.c b/usr/src/lib/libcurses/screen/getparyx.c new file mode 100644 index 0000000000..97fe4b7175 --- /dev/null +++ b/usr/src/lib/libcurses/screen/getparyx.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +getpary(WINDOW *win) +{ + return (win->_pary); +} + +int +getparx(WINDOW *win) +{ + return (win->_parx); +} diff --git a/usr/src/lib/libcurses/screen/getsyx.c b/usr/src/lib/libcurses/screen/getsyx.c new file mode 100644 index 0000000000..722cc257cb --- /dev/null +++ b/usr/src/lib/libcurses/screen/getsyx.c @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get the current screen coordinates (y, x). + * + * The current screen coordinates are defined as the last place that + * the cursor was placed by a wnoutrefresh(), pnoutrefresh() or setsyx() + * call. If leaveok() was true for the last window refreshed, then + * return (-1, -1) so that setsyx() can reset the leaveok flag. + * + * This function is actually called by the macro getsyx(y, x), which is + * defined in curses.h as: + * + * #define getsyx(y, x) _getsyx(&y, &x) + * + * Note that this macro just adds in the '&'. In this way, getsyx() + * is parallel with the other getyx() routines which don't require + * ampersands. The reason that this can't all be a macro is that + * that we need to access SP, which is normally not available in + * user-level routines. + */ + +int +_getsyx(int *yp, int *xp) +{ + if (SP->virt_scr->_leave) + *yp = *xp = -1; + else { + *yp = _virtscr->_cury - SP->Yabove; + *xp = _virtscr->_curx; + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/gettmode.c b/usr/src/lib/libcurses/screen/gettmode.c new file mode 100644 index 0000000000..970a9cf8dd --- /dev/null +++ b/usr/src/lib/libcurses/screen/gettmode.c @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#define OK 0 + +int +gettmode(void) +{ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/getwin.c b/usr/src/lib/libcurses/screen/getwin.c new file mode 100644 index 0000000000..48789f78be --- /dev/null +++ b/usr/src/lib/libcurses/screen/getwin.c @@ -0,0 +1,101 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#define SEPARATE_READ 6 + +/* Read a window that was stored by putwin. */ + +WINDOW * +getwin(FILE *filep) +{ + short *save_fch, win_nums[SEPARATE_READ], maxy, maxx, nelt; + WINDOW *win = NULL; + chtype **ecp, **wcp; + + /* read everything from _cury to _bkgd inclusive */ + + nelt = sizeof (WINDOW) - sizeof (win->_y) - sizeof (win->_parent) - + sizeof (win->_parx) - sizeof (win->_pary) - + sizeof (win->_ndescs) - sizeof (win->_delay) - + (SEPARATE_READ * sizeof (short)); + + if ((fread((char *) win_nums, sizeof (short), SEPARATE_READ, filep) != + SEPARATE_READ) || ((win = _makenew(maxy = win_nums[2], maxx = + win_nums[3], win_nums[4], win_nums[5])) == NULL)) { + goto err; + } + + if (_image(win) == ERR) { + win = (WINDOW *) NULL; + goto err; + } + save_fch = win->_firstch; + + if (fread(&(win->_flags), 1, nelt, filep) != nelt) + goto err; + + win->_firstch = save_fch; + win->_lastch = save_fch + maxy; + + /* read the image */ + wcp = win->_y; + ecp = wcp + maxy; + + while (wcp < ecp) + if (fread((char *) *wcp++, sizeof (chtype), maxx, filep) != + maxx) { +err : + if (win != NULL) + (void) delwin(win); + return ((WINDOW *) NULL); + } + + win->_cury = win_nums[0]; + win->_curx = win_nums[1]; + win->_use_idl = win->_use_keypad = FALSE; + + return (win); +} diff --git a/usr/src/lib/libcurses/screen/getyx.c b/usr/src/lib/libcurses/screen/getyx.c new file mode 100644 index 0000000000..a059550abf --- /dev/null +++ b/usr/src/lib/libcurses/screen/getyx.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +getcury(WINDOW *win) +{ + return (win->_cury); +} + +int +getcurx(WINDOW *win) +{ + return (win->_curx); +} diff --git a/usr/src/lib/libcurses/screen/has_colors.c b/usr/src/lib/libcurses/screen/has_colors.c new file mode 100644 index 0000000000..73e845b560 --- /dev/null +++ b/usr/src/lib/libcurses/screen/has_colors.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +bool +has_colors(void) +{ + return ((max_pairs == -1) ? FALSE : TRUE); +} diff --git a/usr/src/lib/libcurses/screen/has_ic.c b/usr/src/lib/libcurses/screen/has_ic.c new file mode 100644 index 0000000000..1eab1bf511 --- /dev/null +++ b/usr/src/lib/libcurses/screen/has_ic.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Query: Does it have insert/delete char? */ + +int +has_ic(void) +{ + return ((insert_character || enter_insert_mode || parm_ich) && + (delete_character || parm_dch)); +} diff --git a/usr/src/lib/libcurses/screen/has_il.c b/usr/src/lib/libcurses/screen/has_il.c new file mode 100644 index 0000000000..2e03e88642 --- /dev/null +++ b/usr/src/lib/libcurses/screen/has_il.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Query: does the terminal have insert/delete line? */ + +int +has_il(void) +{ + return (((insert_line || parm_insert_line) && + (delete_line || parm_delete_line)) || change_scroll_region); +} diff --git a/usr/src/lib/libcurses/screen/idcok.c b/usr/src/lib/libcurses/screen/idcok.c new file mode 100644 index 0000000000..531931014e --- /dev/null +++ b/usr/src/lib/libcurses/screen/idcok.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +void +idcok(WINDOW *win, bool bf) +{ + win->_use_idc = (bf) ? TRUE : FALSE; +} diff --git a/usr/src/lib/libcurses/screen/idlok.c b/usr/src/lib/libcurses/screen/idlok.c new file mode 100644 index 0000000000..16576bb097 --- /dev/null +++ b/usr/src/lib/libcurses/screen/idlok.c @@ -0,0 +1,342 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include "curses_inc.h" + + +/* Functions to make use of insert/delete line caps */ + +#define scrco COLS + +typedef struct + { + int _wy, /* matching lines */ + _sy; + } IDST; +static IDST *sid, *eid; /* list of idln actions */ +static int scrli, /* screen dimensions */ + cy, cx; /* current cursor positions */ +static bool didcsr; /* scrolling region was used */ +static int _use_idln(void), _set_idln(void); +static void _do_idln(int, int, int, int); + +/* Set insert/delete line mode for win */ + +int +idlok(WINDOW *win, bool bf) +{ + _useidln = _use_idln; + _setidln = _set_idln; + + SP->yesidln = (delete_line || parm_delete_line || + (change_scroll_region && (parm_index || scroll_forward))) && + (insert_line || parm_insert_line || + (change_scroll_region && (parm_rindex || scroll_reverse))); + + win->_use_idl = bf; + return (OK); +} + +/* + * Set the places to do insert/delete lines + * Return the start line for such action. + */ + +static int +_set_idln(void) +{ + /* + * The value we want to return is the lower line + * number of the top-most range. + * + * If there is more than one range of lines on which + * we're operating, _find_idln will get called more + * then once; we need to search all the IDST for the + * desired return value. + */ + { + IDST *idp; + int rval = scrli; + + for (idp = sid; idp != eid; idp++) { + int tmp; + + if ((tmp = _MIN(idp->_wy, idp->_sy)) < rval) + rval = tmp; + } + return (rval); + } +} + +/* Use hardware line delete/insert */ + +static int +_use_idln(void) +{ + int tsy, bsy, idn, dir, nomore; + IDST *ip, *ep, *eip; + + cy = curscr->_cury; + cx = curscr->_curx; + didcsr = FALSE; + + /* first cycle do deletions, second cycle do insertions */ + for (dir = 1; dir > -2; dir -= 2) { + if (dir > 0) { + ip = sid; + eip = eid; + } else { + ip = eid - 1; + eip = sid - 1; + } + + nomore = TRUE; + while (ip != eip) { + /* skip deletions or insertions */ + if ((dir > 0 && ip->_wy > ip->_sy) || + (dir < 0 && ip->_wy < ip->_sy)) { + nomore = FALSE; + ip += dir; + continue; + } + + /* find a contiguous block */ + for (ep = ip+dir; ep != eip; ep += dir) + if (ep->_wy != (ep - dir)->_wy + dir || + ep->_sy != (ep - dir)->_sy + dir) { + break; + } + ep -= dir; + + /* top and bottom lines of the affected region */ + if (dir > 0) { + tsy = _MIN(ip->_wy, ip->_sy); + bsy = _MAX(ep->_wy, ep->_sy) + 1; + } else { + tsy = _MIN(ep->_wy, ep->_sy); + bsy = _MAX(ip->_wy, ip->_sy) + 1; + } + + /* amount to insert/delete */ + if ((idn = ip->_wy - ip->_sy) < 0) + idn = -idn; + + /* do the actual output */ + _do_idln(tsy, bsy, idn, dir == -1); + + /* update change structure */ + (void) wtouchln(_virtscr, tsy, bsy - tsy, -1); + + /* update screen image */ + /*LINTED*/ + curscr->_tmarg = (short)tsy; + curscr->_bmarg = bsy - 1; + /*LINTED*/ + curscr->_cury = (short)tsy; + (void) winsdelln(curscr, dir > 0 ? -idn : idn); + curscr->_tmarg = 0; + curscr->_bmarg = scrli - 1; + + /* for next while cycle */ + ip = ep + dir; + } + + if (nomore) + break; + } + + /* reset scrolling region */ + if (didcsr) { + _PUTS(tparm_p2(change_scroll_region, 0, scrli - 1), scrli); + cy = cx = -1; + } + + /*LINTED*/ + curscr->_cury = (short)cy; + /*LINTED*/ + curscr->_curx = (short)cx; + return (OK); +} + +/* Do the actual insert/delete lines */ + +static void +_do_idln(int tsy, int bsy, int idn, int doinsert) +{ + int y, usecsr, yesscrl; + short *begns; + + /* change scrolling region */ + yesscrl = usecsr = FALSE; + if (tsy > 0 || bsy < scrli) { + if (change_scroll_region) { + _PUTS(tparm_p2(change_scroll_region, tsy, bsy - 1), + bsy - tsy); + cy = cx = -1; + yesscrl = usecsr = didcsr = TRUE; + } + } else { + if (didcsr) { + _PUTS(tparm_p2(change_scroll_region, 0, scrli - 1), scrli); + cy = cx = -1; + didcsr = FALSE; + } + yesscrl = TRUE; + } + + if (doinsert) { + /* memory below, clobber it now */ + if (memory_below && clr_eol && + ((usecsr && non_dest_scroll_region) || bsy == scrli)) { + for (y = bsy - idn, begns = _BEGNS + y; + y < bsy; ++y, ++begns) + if (*begns < scrco) { + (void) mvcur(cy, cx, y, 0); + cy = y; + cx = 0; + _PUTS(clr_eol, 1); + } + } + + /* if not change_scroll_region, delete, then insert */ + if (!usecsr && bsy < scrli) { + /* delete appropriate number of lines */ + (void) mvcur(cy, cx, bsy - idn, 0); + cy = bsy - idn; + cx = 0; + if (parm_delete_line && (idn > 1 || !delete_line)) + _PUTS(tparm_p1(parm_delete_line, idn), + scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(delete_line, scrli - cy); + } + + /* now do insert */ + (void) mvcur(cy, cx, tsy, 0); + cy = tsy; + cx = 0; + if (yesscrl) { + if (!parm_rindex && (!scroll_reverse || + (parm_insert_line && idn > 1))) { + goto hardinsert; + } + if (parm_rindex && (idn > 1 || !scroll_reverse)) + _PUTS(tparm_p1(parm_rindex, idn), scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(scroll_reverse, scrli - cy); + } else { +hardinsert: + if (parm_insert_line && (idn > 1 || !insert_line)) + _PUTS(tparm_p1(parm_insert_line, idn), + scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(insert_line, scrli - cy); + } + } else { + /* doing deletion */ + /* memory above, clobber it now */ + if (memory_above && clr_eol && + ((usecsr && non_dest_scroll_region) || tsy == 0)) { + for (y = 0, begns = _BEGNS + y + tsy; + y < idn; ++y, ++begns) + if (*begns < scrco) { + (void) mvcur(cy, cx, tsy + y, 0); + cy = tsy + y; + cx = 0; + _PUTS(clr_eol, 1); + } + } + + if (yesscrl) { + if (!parm_index && (!scroll_forward || + (parm_delete_line && idn > 1))) { + goto harddelete; + } + (void) mvcur(cy, cx, bsy - 1, 0); + cy = bsy - 1; + cx = 0; + if (parm_index && (idn > 1 || !scroll_forward)) + _PUTS(tparm_p1(parm_index, idn), scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(scroll_forward, scrli - cy); + } else { +harddelete: + /* do deletion */ + (void) mvcur(cy, cx, tsy, 0); + cy = tsy; + cx = 0; + if (parm_delete_line && (idn > 1 || !delete_line)) + _PUTS(tparm_p1(parm_delete_line, idn), + scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(delete_line, scrli - cy); + } + + /* if not change_scroll_region, do insert to restore bottom */ + if (!usecsr && bsy < scrli) { + y = scrli - 1; + begns = _BEGNS + y; + for (; y >= bsy; --y, --begns) + if (*begns < scrco) + break; + if (y >= bsy) { + (void) mvcur(cy, cx, bsy - idn, 0); + cy = bsy - idn; + cx = 0; + if (parm_insert_line && + (idn > 1 || !insert_line)) + _PUTS(tparm_p1(parm_insert_line, idn), + scrli - cy); + else + for (y = 0; y < idn; ++y) + _PUTS(insert_line, scrli - cy); + } + } + } +} diff --git a/usr/src/lib/libcurses/screen/iexpand.c b/usr/src/lib/libcurses/screen/iexpand.c new file mode 100644 index 0000000000..0758e8761f --- /dev/null +++ b/usr/src/lib/libcurses/screen/iexpand.c @@ -0,0 +1,117 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdio.h> + +/* + * Convert a character, making appropriate changes to make it printable + * for a terminfo source entry. Change escape to \E, tab to \t, backspace + * to \b, formfeed to \f, newline to \n, and return to \r. Change other + * control characters into ^X notation. Change meta characters into octal + * (\nnn) notation. Also place a backslash in front of commas, + * carets(^), and backslashes(\). Return the number of characters printed. + */ + +#define BACKSLASH '\\' +#define BACKBACK "\\\\" + +static char retbuffer[1024]; + +/* + * Expand a string taking terminfo sequences into consideration. + */ +char +*iexpand(char *string) +{ + int c; + char *retptr = retbuffer; + + retbuffer[0] = '\0'; + while ((c = *string++) != 0) { + /* should check here to make sure that there is enough room */ + /* in retbuffer and realloc it if necessary. */ + c &= 0377; + /* we ignore the return value from sprintf because BSD/V7 */ + /* systems return a (char *) rather than an int. */ + if (c >= 0200) { + (void) sprintf(retptr, "\\%.3o", c); retptr += 4; } + else if (c == '\033') { + (void) sprintf(retptr, "\\E"); retptr += 2; } + else if (c == '\t') { + (void) sprintf(retptr, "\\t"); retptr += 2; } + else if (c == '\b') { + (void) sprintf(retptr, "\\b"); retptr += 2; } + else if (c == '\f') { + (void) sprintf(retptr, "\\f"); retptr += 2; } + else if (c == '\n') { + (void) sprintf(retptr, "\\n"); retptr += 2; } + else if (c == '\r') { + (void) sprintf(retptr, "\\r"); retptr += 2; } + else if (c == ',') { + (void) sprintf(retptr, "\\,"); retptr += 2; } + else if (c == '^') { + (void) sprintf(retptr, "\\^"); retptr += 2; } + else if (c == BACKSLASH) { + (void) sprintf(retptr, BACKBACK); retptr += 2; } + else if (c == ' ') { + (void) sprintf(retptr, "\\s"); retptr += 2; } + else if (c < ' ' || c == 0177) { + (void) sprintf(retptr, "^%c", c ^ 0100); retptr += 2; } + else { + (void) sprintf(retptr, "%c", c); retptr++; } + } + *retptr = '\0'; + return (retbuffer); +} + +/* + * Print out a string onto a stream, changing unprintables into + * terminfo printables. + */ +void +tpr(FILE *stream, char *string) +{ + if (string != NULL) + (void) fprintf(stream, "%s", iexpand(string)); +} diff --git a/usr/src/lib/libcurses/screen/immedok.c b/usr/src/lib/libcurses/screen/immedok.c new file mode 100644 index 0000000000..94909d4385 --- /dev/null +++ b/usr/src/lib/libcurses/screen/immedok.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + + +void +immedok(WINDOW *win, bool bf) +{ + if (bf) { + win->_immed = TRUE; + _quick_ptr = _quick_echo; + } else + win->_immed = FALSE; +} diff --git a/usr/src/lib/libcurses/screen/infotocap.c b/usr/src/lib/libcurses/screen/infotocap.c new file mode 100644 index 0000000000..095c699965 --- /dev/null +++ b/usr/src/lib/libcurses/screen/infotocap.c @@ -0,0 +1,234 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + Routines to convert terminfo string parameters to termcap form. + Not all terminfo strings will be, or could be, converted. + + The following parameter forms will at least be handled. + + %p1%d -> %d + %p1%2.2d -> %2 + %p1%3.3d -> %3 + %p1%02d -> %2 + %p1%03d -> %3 + %p1%c -> %. + %p1%'x'%+%c -> %+x + %i -> %i + %p2 before %p1 -> %r + %p1%'x'% > %+%p1%'y'%+%; -> % > xy +*/ + +#include "curses.h" + +/* externs from libc */ +extern char *strcpy(); +#if !defined(SYSV) && !defined(USG) && !defined(strchr) + /* handle both Sys Vr2 and Vr3 curses */ +#define strchr index +#endif /* SYSV || USG */ +extern char *strchr(); + +#define NULLPTR ((char *) 0) + +/* + lookat looks at a string such as "%p1%d" and a pattern such as "%p*%d", + where '*' is the only wild character. Each place that the star matches, + the corresponding character in the string is placed in args. If the + pattern matches the string, 1 is returned. +*/ + +static int +lookat(char *string, char *pattern, char *args) +{ + int val, pat; + + while ((pat = *pattern++) && (val = *string++)) + if (pat == '*') + *args++ = val; + else if (val != pat) + return (0); + if (pat == '\0') + return (1); + else + return (0); +} + +static int currentparm, otherparm, reversedparms; +static char *newvalue; +static char _newvalue[1024] = "!!! MUST CHANGE BY HAND !!!"; +#define BYHANDMSGLEN 27 + +static void setparms(); + +/* + Setparms() and checkparms() are used by infotocap() to make + sure that the parameters in the terminfo entry alternate and are + only '1' or '2'. If the order has been reversed, then %r is added + in to the new value being built. + */ + +static void +setparms() +{ + currentparm = 1; + otherparm = 2; + reversedparms = 0; + newvalue = &_newvalue[BYHANDMSGLEN]; + return; +} + +static int +checkparms(int arg) +{ + arg -= '0'; + if (arg != 1 && arg != 2) + return (1); + else if (arg != currentparm) + if (reversedparms) + return (1); + else if (!reversedparms && arg == otherparm) { + (void) strcpy(newvalue, "%r"); + newvalue += 2; + reversedparms = TRUE; + } else + return (1); + else { + otherparm = currentparm; + currentparm = 3 - currentparm; + } + return (0); +} + +/* + Infotocap looks at the string capability to see if it has any + stack manipulation operators. If possible, they are converted to + termcap form. If any operator is found that cannot be modified, + prepend a message to the beginning of the original value and + set err to 1. A pointer to the new copy of the string is returned + in either case. +*/ + +char +*infotocap(char *value, int *err) +{ + char args[4]; + char *savevalue; + + *err = 0; + if (strchr(value, '%') == NULLPTR) + return (value); + + setparms(); + + savevalue = value; + while (*value) + if (*value != '%') + *newvalue++ = *value++; + else if (lookat(value, "%p*%d", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%d"); + newvalue += 2; + value += 5; + } else if (lookat(value, "%p*%02d", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%2"); + newvalue += 2; + value += 7; + } else if (lookat(value, "%p*%03d", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%3"); + newvalue += 2; + value += 7; + } else if (lookat(value, "%p*%2.2d", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%2"); + newvalue += 2; + value += 8; + } else if (lookat(value, "%p*%3.3d", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%3"); + newvalue += 2; + value += 8; + } else if (lookat(value, "%p*%c", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) strcpy(newvalue, "%."); + newvalue += 2; + value += 5; + } else if (lookat(value, "%p*%'*'%+%c", args)) { + if (checkparms(args[0])) + goto dobyhand; + (void) sprintf(newvalue, "%%+%c", args[1]); + newvalue += 3; + value += 11; + } else if (lookat(value, "%i", args)) { + (void) strcpy(newvalue, "%i"); + newvalue += 2; + value += 2; + } else if (lookat(value, "%%", args)) { + (void) strcpy(newvalue, "%%"); + newvalue += 2; + value += 2; + } else if (lookat(value, "p*%'*'%>%+%p*%'*'%+%;", args)) { + if (args[0] != args[2]) + goto dobyhand; + if (checkparms(args[0])) + goto dobyhand; + (void) sprintf(newvalue, "%%>%c%c", args[1], args[3]); + newvalue += 2; + value += 21; + } else + goto dobyhand; + + *newvalue = '\0'; + return (&_newvalue[BYHANDMSGLEN]); + +dobyhand: + (void) strcpy(&_newvalue[BYHANDMSGLEN], savevalue); + *err = 1; + return (_newvalue); +} diff --git a/usr/src/lib/libcurses/screen/init_acs.c b/usr/src/lib/libcurses/screen/init_acs.c new file mode 100644 index 0000000000..4b09793776 --- /dev/null +++ b/usr/src/lib/libcurses/screen/init_acs.c @@ -0,0 +1,143 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * When the keyboard can send more than eight bits, offsets array + * should be changed from chars to shorts. + * The offsets MUST match what is in curses.h. + */ + +static unsigned char offsets[][2] = { + { '`', '*' }, /* ACS_DIAMOND */ + { 'a', ':' }, /* ACS_CKBOARD */ + { 'f', '\'' }, /* ACS_DEGREE */ + { 'g', '#' }, /* ACS_PLMINUS */ + { 'o', '-' }, /* ACS_S1 */ + { 'q', '-' }, /* ACS_HLINE */ + { 's', '_' }, /* ACS_S9 */ + { 'x', '|' }, /* ACS_VLINE */ + { '~', 'o' }, /* ACS_BULLET */ + { ',', '<' }, /* ACS_LARROW */ + { '+', '>' }, /* ACS_RARROW */ + { '.', 'v' }, /* ACS_DARROW */ + { '-', '^' }, /* ACS_UARROW */ + { 'h', '#' }, /* ACS_BOARD */ + { 'i', '#' }, /* ACS_LANTERN */ + { '0', '#' }, /* ACS_BLOCK */ + }; + +int +init_acs(void) +{ + chtype *nacsmap; + char *cp; + int i = sizeof (offsets) / 2, to_get, must_output; + +#ifdef _VR3_COMPAT_CODE + if ((nacsmap = cur_term->_acs32map = (chtype *) + malloc(sizeof (chtype) * 0400)) == NULL) +#else /* _VR3_COMPAT_CODE */ + if ((nacsmap = cur_term->_acsmap = (chtype *) + malloc(sizeof (chtype) * 0400)) == NULL) +#endif /* _VR3_COMPAT_CODE */ + { +#ifdef _VR3_COMPAT_CODE +bad: +#endif /* _VR3_COMPAT_CODE */ + term_errno = TERM_BAD_MALLOC; +#ifdef DEBUG + strcpy(term_parm_err, "init_acs"); +#endif /* DEBUG */ + return (ERR); + } + + /* Default acs chars for regular ASCII terminals are plus signs. */ + + memSset(nacsmap, (chtype) '+', 0400); + + /* + * Now load in defaults for some of the characters which have close + * approximations in the normal ascii set. + */ + + while (i-- > 0) + nacsmap[offsets[i][0]] = offsets[i][1]; + + /* Now do mapping for terminals own ACS, if any */ + + if ((cp = acs_chars) != 0) + while (*cp) { + to_get = *cp++; /* to get this ... */ + must_output = *cp++; /* must output this ... */ +#ifdef DEBUG + if (outf) + fprintf(outf, "acs %d, was %d, now %d\n", + to_get, nacsmap[to_get], must_output); +#endif /* DEBUG */ + nacsmap[to_get] = ( must_output & 0xFF ) | A_ALTCHARSET; + } + + acs_map = nacsmap; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + _ochtype *n16acsmap; + + if ((n16acsmap = cur_term->_acsmap = (_ochtype *) + malloc(sizeof (_ochtype) * 0400)) == NULL) { + goto bad; + } + + for (i = 0; i < 0400; i++) + /*LINTED*/ + n16acsmap[i] = _TO_OCHTYPE(nacsmap[i]); +#undef acs_map + acs_map = n16acsmap; + } +#endif /* _VR3_COMPAT_CODE */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/init_color.c b/usr/src/lib/libcurses/screen/init_color.c new file mode 100644 index 0000000000..75ead4a402 --- /dev/null +++ b/usr/src/lib/libcurses/screen/init_color.c @@ -0,0 +1,201 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + + +static void _rgb_to_hls(float, float, float, int *, int *, int *); +static float MAX(float, float, float), MIN(float, float, float); + + +int +init_color(short color, short r, short g, short b) +{ + _Color *ctp = cur_term->_color_tbl; /* color table pointer */ + + /* check if terminal can change color and validity of the */ + /* first argument */ + + if (!can_change || color >= COLORS || color < 0) + return (ERR); + + /* if any of the last 3 arguments is out of 0 - 1000 range, */ + /* adjust them accordingly */ + + if (r > 1000) r = 1000; + if (g > 1000) g = 1000; + if (b > 1000) b = 1000; + if (r < 0) r = 0; + if (g < 0) g = 0; + if (b < 0) b = 0; + + /* if the call came from scr_reset, the color_table already */ + /* contains desired values, but we should still send escape seq. */ + + /* if new color is exactly the same as the old one, return */ + + if (ctp[color].r == r && ctp[color].g == g && ctp[color].b == b) + return (OK); + + /* update color table */ + + ctp[color].r = r; ctp[color].g = g; ctp[color].b = b; + + /* all the occurrences of color on the screen must be changed */ + /* to the new definition */ + + /* for terminals that can define individual colors (Tek model) */ + /* send an escape sequence to define that color */ + + if (initialize_color) { + if (hue_lightness_saturation) { + int h, s, l; + _rgb_to_hls((float)r, (float)g, (float)b, &h, &l, &s); + (void) tputs(tparm_p4(initialize_color, color, h, l, s), + 1, _outch); + } else + (void) tputs(tparm_p4(initialize_color, color, r, g, b), + 1, _outch); + + + } + + /* for terminals that can only define color pairs, go through */ + /* pairs table, and re-initialize all pairs that use given color */ + + else { + short i; + _Color_pair *ptp = cur_term->_pairs_tbl; + /* pairs table pointer */ + for (i = 0; i < COLOR_PAIRS; i++) { + if (ptp[i].foreground == color || + ptp[i].background == color) + _init_HP_pair(i, ptp[i].foreground, + ptp[i].background); + } + } + return (OK); +} + + + + +static void +_rgb_to_hls(float r, float g, float b, int *hh, int *ll, int *ss) +{ + float rc, gc, bc, h, l, s; + double max, min; + + r /= 1000; g /= 1000; b /= 1000; + + max = MAX(r, g, b); + min = MIN(r, g, b); + + /* calculate lightness */ + + l = (max + min) / 2; + + /* calculate saturation */ + + if (max == min) { + s = 0; + h = 0; + } else { + if (l < 0.5) + s = (max - min) / (max + min); + else + s = (max - min) / (2 - max - min); + + /* calculate hue */ + + rc = (max - r) / (max - min); + gc = (max - g) / (max - min); + bc = (max - b) / (max - min); + + if (r == max) + h = bc - gc; + else if (g == max) + h = 2 + rc - bc; + else /* if (b == max) */ + h = 4 + gc - rc; + + h = h * 60; + if (h < 0.0) + h = h + 360; + + /* until here we have converted into HSL. */ + /* Now, to convert into */ + /* Tektronix HLS, add 120 to h */ + + h = ((int)(h+120))%360; + } + *hh = (int) h; + *ss = (int) (s * 100); + *ll = (int) (l * 100); +} + + +static float +MAX(float a, float b, float c) +{ + if (a >= b) + if (a >= c) + return (a); + else return (c); + else if (c >= b) + return (c); + else return (b); +} + +static float +MIN(float a, float b, float c) +{ + if (a > b) + if (b > c) + return (c); + else return (b); + else if (a < c) + return (a); + else return (c); +} diff --git a/usr/src/lib/libcurses/screen/init_costs.c b/usr/src/lib/libcurses/screen/init_costs.c new file mode 100644 index 0000000000..cda368191d --- /dev/null +++ b/usr/src/lib/libcurses/screen/init_costs.c @@ -0,0 +1,154 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Figure out (roughly) how much each of these capabilities costs. + * In the parameterized cases, we just take a typical case and + * use that value. This is done only once at startup, since it + * would be too expensive for intensive use. + */ + +static int _cost_fn(char *, int); + +static short offsets[] = { + 52, /* insert_character, */ + 21, /* delete_character, */ + 12, /* cursor_home, */ + 18, /* cursor_to_ll, */ + 14, /* cursor_left, */ + 17, /* cursor_right, */ + 11, /* cursor_down, */ + 19, /* cursor_up, */ + 2, /* carriage_return, */ + 134, /* tab, */ + 0, /* back_tab, */ + 6, /* clr_eol, */ + 269, /* clr_bol, */ +#define FIRST_LOOP 13 + 108, /* parm_ich, */ + 105, /* parm_dch, */ + 111, /* parm_left_cursor, */ + 114, /* parm_up_cursor, */ + 107, /* parm_down_cursor, */ + 112, /* parm_right_cursor, */ +#define SECOND_LOOP 19 + }; + +void +_init_costs(void) +{ + short *costptr = &(SP->term_costs.icfixed); + char **str_array = (char **) cur_strs; + int i = 0; + char save_xflag = xon_xoff; + + xon_xoff = 0; +/* + * This next block of code is actually correct in that it takes into + * account many things that wrefresh has to keep figuring in the function + * _useidch. Wrefresh MUST be changed (in the words of Tony Hansen) !!! + * + * Wrefresh has been changed (in my words -Phong Vo) !!!! + */ + *costptr++ = ((enter_insert_mode) && (exit_insert_mode)) ? + _cost_fn(enter_insert_mode, 0) + _cost_fn(exit_insert_mode, 0) : 0; + + *costptr++ = ((enter_delete_mode) && (exit_delete_mode)) ? + _cost_fn(enter_delete_mode, 0) + _cost_fn(exit_delete_mode, 0) : 0; + + while (i < FIRST_LOOP) + *costptr++ = _cost_fn(str_array[offsets[i++]], 1); + + while (i < SECOND_LOOP) + *costptr++ = _cost_fn(tparm_p1(str_array[offsets[i++]], 10), 1); + + *costptr++ = _cost_fn(tparm_p2(cursor_address, 8, 10), 1); + *costptr++ = _cost_fn(tparm_p1(row_address, 8), 1); + + xon_xoff = save_xflag; +#ifdef DEBUG + if (outf) { + fprintf(outf, "icfixed %d=%d+%d\n", _COST(icfixed), + _cost_fn(enter_insert_mode, 0), + _cost_fn(exit_insert_mode, 0)); + fprintf(outf, "from ich1 %x '%s' %d\n", insert_character, + insert_character, _cost_fn(insert_character, 1)); + fprintf(outf, "ip %x '%s' %d\n", insert_padding, + insert_padding, _cost_fn(insert_padding, 1)); + fprintf(outf, "dcfixed %d\n", _COST(dcfixed)); + } +#endif /* DEBUG */ +/*FALLTHROUGH*/ +} + +static int counter = 0; +int +/* ARGSUSED */ +_countchar(char dummy) +{ + counter++; + return (0); +} + +/* + * Figure out the _COST in characters to print this string. + * Due to padding, we can't just use strlen, so instead we + * feed it through tputs and trap the results. + * Even if the terminal uses xon/xoff handshaking, count the + * pad chars here since they estimate the real time to do the + * operation, useful in calculating costs. + */ + +static int +_cost_fn(char *str, int affcnt) +{ + if (str == NULL) + return (LARGECOST); + counter = 0; + (void) tputs(str, affcnt, _countchar); + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/init_pair.c b/usr/src/lib/libcurses/screen/init_pair.c new file mode 100644 index 0000000000..3c5e28e40a --- /dev/null +++ b/usr/src/lib/libcurses/screen/init_pair.c @@ -0,0 +1,142 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +init_pair(short pair, short f, short b) +{ + _Color_pair *ptp; /* pairs table pointer */ + + /* check the validity of arguments */ + + if (pair < 1 || pair >= COLOR_PAIRS || + f < 0 || b < 0 || f >= COLORS || b >= COLORS) + return (ERR); + + ptp = cur_term->_pairs_tbl + pair; + + /* update the pairs table (if no changes just return) */ + + if (ptp->foreground == f && ptp->background == b) + return (OK); + + ptp->foreground = f; + ptp->background = b; + + /* if we are on terminal that cannot define color pairs (Tek) */ + /* and "pair" was previously defined, go through the curscr */ + /* and erase information from the color field at all positions */ + /* that use that color pair (this way when refresh will be */ + /* called next time, it will be forced to change the color at */ + /* these positions */ + + if (!initialize_pair) { + if (ptp->init) { + short i, j; + short lin = curscr->_maxy; + chtype **y = curscr->_y; + bool change; + short top = -1; + short bottom = -1; + chtype new_pair = COLOR_PAIR(pair); + + /* must use lin=curscr->_maxy rather then LINES, because */ + /* LINES could have been decremented by ripoffline() */ + + for (i = 0; i < lin; i++) { + change = FALSE; + for (j = 0; j < COLS; j++) { + if ((y[i][j] & A_COLOR) == new_pair) { + y[i][j] &= ~A_COLOR; + change = TRUE; + } + if (change) { + (void) wtouchln(_virtscr, + i, 1, -1); + if (top == -1) + top = i; + bottom = i; + curscr->_attrs &= ~A_COLOR; + } + } + if (top != -1) { + _VIRTTOP = top; + _VIRTBOT = bottom; + } + } + + } + } + + /* on terminals that can initialize color pairs (HP) */ + /* send an escape to initialize the new pair */ + + else + _init_HP_pair(pair, f, b); + + /* if that pair has not been previously initialized, it could not */ + /* have been used on the screen, so we don't have to do refresh */ + + if (ptp->init) + (void) wrefresh(_virtscr); + else + ptp->init = TRUE; + + return (OK); +} + + + +void +_init_HP_pair(short pair, short f, short b) +{ + _Color *ctp = cur_term->_color_tbl; /* color table pointer */ + + if (initialize_pair) + (void) tputs(tparm_p7(initialize_pair, (long) pair, + (long) ctp[f].r, (long) ctp[f].g, (long) ctp[f].b, + (long) ctp[b].r, (long) ctp[b].g, (long) ctp[b].b), + 1, _outch); +} diff --git a/usr/src/lib/libcurses/screen/initscr.c b/usr/src/lib/libcurses/screen/initscr.c new file mode 100644 index 0000000000..8db4d6db51 --- /dev/null +++ b/usr/src/lib/libcurses/screen/initscr.c @@ -0,0 +1,114 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <signal.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * This routine initializes the current and standard screen, + * and sets up the terminal. In case of error, initscr aborts. + * If you want an error status returned, call + * scp = newscreen(getenv("TERM"), 0, 0, 0, stdout, stdin); + */ + +WINDOW * +initscr(void) +{ +#ifdef SIGPOLL + void (*savsignal)(int); + extern void _ccleanup(int); +#else /* SIGPOLL */ + int (*savsignal)(); + extern int _ccleanup(int); +#endif /* SIGPOLL */ + +#ifdef SIGTSTP + extern void _tstp(int); +#endif /* SIGTSTP */ + + static char i_called_before = FALSE; + +/* Free structures we are about to throw away so we can reuse the memory. */ + + if (i_called_before && SP) { + delscreen(SP); + SP = NULL; + } + if (newscreen(NULL, 0, 0, 0, stdout, stdin) == NULL) { + (void) reset_shell_mode(); + if (term_errno != -1) + termerr(); + else + curserr(); + exit(1); + } + +#ifdef DEBUG + if (outf) + fprintf(outf, "initscr: term = %s\n", SP); +#endif /* DEBUG */ + i_called_before = TRUE; + +#ifdef SIGTSTP + /*LINTED*/ + if ((savsignal = signal(SIGTSTP, SIG_IGN)) == SIG_DFL) + (void) signal(SIGTSTP, _tstp); + else + (void) signal(SIGTSTP, savsignal); +#endif /* SIGTSTP */ + /*LINTED*/ + if ((savsignal = signal(SIGINT, SIG_IGN)) == SIG_DFL) + (void) signal(SIGINT, _ccleanup); + else + (void) signal(SIGINT, savsignal); + + /*LINTED*/ + if ((savsignal = signal(SIGQUIT, SIG_IGN)) == SIG_DFL) + (void) signal(SIGQUIT, _ccleanup); + else + (void) signal(SIGQUIT, savsignal); + + return (stdscr); +} diff --git a/usr/src/lib/libcurses/screen/is_linetou.c b/usr/src/lib/libcurses/screen/is_linetou.c new file mode 100644 index 0000000000..6d1baa5f7d --- /dev/null +++ b/usr/src/lib/libcurses/screen/is_linetou.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +is_linetouched(WINDOW *win, int line) +{ + if (line < 0 || line >= win->_maxy) + return (ERR); + if (win->_firstch[line] == _INFINITY) + return (FALSE); + else + return (TRUE); +} diff --git a/usr/src/lib/libcurses/screen/is_wintou.c b/usr/src/lib/libcurses/screen/is_wintou.c new file mode 100644 index 0000000000..1e49f8d7b3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/is_wintou.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +is_wintouched(WINDOW *win) +{ + return (win->_flags & _WINCHANGED); +} diff --git a/usr/src/lib/libcurses/screen/keyname.sh b/usr/src/lib/libcurses/screen/keyname.sh new file mode 100644 index 0000000000..906bbd3a81 --- /dev/null +++ b/usr/src/lib/libcurses/screen/keyname.sh @@ -0,0 +1,104 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 1997 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 1988 AT&T +# All Rights Reserved +# + +# +# University Copyright- Copyright (c) 1982, 1986, 1988 +# The Regents of the University of California +# All Rights Reserved +# +# University Acknowledgment- Portions of this document are derived from +# software developed by the University of California, Berkeley, and its +# contributors. +# + +#ident "%Z%%M% %I% %E% SMI" + +rm -f keyname.c +/usr/bin/echo "#include \"curses_inc.h\"\n" > keyname.c +/usr/bin/echo "static char *keystrings[] =\n\t\t{" >> keyname.c +{ + grep -v 'KEY_F(' keycaps | awk '{ print $5, $4 }' | sed -e 's/,//g' -e 's/KEY_//' + # These three aren't in keycaps + echo '0401 BREAK\n0530 SRESET\n0531 RESET' +} | sort -n | awk ' + { + print "\t\t \"" $2 "\", /* " $1 " */" + } +' >> keyname.c + +LAST=`tail -1 keyname.c | awk -F'"' '{print $2}'` +cat << ! >> keyname.c + }; + +char * +keyname(int key) +{ + static char buf[16]; + + if (key >= 0400) { + int i; + + if ((key == 0400) || (key > KEY_${LAST})) + return ("UNKNOWN KEY"); + if (key > 0507) + i = key - (0401 + ((0507 - 0410) + 1)); + else + if (key >= 0410) { + (void) sprintf(buf, "KEY_F(%d)", key - 0410); + goto ret_buf; + } else + i = key - 0401; + (void) sprintf(buf, "KEY_%s", keystrings[i]); + goto ret_buf; + } + + if (key >= 0200) { +#ifdef SYSV + if (SHELLTTYS.c_cflag & CS8) +#else /* SYSV */ + if (SHELLTTY.c_cflag & CS8) +#endif /* SYSV */ + (void) sprintf(buf, "%c", key); + else + (void) sprintf(buf, "M-%s", unctrl(key & 0177)); + goto ret_buf; + } + + if (key < 0) { + (void) sprintf(buf, "%d", key); +ret_buf: + return (buf); + } + + return (unctrl(key)); +} +! +exit 0 diff --git a/usr/src/lib/libcurses/screen/keypad.c b/usr/src/lib/libcurses/screen/keypad.c new file mode 100644 index 0000000000..2a7e6a1952 --- /dev/null +++ b/usr/src/lib/libcurses/screen/keypad.c @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* TRUE => special keys should be passed as a single value by getch. */ + +int +keypad(WINDOW *win, bool bf) +{ + /* + * Since _use_keypad is a bit and not a bool, we must check + * bf, in case someone uses an odd number instead of 1 for TRUE + */ + + win->_use_keypad = (bf) ? TRUE : FALSE; + if (bf && (!SP->kp_state)) { + (void) tputs(keypad_xmit, 1, _outch); + (void) fflush(SP->term_file); + SP->kp_state = TRUE; + return (setkeymap()); + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/killchar.c b/usr/src/lib/libcurses/screen/killchar.c new file mode 100644 index 0000000000..b7825ecd11 --- /dev/null +++ b/usr/src/lib/libcurses/screen/killchar.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +char +killchar(void) +{ +#ifdef SYSV + return (SHELLTTYS.c_cc[VKILL]); +#else + return (SHELLTTY.sg_kill); +#endif +} diff --git a/usr/src/lib/libcurses/screen/leaveok.c b/usr/src/lib/libcurses/screen/leaveok.c new file mode 100644 index 0000000000..f4f1e7b574 --- /dev/null +++ b/usr/src/lib/libcurses/screen/leaveok.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +leaveok(WINDOW *win, bool bf) +{ + win->_leave = bf; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/llib-lcurses b/usr/src/lib/libcurses/screen/llib-lcurses new file mode 100644 index 0000000000..b1a0272a34 --- /dev/null +++ b/usr/src/lib/libcurses/screen/llib-lcurses @@ -0,0 +1,1352 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* LINTLIBRARY */ +/* PROTOLIB1 */ + +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#include <sys/types.h> +#include <stdarg.h> +#include <curses.h> +#include "term.h" +#include "print.h" + +/* + * usr/src/lib/libcurses/screen + */ + +/* V2.__sscans.c */ +int __sscans(WINDOW *win, char *fmt, ...); + +/* V2._sprintw.c */ +int _sprintw(WINDOW *win, char *fmt, ...); + +/* V2.makenew.c */ +WINDOW *makenew(int num_lines, int num_cols, int begy, int begx); + +/* V3.m_addch.c */ +int m_addch(int c); + +/* V3.m_addstr.c */ +int m_addstr(char *str); + +/* V3.m_clear.c */ +int m_clear(void); + +/* V3.m_erase.c */ +int m_erase(void); + +/* V3.m_initscr.c */ +WINDOW *m_initscr(void); + +/* V3.m_move.c */ +int m_move(int x, int y); + +/* V3.m_newterm.c */ +SCREEN *m_newterm(char *type, FILE *outfptr, FILE *infptr); + +/* V3.m_refresh.c */ +int m_refresh(void); + +/* V3.upd_old_y.c */ +void _update_old_y_area(WINDOW *win, int nlines, int ncols, int start_line, + int start_col); + +/* _addch.c */ +int addch(chtype ch); + +/* _addchnstr.c */ +int addchnstr(chtype *s, int n); + +/* _addchstr.c */ +int addchstr(chtype *s); + +/* _addnstr.c */ +int addnstr(char *s, int n); + +/* _addnwstr.c */ +int addnwstr(wchar_t *s, int n); + +/* _addstr.c */ +int addstr(char *s); + +/* _addwch.c */ +int addwch(chtype ch); + +/* _addwchnstr.c */ +int addwchnstr(chtype *str, int n); + +/* _addwchstr.c */ +int addwchstr(chtype *str); + +/* _addwstr.c */ +int addwstr(wchar_t *ws); + +/* _attroff.c */ +int attroff(chtype at); + +/* _attron.c */ +int attron(chtype at); + +/* _attrset.c */ +int attrset(chtype at); + +/* _beep.c */ +int beep(void); + +/* _bkgd.c */ +int bkgd(chtype c); + +/* _bkgdset.c */ +void bkgdset(chtype c); + +/* _border.c */ +int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, + chtype bl, chtype br); + +/* _clear.c */ +int clear(void); + +/* _clrtobot.c */ +int clrtobot(void); + +/* _clrtoeol.c */ +int clrtoeol(void); + +/* _crmode.c */ +#undef crmode +int crmode(void); + +/* _del_curterm.c */ +int del_curterm(TERMINAL *terminal); + +/* _delch.c */ +int delch(void); + +/* _deleteln.c */ +int deleteln(void); + +/* _echo.c */ +int echo(void); + +/* _echochar.c */ +int echochar(chtype ch); + +/* _echowchar.c */ +int echowchar(chtype ch); + +/* _erase.c */ +int erase(void); + +/* _fixterm.c */ +int fixterm(void); + +/* _flash.c */ +int flash(void); + +/* _garbagdlins.c */ +int garbagedlines(WINDOW *win, int start, int finish); + +/* _garbagedwin.c */ +int garbagedwin(WINDOW *win); + +/* _getch.c */ +int getch(void); + +/* _getnwstr.c */ +int getnwstr(wchar_t *ws, int n); + +/* _getstr.c */ +int getstr(char *str); + +/* _getwch.c */ +int getwch(void); + +/* _getwstr.c */ +int getwstr(wchar_t *ws); + +/* _halfdelay.c */ +int halfdelay(int tens); + +/* _hline.c */ +int hline(chtype horch, int num_chars); + +/* _inch.c */ +chtype inch(void); + +/* _inchnstr.c */ +int inchnstr(chtype *s, int n); + +/* _inchstr.c */ +int inchstr(chtype *s); + +/* _innstr.c */ +int innstr(char *s, int n); + +/* _innwstr.c */ +int innwstr(wchar_t *ws, int n); + +/* _insch.c */ +int insch(chtype c); + +/* _insdelln.c */ +int insdelln(int id); + +/* _insertln.c */ +int insertln(void); + +/* _insnstr.c */ +int insnstr(char *s, int n); + +/* _insnwstr.c */ +int insnwstr(wchar_t *ws, int n); + +/* _insstr.c */ +int insstr(char *s); + +/* _instr.c */ +int instr(char *s); + +/* _inswch.c */ +int inswch(chtype c); + +/* _inswstr.c */ +int inswstr(wchar_t *ws); + +/* _intrflush.c */ +int intrflush(WINDOW *win, int flag); + +/* _inwch.c */ +chtype inwch(void); + +/* _inwchnstr.c */ +int inwchnstr(chtype *str, int n); + +/* _inwchstr.c */ +int inwchstr(chtype *str); + +/* _inwstr.c */ +int inwstr(wchar_t *ws); + +/* _meta.c */ +int meta(WINDOW *win, int flag); + +/* _move.c */ +int move(int y, int x); + +/* _mvaddch.c */ +int mvaddch(int y, int x, chtype ch); + +/* _mvaddchnstr.c */ +int mvaddchnstr(int y, int x, chtype *s, int n); + +/* _mvaddchstr.c */ +int mvaddchstr(int y, int x, chtype *s); + +/* _mvaddnstr.c */ +int mvaddnstr(int y, int x, char *s, int n); + +/* _mvaddnwstr.c */ +int mvaddnwstr(int y, int x, wchar_t *ws, int n); + +/* _mvaddstr.c */ +int mvaddstr(int y, int x, char *str); + +/* _mvaddwch.c */ +int mvaddwch(int y, int x, chtype ch); + +/* _mvaddwchnstr.c */ +int mvaddwchnstr(int y, int x, chtype *str, int n); + +/* _mvaddwchstr.c */ +int mvaddwchstr(int y, int x, chtype *s); + +/* _mvaddwstr.c */ +int mvaddwstr(int y, int x, wchar_t *ws); + +/* _mvdelch.c */ +int mvdelch(int y, int x); + +/* _mvgetch.c */ +int mvgetch(int y, int x); + +/* _mvgetnwstr.c */ +int mvgetnwstr(int y, int x, wchar_t *ws, int n); + +/* _mvgetstr.c */ +int mvgetstr(int y, int x, char *str); + +/* _mvgetwch.c */ +int mvgetwch(int y, int x); + +/* _mvgetwstr.c */ +int mvgetwstr(int y, int x, wchar_t *ws); + +/* _mvhline.c */ +int mvhline(int y, int x, chtype ch, int n); + +/* _mvinch.c */ +chtype mvinch(int y, int x); + +/* _mvinchnstr.c */ +int mvinchnstr(int y, int x, chtype *str, int n); + +/* _mvinchstr.c */ +int mvinchstr(int y, int x, chtype *str); + +/* _mvinnstr.c */ +int mvinnstr(int y, int x, char *s, int n); + +/* _mvinnwstr.c */ +int mvinnwstr(int y, int x, wchar_t *ws, int n); + +/* _mvinsch.c */ +int mvinsch(int y, int x, chtype ch); + +/* _mvinsnstr.c */ +int mvinsnstr(int y, int x, char *s, int n); + +/* _mvinsnwstr.c */ +int mvinsnwstr(int y, int x, wchar_t *ws, int n); + +/* _mvinsstr.c */ +int mvinsstr(int y, int x, char *s); + +/* _mvinstr.c */ +int mvinstr(int y, int x, char *s); + +/* _mvinswch.c */ +int mvinswch(int y, int x, chtype ch); + +/* _mvinswstr.c */ +int mvinswstr(int y, int x, wchar_t *ws); + +/* _mvinwch.c */ +chtype mvinwch(int y, int x); + +/* _mvinwchnstr.c */ +int mvinwchnstr(int y, int x, chtype *str, int n); + +/* _mvinwchstr.c */ +int mvinwchstr(int y, int x, chtype *str); + +/* _mvinwstr.c */ +int mvinwstr(int y, int x, wchar_t *ws); + +/* _mvvline.c */ +int mvvline(int y, int x, chtype c, int n); + +/* _mvwaddch.c */ +int mvwaddch(WINDOW *win, int y, int x, chtype ch); + +/* _mvwaddchnst.c */ +int mvwaddchnstr(WINDOW *win, int y, int x, chtype *ch, int n); + +/* _mvwaddchstr.c */ +int mvwaddchstr(WINDOW *win, int y, int x, chtype *ch); + +/* _mvwaddnstr.c */ +int mvwaddnstr(WINDOW *win, int y, int x, char *c, int n); + +/* _mvwaddnwstr.c */ +int mvwaddnwstr(WINDOW *win, int y, int x, wchar_t *wc, int n); + +/* _mvwaddstr.c */ +int mvwaddstr(WINDOW *win, int y, int x, char *str); + +/* _mvwaddwch.c */ +int mvwaddwch(WINDOW *win, int y, int x, chtype ch); + +/* _mvwaddwchnstr.c */ +int mvwaddwchnstr(WINDOW *win, int y, int x, chtype *str, int n); + +/* _mvwaddwchstr.c */ +int mvwaddwchstr(WINDOW *win, int y, int x, chtype *str); + +/* _mvwaddwstr.c */ +int mvwaddwstr(WINDOW *win, int y, int x, wchar_t *wc); + +/* _mvwdelch.c */ +int mvwdelch(WINDOW *win, int y, int x); + +/* _mvwgetch.c */ +int mvwgetch(WINDOW *win, int y, int x); + +/* _mvwgetnwstr.c */ +int mvwgetnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n); + +/* _mvwgetstr.c */ +int mvwgetstr(WINDOW *win, int y, int x, char *str); + +/* _mvwgetwch.c */ +int mvwgetwch(WINDOW *win, int y, int x); + +/* _mvwgetwstr.c */ +int mvwgetwstr(WINDOW *win, int y, int x, wchar_t *ws); + +/* _mvwhline.c */ +int mvwhline(WINDOW *win, int y, int x, chtype c, int n); + +/* _mvwinch.c */ +chtype mvwinch(WINDOW *win, int y, int x); + +/* _mvwinchnst.c */ +int mvwinchnstr(WINDOW *win, int y, int x, chtype *s, int n); + +/* _mvwinchstr.c */ +int mvwinchstr(WINDOW *win, int y, int x, chtype *str); + +/* _mvwinnstr.c */ +int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); + +/* _mvwinnwstr.c */ +int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n); + +/* _mvwinsch.c */ +int mvwinsch(WINDOW *win, int y, int x, chtype c); + +/* _mvwinsnstr.c */ +int mvwinsnstr(WINDOW *win, int y, int x, char *str, int n); + +/* _mvwinsnwstr.c */ +int mvwinsnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n); + +/* _mvwinsstr.c */ +int mvwinsstr(WINDOW *win, int y, int x, char *str); + +/* _mvwinstr.c */ +int mvwinstr(WINDOW *win, int y, int x, char *str); + +/* _mvwinswch.c */ +int mvwinswch(WINDOW *win, int y, int x, chtype c); + +/* _mvwinswstr.c */ +int mvwinswstr(WINDOW *win, int y, int x, wchar_t *ws); + +/* _mvwinwch.c */ +chtype mvwinwch(WINDOW *win, int y, int x); + +/* _mvwinwchnstr.c */ +int mvwinwchnstr(WINDOW *win, int y, int x, chtype *str, int n); + +/* _mvwinwchstr.c */ +int mvwinwchstr(WINDOW *win, int y, int x, chtype *str); + +/* _mvwinwstr.c */ +int mvwinwstr(WINDOW *win, int y, int x, wchar_t *ws); + +/* _mvwvline.c */ +int mvwvline(WINDOW *win, int y, int x, chtype c, int n); + +/* _nl.c */ +int nl(void); + +/* _nocrmode.c */ +#undef nocrmode +int nocrmode(void); + +/* _noecho.c */ +int noecho(void); + +/* _nonl.c */ +int nonl(void); + +/* _noqiflush.c */ +void noqiflush(void); + +/* _overlay.c */ +int overlay(WINDOW *src, WINDOW *dst); + +/* _overwrite.c */ +int overwrite(WINDOW *src, WINDOW *dst); + +/* _qiflush.c */ +void qiflush(void); + +/* _refresh.c */ +int refresh(void); + +/* _resetterm.c */ +int resetterm(void); + +/* _saveterm.c */ +int saveterm(void); + +/* _scr_init.c */ +int scr_init(char *file); + +/* _scr_restore.c */ +int scr_restore(char *file); + +/* _scr_set.c */ +int scr_set(char *file); + +/* _scrl.c */ +int scrl(int n); + +/* _scroll.c */ +int scroll(WINDOW *win); + +/* _set_curterm.c */ +TERMINAL *set_curterm(TERMINAL *newterminal); + +/* _set_term.c */ +SCREEN *set_term(SCREEN *screen); + +/* _setscrreg.c */ +int setscrreg(int t, int b); + +/* _slk_init.c */ +int slk_init(int f); + +/* _standend.c */ +int standend(void); + +/* _standout.c */ +int standout(void); + +/* _subpad.c */ +WINDOW *subpad(WINDOW *win, int l, int nc, int by, int bx); + +/* _timeout.c */ +void timeout(int tm); + +/* _touchline.c */ +int touchline(WINDOW *win, int y, int n); + +/* _unctrl.c */ +char *unctrl(int ch); + +/* _vline.c */ +int vline(chtype vertch, int num_chars); + +/* _waddchstr.c */ +int waddchstr(WINDOW *win, chtype *str); + +/* _waddstr.c */ +int waddstr(WINDOW *win, char *str); + +/* _waddwchstr.c */ +int waddwchstr(WINDOW *win, chtype *str); + +/* _waddwstr.c */ +int waddwstr(WINDOW *win, wchar_t *ws); + +/* _wclear.c */ +int wclear(WINDOW *win); + +/* _wdeleteln.c */ +int wdeleteln(WINDOW *win); + +/* _werase.c */ +int werase(WINDOW *win); + +/* _winsertln.c */ +int winsertln(WINDOW *win); + +/* _winsstr.c */ +int winsstr(WINDOW *win, char *str); + +/* _winswstr.c */ +int winswstr(WINDOW *win, wchar_t *ws); + +/* _winwchstr.c */ +int winwchstr(WINDOW *win, chtype *str); + +/* _wstandend.c */ +int wstandend(WINDOW *win); + +/* _wstandout.c */ +int wstandout(WINDOW *win); + +/* baudrate.c */ +int baudrate(void); + +/* can_change.c */ +bool can_change_color(void); + +/* cbreak.c */ +int cbreak(void); + +/* chkinput.c */ +int _chkinput(void); + +/* clearok.c */ +int clearok(WINDOW *win, bool bf); + +/* color_cont.c */ +int color_content(short color, short *r, short *g, short *b); + +/* copywin.c */ +int copywin(WINDOW *Srcwin, WINDOW *Dstwin, int minRowSrc, int minColSrc, + int minRowDst, int minColDst, int maxRowDst, + int maxColDst, int over_lay); + +/* curs_set.c */ +int curs_set(int visibility); + +/* curserr.c */ +void curserr(void); + +/* curses.c */ + +/* def_prog.c */ +int def_prog_mode(void); + +/* delay.c */ +int _delay(int delay, int (*outc)(char)); + +/* delay_out.c */ +int delay_output(int ms); + +/* delkey.c */ +int delkey(char *sends, int keyval); + +/* delkeymap.c */ +void delkeymap(TERMINAL *terminal); + +/* delscreen.c */ +void delscreen(SCREEN *screen); + +/* delterm.c */ +int delterm(TERMINAL *terminal); + +/* delwin.c */ +int delwin(WINDOW *win); + +/* derwin.c */ +WINDOW *derwin(WINDOW *win, int num_lines, int nc, int by, int bx); + +/* doupdate.c */ +int doupdate(void); + +/* draino.c */ +int draino(int ms); + +/* dupwin.c */ +WINDOW *dupwin(WINDOW *win); + +/* endwin.c */ +int isendwin(void); +int endwin(void); +int force_doupdate(void); + +/* erasechar.c */ +char erasechar(void); + +/* flushinp.c */ +int flushinp(void); + +/* getattrs.c */ +chtype getattrs(WINDOW *win); + +/* getbegyx.c */ +int getbegy(WINDOW *win); +int getbegx(WINDOW *win); + +/* getbkgd.c */ +chtype getbkgd(WINDOW *win); + +/* getmaxyx.c */ +int getmaxy(WINDOW *win); +int getmaxx(WINDOW *win); + +/* getparyx.c */ +int getpary(WINDOW *win); +int getparx(WINDOW *win); + +/* getsyx.c */ +int _getsyx(int *yp, int *xp); + +/* gettmode.c */ +int gettmode(void); + +/* getwin.c */ +WINDOW *getwin(FILE *filep); + +/* getyx.c */ +int getcury(WINDOW *win); +int getcurx(WINDOW *win); + +/* has_colors.c */ +bool has_colors(void); + +/* has_ic.c */ +int has_ic(void); + +/* has_il.c */ +int has_il(void); + +/* idcok.c */ +void idcok(WINDOW *win, bool bf); + +/* idlok.c */ +int idlok(WINDOW *win, bool bf); + +/* immedok.c */ +void immedok(WINDOW *win, bool bf); + +/* init_acs.c */ +int init_acs(void); + +/* init_color.c */ +int init_color(short color, short r, short g, short b); + +/* init_costs.c */ +void _init_costs(void); +int _countchar(void); + +/* init_pair.c */ +int init_pair(short pair, short f, short b); +void _init_HP_pair(short pair, short f, short b); + +/* is_wintou.c */ +int is_wintouched(WINDOW *win); + +/* is_linetou.c */ +int is_linetouched(WINDOW *win, int line); + +/* keyname.c */ +char *keyname(int key); + +/* keypad.c */ +int keypad(WINDOW *win, bool bf); + +/* killchar.c */ +char killchar(void); + +/* leaveok.c */ +int leaveok(WINDOW *win, bool bf); + +/* longname.c */ +char *longname(void); + +/* makenew.c */ +WINDOW *_makenew(int nlines, int ncols, int begy, int begx); + +/* mbaddch.c */ +int _mbclrch(WINDOW *win, int y, int x); +int _mbvalid(WINDOW *win); +int _mbaddch(WINDOW *win, chtype a, chtype b); + +/* mbcharlen.c */ +int mbcharlen(char *sp); + +/* mbdisplen.c */ +int mbdisplen(char *sp); + +/* mbgetwidth.c */ +void mbgetwidth(void); +int mbeucw(int c); +int mbscrw(int c); +int wcscrw(wchar_t wc); + +/* mbinch.c */ +char *wmbinch(WINDOW *win, int y, int x); + +/* mbinsshift.c */ +int _mbinsshift(WINDOW *win, int len); + +/* mbmove.c */ +int wmbmove(WINDOW *win, int y, int x); + +/* mbstowcs.c */ +size_t _curs_mbstowcs(wchar_t *pwcs, const char *s, size_t n); + +/* mbtowc.c */ +int _curs_mbtowc(wchar_t *wchar, const char *s, size_t n); + +/* mbtranslate.c */ +char *_strcode2byte(wchar_t *code, char *b, int n); +wchar_t *_strbyte2code(char *code, wchar_t *byte, int n); + +/* memSset.c */ +void memSset(chtype *s, chtype c, int n); + +/* meta.c */ +int _meta(int bf); + +/* mouse.c */ +int mouse_set(long mbe); +int mouse_on(long mbe); +int mouse_off(long mbe); +int request_mouse_pos(void); +void wmouse_position(WINDOW *win, int *x, int *y); +int map_button(unsigned long a); +unsigned long getmouse(void); +unsigned long getbmap(void); + +/* mvcur.c */ +int mvcur(int cury, int curx, int newy, int newx); + +/* mvderwin.c */ +int mvderwin(WINDOW *win, int pary, int parx); + +/* mvprintw.c */ +int mvprintw(int y, int x, ...); + +/* mvscanw.c */ +int mvscanw(int y, int x, ...); + +/* mvwin.c */ +int mvwin(WINDOW *win, int by, int bx); + +/* mvwprintw.c */ +int mvwprintw(WINDOW *win, int y, int x, ...); + +/* mvwscanw.c */ +int mvwscanw(WINDOW *win, int y, int x, ...); + +/* napms.c */ +int napms(int ms); + +/* newkey.c */ +int newkey(char *rcvchars, short keyval, bool macro); + +/* newpad.c */ +WINDOW *newpad(int l, int nc); + +/* newscreen.c */ +int filter(void); +SCREEN *newscreen(char *type, int lsize, int csize, int tabsize, FILE *outfptr, + FILE *infptr); + +/* newwin.c */ +WINDOW *newwin(int nlines, int ncols, int by, int bx); +int _image(WINDOW *win); + +/* nocbreak.c */ +int nocbreak(void); + +/* nodelay.c */ +int nodelay(WINDOW *win, bool bf); + +/* noraw.c */ +int noraw(void); + +/* notimeout.c */ +int notimeout(WINDOW *win, bool bf); + +/* outch.c */ +int _outch(char c); +int _outwch(chtype c); + +/* overlap.c */ +int _overlap(WINDOW *Srcwin, WINDOW *Dstwin, int Overlay); + +/* pair_cont.c */ +int pair_content(short pair, short *f, short *b); + +/* pechowchar.c */ +int pechowchar(WINDOW *pad, chtype ch); + +/* pnoutref.c */ +int pnoutrefresh(WINDOW *pad, int pby, int pbx, int sby, int sbx, + int sey, int sex); + +/* prefresh.c */ +int prefresh(WINDOW *pad, int pminy, int pminx, int sminy, int sminx, + int smaxy, int smaxx); +int _prefresh(int (*func)(WINDOW *), WINDOW *pad, int pminy, int pminx, + int sminy, int sminx, int smaxy, int smaxx); +int _padjust(WINDOW *pad, int pminy, int pminx, int sminy, int sminx, + int smaxy, int smaxx); + +/* printw.c */ +int printw(char *fmt, ...); + +/* putwin.c */ +int putwin(WINDOW *win, FILE *filep); + +/* quick_echo.c */ +int _quick_echo(WINDOW *win, chtype ch); + +/* raw.c */ +int raw(void); + +/* redrawwin.c */ +int redrawwin(WINDOW *win); + +/* reset_sh.c */ +int reset_shell_mode(void); + +/* resetty.c */ +int resetty(void); + +/* restart.c */ +int restartterm(char * term, int filenum, int *errret); + +/* ring.c */ +int _ring(bool bf); + +/* ripoffline.c */ +int ripoffline(int line, int (*init)(WINDOW *, int)); + +/* savetty.c */ +int savetty(void); + +/* scanw.c */ +int scanw(char *fmt, ...); + +/* scr_all.c */ +int _scr_all(char *file, int which); + +/* scr_dump.c */ +int scr_dump(char *file); + +/* scr_ll_dump.c */ +int scr_ll_dump(FILE *filep); + +/* scr_reset.c */ +int scr_reset(FILE *filep, int type); + +/* scrollok.c */ +int scrollok(WINDOW *win, bool bf); + +/* setcurscreen.c */ +SCREEN *setcurscreen(SCREEN *new); + +/* setcurterm.c */ +TERMINAL *setcurterm(TERMINAL *newterminal); + +/* setecho.c */ +int _setecho(int bf); + +/* setkeymap.c */ +int setkeymap(void); + +/* setnonl.c */ +int _setnonl(int bf); + +/* setqiflush.c */ +void _setqiflush(int yes); + +/* setsyx.c */ +int setsyx(int y, int x); + +/* setupterm.c */ +int setupterm(char *term, int filenum, int *errret); +void _blast_keys(TERMINAL *terminal); +int reset_prog_mode(void); +int def_shell_mode(void); + +/* slk_atroff.c */ +int slk_attroff(chtype a); + +/* slk_atron.c */ +int slk_attron(chtype a); + +/* slk_atrset.c */ +int slk_attrset(chtype a); + +/* slk_clear.c */ +int slk_clear(void); + +/* slk_label.c */ +char *slk_label(int n); + +/* slk_noutref.c */ +int slk_noutrefresh(void); + +/* slk_refresh.c */ +int slk_refresh(void); +int _slk_update(void); + +/* slk_restore.c */ +int slk_restore(void); + +/* slk_set.c */ +int slk_set(int n, char *lab, int f); + +/* slk_start.c */ +int slk_start(int ng, int *gp); + +/* slk_touch.c */ +int slk_touch(void); + +/* start_col.c */ +int start_color(void); + +/* subwin.c */ +WINDOW *subwin(WINDOW *win, int l, int nc, int by, int bx); + +/* syncok.c */ +int syncok(WINDOW *win, bool bf); + +/* tcsearch.c */ +int _tcsearch(char *cap, short offsets[], char *names[], int size, int n); + +/* termattrs.c */ +chtype termattrs(void); + +/* termcap.c */ +int tgetent(char *bp, char *name); +int tgetflag(char *tcstr); +int tgetnum(char *tcstr); +char *tgetstr(char *tcstr, char **area); + +/* termerr.c */ +void termerr(void); + +/* termname.c */ +char *termname(void); + +/* tgetch.c */ +int tgetch(int interpret); + +/* tgetwch.c */ +wchar_t tgetwch(int cntl); + +/* tgoto.c */ +char *tgoto(char *cap, int col, int row); + +/* tifget.c */ +int tifgetflag(char *tistr); +int tifgetnum(char *tistr); +char *tifgetstr(char *tistr); + +/* tifnames.c */ + +/* tiget.c */ +int tigetflag(char *tistr); +int tigetnum(char *tistr); +char *tigetstr(char *tistr); + +/* tinames.c */ + +/* tinputfd.c */ +void tinputfd(int fd); + +/* tnames.c */ + +/* touchwin.c */ +int touchwin(WINDOW *win); + +/* tparm.c */ +char *tparm(char *instring, long fp1, long fp2, long p3, long p4, long p5, + long p6, long p7, long p8, long p9); +char *_branchto(char *cp, char to); + +/* tputs.c */ +int tputs(char *cp, int affcnt, int (*outc)(char)); + +/* trace.c */ +int traceon(void); +int traceoff(void); + +/* tstp.c */ +void _tstp(int dummy); +void _ccleanup(int signo); + +/* ttimeout.c */ +int ttimeout(int delay); + +/* typeahead.c */ +int typeahead(int fd); + +/* unctrl.c */ + +/* ungetch.c */ +int ungetch(int ch); + +/* ungetwch.c */ +int ungetwch(wchar_t code); + +/* untouchwin.c */ +int untouchwin(WINDOW *win); + +/* use_env.c */ +void use_env(int bf); + +/* vidupdate.c */ +void vidupdate(chtype newmode, chtype oldmode, int (*outc)(char)); +int _change_video(chtype newmode, chtype oldmode, int (*outc)(char), + bool color_terminal); +void _change_color(short newcolor, short oldcolor, int (*outc)(char)); + +/* vsscanf.c */ +int _vsscanf(char *buf, char *fmt, va_list ap); + +/* vwprintw.c */ +int vwprintw(WINDOW *win, char *fmt, va_list ap); + +/* vwscanw.c */ +int vwscanw(WINDOW *win, char *fmt, va_list ap); + +/* waddchnstr.c */ +int waddchnstr(WINDOW *win, chtype *string, int ncols); + +/* waddnstr.c */ +int waddnstr(WINDOW *win, char *tstr, int i); + +/* waddnwstr.c */ +int waddnwstr(WINDOW *win, wchar_t *code, int n); + +/* waddwch.c */ +int waddwch(WINDOW *win, chtype c); + +/* waddwchnstr.c */ +int waddwchnstr(WINDOW *win, chtype *string, int ncols); + +/* wadjcurspos.c */ +int wadjcurspos(WINDOW *win); + +/* wbkgd.c */ +int wbkgd(WINDOW *win, chtype nbkgd); + +/* wbkgdset.c */ +void wbkgdset(WINDOW *win, chtype c); + +/* wborder.c */ +int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br); + +/* wclrtobot.c */ +int wclrtobot(WINDOW *win); + +/* wclrtoeol.c */ +int wclrtoeol(WINDOW *win); + +/* wcstombs.c */ +size_t _curs_wcstombs(char *s, const wchar_t *pwcs, size_t n); + +/* wctomb.c */ +int _curs_wctomb(char *s, const wchar_t wchar); + +/* wdelch.c */ +int wdelch(WINDOW *win); + +/* wechowchar.c */ +int wechowchar(WINDOW *win, chtype ch); + +/* wgetch.c */ +int wgetch(WINDOW *win); + +/* wgetstr.c */ +int wgetstr(WINDOW *win, char *str); +int wgetnstr(WINDOW *win, char *str, int n); + +/* wgetwch.c */ +int wgetwch(WINDOW *win); + +/* wgetwstr.c */ +int wgetwstr(WINDOW *win, wchar_t *str); +int wgetnwstr(WINDOW *win, wchar_t *str, int n); + +/* whline.c */ +int whline(WINDOW *win, chtype ch, int num_chars); + +/* winch.c */ +chtype winch(WINDOW *win); + +/* winchnstr.c */ +int winchnstr(WINDOW *win, chtype *string, int ncols); + +/* winchstr.c */ +int winchstr(WINDOW *win, chtype *string); + +/* winnstr.c */ +int winnstr(WINDOW *win, char *string, int ncols); + +/* winnwstr.c */ +int winnwstr(WINDOW *win, wchar_t *wstr, int ncols); + +/* winsch.c */ +int winsch(WINDOW *win, chtype c); + +/* winsdelln.c */ +int winsdelln(WINDOW *win, int id); + +/* winsnstr.c */ +int winsnstr(WINDOW *win, char *tsp, int n); + +/* winsnwstr.c */ +int winsnwstr(WINDOW *win, wchar_t *code, int n); + +/* winstr.c */ +int winstr(WINDOW *win, char *str); + +/* winswch.c */ +int winswch(WINDOW *win, chtype c); + +/* winwch.c */ +chtype winwch(WINDOW *win); + +/* winwchnstr.c */ +int winwchnstr(WINDOW *win, chtype *string, int ncols); + +/* winwstr.c */ +int winwstr(WINDOW *win, wchar_t *wstr); + +/* wmove.c */ +int wmove(WINDOW *win, int y, int x); + +/* wmovenextch.c */ +int wmovenextch(WINDOW *win); + +/* wmoveprevch.c */ +int wmoveprevch(WINDOW *win); + +/* wnoutrefresh.c */ +int wnoutrefresh(WINDOW *win); + +/* wprintw.c */ +int wprintw(WINDOW *win, ...); + +/* wredrawln.c */ +int wredrawln(WINDOW *win, int begline, int numlines); + +/* wrefresh.c */ +int wrefresh(WINDOW *win); + +/* wscanw.c */ +int wscanw(WINDOW *win, ...); + +/* wscrl.c */ +int wscrl(WINDOW *win, int n); + +/* wsetscrreg.c */ +int wsetscrreg(WINDOW *win, int topy, int boty); + +/* wsyncdown.c */ +void wsyncdown(WINDOW *win); + +/* wsyncup.c */ +void wsyncup(WINDOW *win); +void wcursyncup(WINDOW *win); + +/* wtimeout.c */ +void wtimeout(WINDOW *win, int tm); + +/* wtouchln.c */ +int wtouchln(WINDOW *win, int y, int n, int changed); + +/* wvline.c */ +int wvline(WINDOW *win, chtype vertch, int num_chars); + +/* _box.c */ +/* really box32 */ +int box(WINDOW *win, chtype v, chtype h); + +/* V3.box.c */ +#undef box +int box(WINDOW *win, _ochtype v, _ochtype h); + +/* _newterm.c */ +/* really newterm32 */ +SCREEN *newterm(char *type, FILE *fout, FILE *fin); + +/* V3.newterm.c */ +#undef newterm +SCREEN *newterm(char *type, FILE *outfptr, FILE *infptr); + +/* setterm.c */ +#undef setterm +int setterm(char *name); + +/* pechochar.c */ +/* really p32echochar */ +int pechochar(WINDOW *win, chtype c); + +/* V3.pechochar.c */ +#undef pechochar +int pechochar(WINDOW *win, _ochtype c); + +/* waddch.c */ +/* really w32addch */ +int waddch(WINDOW *win, chtype c); + +/* V3.waddch.c */ +#undef waddch +int waddch(WINDOW *win, _ochtype c); + +/* wattroff.c */ +/* really w32attroff */ +int wattroff(WINDOW *win, chtype attrs); + +/* V3.wattroff.c */ +#undef wattroff +int wattroff(WINDOW *win, _ochtype attrs); + +/* wattron.c */ +/* really w32attron */ +int wattron(WINDOW *win, chtype attrs); + +/* V3.wattron.c */ +#undef wattron +int wattron(WINDOW *win, _ochtype attrs); + +/* wattrset.c */ +/* really w32attrset */ +int wattrset(WINDOW *win, chtype attrs); + +/* V3.wattrset.c */ +#undef wattrset +int wattrset(WINDOW *win, _ochtype attrs); + +/* wechochar.c */ +/* really w32echochar */ +int wechochar(WINDOW *win, chtype c); + +/* V3.wechochar.c */ +#undef wechochar +int wechochar(WINDOW *win, _ochtype c); + +/* winsch.c */ +/* really w32insch */ +int winsch(WINDOW *win, chtype c); + +/* V3.winsch.c */ +#undef winsch +int winsch(WINDOW *win, _ochtype c); + +/* putp.c */ +int _outchar(char ch); +int putp(char *str); +/* really vid32attr */ +int vidattr(chtype newmode); + +/* V3.vidattr.c */ +#undef vidattr +int vidattr(_ochtype a); + +/* vidputs.c */ +/* really vid32puts */ +int vidputs(chtype a, int (*b)(char)); + +/* V3.vidputs.c */ +#undef vidputs +int vidputs(_ochtype a, int (*o)(char)); + +/* initscr.c */ +/* really initscr32 */ +WINDOW *initscr(void); + +/* V3.initscr.c */ +#undef initscr +WINDOW *initscr(void); diff --git a/usr/src/lib/libcurses/screen/longname.c b/usr/src/lib/libcurses/screen/longname.c new file mode 100644 index 0000000000..f0c3d2410b --- /dev/null +++ b/usr/src/lib/libcurses/screen/longname.c @@ -0,0 +1,59 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* This routine returns the long name of the terminal. */ + +#include <sys/types.h> +#include <string.h> + +char * +longname(void) +{ + extern char ttytype[]; + char *cp = strrchr(ttytype, '|'); + + if (cp) + return (++cp); + else + return (ttytype); +} diff --git a/usr/src/lib/libcurses/screen/makenew.c b/usr/src/lib/libcurses/screen/makenew.c new file mode 100644 index 0000000000..c9a8301dd4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/makenew.c @@ -0,0 +1,139 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* This routine sets up a window buffer and returns a pointer to it. */ + +WINDOW * +_makenew(int nlines, int ncols, int begy, int begx) +{ + /* order the register allocations against highest usage */ + WINDOW *win; + +#ifdef DEBUG + if (outf) + fprintf(outf, "MAKENEW(%d, %d, %d, %d)\n", + nlines, ncols, begy, begx); +#endif /* DEBUG */ + + if ((win = (WINDOW *) malloc(sizeof (WINDOW))) == NULL) + goto out_no_win; + if ((win->_y = (chtype **) malloc(nlines * sizeof (chtype *))) == NULL) + goto out_win; +#ifdef _VR3_COMPAT_CODE + if ((_y16update) && ((win->_y16 = (_ochtype **) + calloc(1, nlines * sizeof (_ochtype *))) == NULL)) { + goto out_y16; + } +#endif /* _VR3_COMPAT_CODE */ + if ((win->_firstch = (short *) malloc(2 * nlines * sizeof (short))) + == NULL) { +#ifdef _VR3_COMPAT_CODE + if ((_y16update) && (win->_y16 != NULL)) + free((char *) win->_y16); +out_y16: +#endif /* _VR3_COMPAT_CODE */ + free((char *) win->_y); +out_win: + free((char *) win); +out_no_win: + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "_makenew"); +#endif /* DEBUG */ + return ((WINDOW *) NULL); + } else + win->_lastch = win->_firstch + nlines; + + win->_cury = win->_curx = 0; + /*LINTED*/ + win->_maxy = (short) nlines; + /*LINTED*/ + win->_maxx = (short) ncols; + /*LINTED*/ + win->_begy = (short) begy; + /*LINTED*/ + win->_begx = (short) begx; + win->_clear = (((begy + SP->Yabove + begx) == 0) && + (nlines >= (LINES + SP->Yabove)) && (ncols >= COLS)); + win->_leave = win->_scroll = win->_use_idl = win->_use_keypad = + win->_notimeout = win->_immed = win->_sync = FALSE; + win->_use_idc = TRUE; + win->_ndescs = win->_tmarg = 0; + win->_bmarg = nlines - 1; + win->_bkgd = _BLNKCHAR; + win->_delay = win->_parx = win->_pary = -1; + win->_attrs = A_NORMAL; + win->_flags = _WINCHANGED; + win->_parent = win->_padwin = (WINDOW *) NULL; + (void) memset((char *) win->_firstch, 0, (nlines * sizeof (short))); + { + short *lastch = win->_lastch, + *elastch = lastch + nlines; + + ncols--; + while (lastch < elastch) + /*LINTED*/ + *lastch++ = (short) ncols; + } + + win->_insmode = FALSE; + win->_index = 0; + win->_nbyte = -1; + +#ifdef DEBUG + if (outf) { + fprintf(outf, "MAKENEW: win->_clear = %d\n", win->_clear); + fprintf(outf, "MAKENEW: win->_flags = %0.2o\n", win->_flags); + fprintf(outf, "MAKENEW: win->_maxy = %d\n", win->_maxy); + fprintf(outf, "MAKENEW: win->_maxx = %d\n", win->_maxx); + fprintf(outf, "MAKENEW: win->_begy = %d\n", win->_begy); + fprintf(outf, "MAKENEW: win->_begx = %d\n", win->_begx); + } +#endif /* DEBUG */ + return (win); +} diff --git a/usr/src/lib/libcurses/screen/maketerm.ed b/usr/src/lib/libcurses/screen/maketerm.ed new file mode 100644 index 0000000000..8951e4276d --- /dev/null +++ b/usr/src/lib/libcurses/screen/maketerm.ed @@ -0,0 +1,612 @@ +!#ident "%Z%%M% %I% %E% SMI" +H +!rm -f bool num str boolnames numnames strnames boolvals numvals strvals tnames.c tinames.c tifnames.c term.h ./tmp/term.h.new ./tmp/tmp.awk ./tmp/term.h +e caps +g/^#/d +/--- begin bool/+1,/--- end bool/-1 w bool +/--- begin num/+1,/--- end num/-1 w num +/--- begin str/+1,/--- end str/-1 w str +E bool +1,$s/" .*/", / +1,$s/.* "/"/ +1,$-10g/^/.,+9j ++,$j +1i +char *boolnames[] = + { +. +$a +0 + }; + +. +w tinames.c +e bool +1,$s/^[^"]*"[^"]*".// +1,$s/" .*/", / +1,$-10g/^/.,+9j ++,$j +1i +char *boolcodes[] = + { +. +$a +0 + }; + +. +w tnames.c +e bool +1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", / +1,$-4g/^/.,+3j ++,$j +1i +char *boolfnames[] = + { +. +$a +0 + }; + +. +w tifnames.c +e bool +1,$s;"[^"]*"[ ]*".." ;/* ; +1,$s;$; */; +1,$s;^; ; +1i + char +. +$a + Sentinel; /* End of bools. DO NOT MOVE! */ +. +w boolvals +e num +1,$s/" .*/", / +1,$s/.* "/"/ +1,$-10g/^/.,+9j ++,$j +1i +char *numnames[] = + { +. +$a +0 + }; + +. +0r tinames.c +w tinames.c +e num +1,$s/^[^"]*"[^"]*".// +1,$s/" .*/", / +1,$-10g/^/.,+9j ++,$j +1i +char *numcodes[] = + { +. +$a +0 + }; + +. +0r tnames.c +w tnames.c +e num +1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", / +1,$-4g/^/.,+3j ++,$j +1i +char *numfnames[] = + { +. +$a +0 + }; + +. +0r tifnames.c +w tifnames.c +e num +1,$s;"[^"]*"[ ]*".." ;/* ; +1,$s;$; */; +1,$s;^; ; +1i + short +. +$a + Sentinel; /* End of nums. DO NOT MOVE! */ +. +w numvals +e str +1,$s/" .*/", / +1,$s/.* "/"/ +1,$-10g/^/.,+9j ++,$j +1i +char *strnames[] = + { +. +$a +0 + }; + +. +0r tinames.c +w tinames.c +e str +1,$s/^[^"]*"[^"]*".// +1,$s/" .*/", / +1,$-10g/^/.,+9j ++,$j +1i +char *strcodes[] = + { +. +$a +0 + }; + +. +0r tnames.c +w tnames.c +e str +1,$s/^\([a-z][0-9a-z_]*\),.*/"\1", / +1,$-4g/^/.,+3j ++,$j +1i +char *strfnames[] = + { +. +$a +0 + }; + +. +0r tifnames.c +w tifnames.c +e str +1,$s;"[^"]*"[ ]*".." ;/* ; +1,$s;$; */; +1,$s;^; strs.; +$a + Sentinel; /* End of strings. DO NOT MOVE! */ +. +w strvals +1,$d +r tnames.c +1i +#pragma ident "%Z%%M% %I% %E% SMI" + +/* tnames.c: Made automatically from caps and maketerm.ed - don't edit me! */ +. +1,$s/ $// +0r copyright.h +/copyright\.h/d +w tnames.c +1,$d +r tinames.c +1i +#pragma ident "%Z%%M% %I% %E% SMI" + +/* tinames.c: Made automatically from caps and maketerm.ed - don't edit me! */ +. +1,$s/ $// +0r copyright.h +/copyright\.h/d +w tinames.c +1,$d +r tifnames.c +1i +#pragma ident "%Z%%M% %I% %E% SMI" + +/* tifnames.c: Made automatically from caps and maketerm.ed - don't edit me! */ +. +1,$s/ $// +0r copyright.h +/copyright\.h/d +w tifnames.c +e bool +1,$d +a + +typedef char *charptr; +struct strs { + charptr +. +r strvals +1,.s/strs\.// +$a +}; + +struct _bool_struct { +. +r boolvals +a +}; + +struct _num_struct { +. +r numvals +a +}; +. +w ./tmp/term.h.new +e ./tmp/term.h.new +g/^ ./s/^ / _/ +w ./tmp/term.h.new +e boolvals +.kb +.r numvals +.kn +1,$v/^ /d +1,$s/^ // +1,$s/ [^ ].*/ / +1,$s/,/ / +1,'bs/.*/#define & CURB _&/ +'b+1,'ns/.*/#define & CURN _&/ +1,$g/;/d +w ./tmp/term.h.new2 +e strvals +1,$v/^ /d +1,$s/^ // +1,$s/ [^ ].*/ / +1,$s/,/ / +1,$s/.*/#define & CURS _&/ +1,$s/strs\.// +1,$s/strs.\(.\)/strs._\1/ +1,$g/;/d +w +e ./tmp/term.h.new2 +$r strvals +w ./tmp/term.h.new1 +e ./tmp/term.h.new1 +$r ./tmp/term.h.new +w ./tmp/term.h.new +e ./tmp/term.h.new +1,$s/[ ]*$// +1,$s/CURS _strs/CURS strs/ +w ./tmp/term.h.new +e ./tmp/term.h.new +1;/CURS strs/+100;.,+99s/CURS strs/CURS strs2/ +.+1,+100s/CURS strs/CURS strs3/ +.+1,$s/CURS strs/CURS strs4/ +/^struct strs/+101s/,/;/ +a +}; + +struct strs2 { + charptr +. ++100s/,/;/ +a +}; + +struct strs3 { + charptr +. ++100s/,/;/ +a +}; + +struct strs4 { + charptr +. +1,$s/_Sentinel/Sentinel/ +w ./tmp/term.h.new +e ./tmp/term.h.new +g/[ .]_cursor_/s/_cursor_/_crsr_/ +g/[ .]_delete_/s/_delete_/_dlt_/ +g/[ .]_enter_/s/_enter_/_entr_/ +g/[ .]_insert_/s/_insert_/_ins_/ +g/[ .]_key_/s/_key_/_ky_/ +g/[ .]_keypad_/s/_keypad_/_kpad_/ +g/[ .]_label_/s/_label_/_labl_/ +g/[ .]_memory_/s/_memory_/_mem_/ +g/[ .]_parm_/s/_parm_/_prm_/ +g/[ .]_scroll_/s/_scroll_/_scrll_/ +g/^ _......[,;] \//s/, /,/ +g/^ _..............[,;] \//s/, /,/ +g/^ _......................[,;] \//s/, /,/ +w ./tmp/term.h.new +e ./tmp/term.h.new +!# the following lines GO away when Vr2 compat code goes away +1;/^#define auto_left_margin/,/^#define xon_xoff/s/CURB.*/CUR _b/ +1;/^#define auto_left_margin/,/^#define xon_xoff/w ./tmp/tmp.term.h +1;/^#define auto_left_margin/,/^#define xon_xoff/d +!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk +.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h +1;/^#define columns/,/^#define width_status_line/s/CURN.*/CUR _c/ +1;/^#define columns/,/^#define width_status_line/w ./tmp/tmp.term.h +1;/^#define columns/,/^#define width_status_line/d +!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk +.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h +1;/^#define back_tab/,/^#define lab_f8/s/CURS.*/CUR _Vr2_Astrs._s/ +1;/^#define back_tab/,/^#define lab_f8/w ./tmp/tmp.term.h +1;/^#define back_tab/,/^#define lab_f8/d +!/usr/bin/echo '{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk +.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h +1;/^#define lab_f9/,/^#define prtr_non/s/CURS.*/CUR _Vr2_Bstrs._s/ +1;/^#define lab_f9/,/^#define prtr_non/w ./tmp/tmp.term.h +1;/^#define lab_f9/,/^#define prtr_non/d +!/usr/bin/echo 'BEGIN{i=100}\n{printf "\%s\%d\\n", $0,++i}' > ./tmp/tmp.awk +.-1r !awk -f ./tmp/tmp.awk < ./tmp/tmp.term.h +!rm -f ./tmp/tmp.term.h ./tmp/tmp.awk +w ./tmp/term.h.new +e ./tmp/term.h.new +!# Vr2 compat code ends here +1i +#ifndef _TERM_H +#define _TERM_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * term.h - this file is automatically made from caps and maketerm.ed. + * Don't make changes directly to term.h. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +. +$a + +struct _str_struct { + struct strs strs; + struct strs2 strs2; + struct strs3 strs3; + struct strs4 strs4; +}; + +#define NUM_ATTRIBUTES 9 +#define UNACCESSIBLE 1 +#define NO_TERMINAL 2 +#define CORRUPTED 3 +#define ENTRY_TOO_LONG 4 +#define TERMINFO_TOO_LONG 5 +#define TERM_BAD_MALLOC 6 +#define NOT_READABLE 7 +#define _VR2_COMPAT_CODE +#ifdef _VR2_COMPAT_CODE +struct _Vr2_Astrs { + charptr + _s1, _s2, _s3, _s4, _s5, _s6, _s7, _s8, _s9, _s10, + _s11, _s12, _s13, _s14, _s15, _s16, _s17, _s18, _s19, _s20, + _s21, _s22, _s23, _s24, _s25, _s26, _s27, _s28, _s29, _s30, + _s31, _s32, _s33, _s34, _s35, _s36, _s37, _s38, _s39, _s40, + _s41, _s42, _s43, _s44, _s45, _s46, _s47, _s48, _s49, _s50, + _s51, _s52, _s53, _s54, _s55, _s56, _s57, _s58, _s59, _s60, + _s61, _s62, _s63, _s64, _s65, _s66, _s67, _s68, _s69, _s70, + _s71, _s72, _s73, _s74, _s75, _s76, _s77, _s78, _s79, _s80, + _s81, _s82, _s83, _s84, _s85, _s86, _s87, _s88, _s89, _s90, + _s91, _s92, _s93, _s94, _s95, _s96, _s97, _s98, _s99, _s100; +}; + +struct _Vr2_Bstrs { + charptr + _s101, _s102, _s103, _s104, _s105, _s106, _s107, _s108, _s109, _s110, + _s111, _s112, _s113, _s114, _s115, _s116, _s117, _s118, _s119, _s120, + _s121, _s122, _s123, _s124, _s125, _s126, _s127, _s128, _s129, _s130, + _s131, _s132, _s133, _s134, _s135, _s136, _s137, _s138, _s139, _s140, + _s141, _s142, _s143, _s144, _s145; +}; +#endif /* _VR2_COMPAT_CODE */ + +typedef struct { + char *_sends; /* Characters sent when key is pressed */ + short _keyval; /* "char" we pass back to program */ +} _KEY_MAP; + +typedef struct { + short foreground; /* foreground color */ + short background; /* background color */ + bool init; /* TRUE if pair was initialized */ +} _Color_pair; + + +typedef struct { + short r, g, b; +} _Color; + + +/* + * This definition for the term struct allows the boolean, number + * and string information to grow in the future and still allow .o + * compatibility. + */ + +struct term { +#ifdef _VR2_COMPAT_CODE + char + _b1, _b2, _b3, _b4, _b5, _b6, _b7, _b8, _b9, _b10, + _b11, _b12, _b13, _b14, _b15, _b16, _b17, _b18, _b19, _b20, _b21; + short + _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8; + struct _Vr2_Astrs _Vr2_Astrs; + struct _Vr2_Bstrs _Vr2_Bstrs; +#endif /* _VR2_COMPAT_CODE */ + short Filedes; /* file descriptor being written to */ + SGTTY Ottyb, /* original state of the terminal */ + Nttyb; /* current state of the terminal */ +#ifdef SYSV + SGTTYS Ottybs, /* original state of the terminal */ + Nttybs; /* current state of the terminal */ +#endif +#ifdef DIOCSETT + struct termcb new, old; /* CB/UNIX virtual terminals */ +#endif +#ifdef LTILDE + int newlmode, oldlmode; /* BSD tty driver */ +#endif + /* end of Vr2 structure */ + struct _bool_struct *_bools; + struct _num_struct *_nums; + struct _str_struct *_strs; + char *_strtab; +#ifdef FIONREAD + long timeout; /* for BSD halfdelay mode */ +#endif + /* end of Vr3 structure */ + chtype sgr_mode; /* current phys. graphic rendition */ + chtype sgr_faked; /* attributes faked by vidputs */ + int _delay; /* timeout for inputs */ + int _inputfd; /* input file descriptor */ + int _check_fd; /* typeahead file descriptor */ + _KEY_MAP **_keys, /* key map */ + *internal_keys; /* pointer to free key structures */ + short _ksz, /* size of keymap */ + _lastkey_ordered, /* where the last ordered key is */ + _lastmacro_ordered, /* where last ordered macro is */ + _first_macro; + bool funckeystarter[0400]; + /* map of which chars start fn keys */ + bool _fl_rawmode, /* in cbreak(=1) or raw(=2) mode */ + fl_typeahdok, /* ok to use typeahead */ + _cursorstate, /* cursor: 0=invis, 1=norm, 2=vvis */ + _iwait; /* true if input-pending */ + short _regs[26]; /* tparm static registers */ +#define INP_QSIZE 32 + chtype /* a place to put stuff ungetch'ed */ + _input_queue[INP_QSIZE]; + short _ungotten; /* # chars ungotten by ungetch() */ + char _chars_on_queue; /* # chars on queue */ +#ifdef _VR3_COMPAT_CODE + _ochtype *_acsmap; + chtype *_acs32map; /* map of alternate char set chars */ +#else /* _VR3_COMPAT_CODE */ + chtype *_acsmap; /* map of alternate char set chars */ +#endif /* _VR3_COMPAT_CODE */ + char *turn_on_seq[NUM_ATTRIBUTES]; + chtype bit_vector; + char *cursor_seq[3]; + char _termname[15]; + char *turn_off_seq[3]; + chtype check_turn_off; + chtype non_faked_mode; + _Color_pair _cur_pair; + _Color_pair *_pairs_tbl; + _Color *_color_tbl; +}; + +typedef struct term TERMINAL; + +/* allow old names for these capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso + +extern TERMINAL *cur_term; +extern struct _bool_struct *cur_bools; +extern struct _num_struct *cur_nums; +extern struct _str_struct *cur_strs; + +#ifdef SINGLE +extern TERMINAL _first_term; +extern struct _bool_struct _frst_bools; +extern struct _num_struct _frst_nums; +extern struct _str_struct _frst_strs; + +#define CUR _first_term. +#define CURB _frst_bools. +#define CURN _frst_nums. +#define CURS _frst_strs. +#define PROGTTY _first_term.Nttyb +#define SHELLTTY _first_term.Ottyb +#ifdef SYSV +#define PROGTTYS _first_term.Nttybs +#define SHELLTTYS _first_term.Ottybs +#endif +#else +#define CUR cur_term-> +#define CURB cur_bools-> +#define CURN cur_nums-> +#define CURS cur_strs-> +#define PROGTTY (cur_term->Nttyb) +#define SHELLTTY (cur_term->Ottyb) +#ifdef SYSV +#define PROGTTYS (cur_term->Nttybs) +#define SHELLTTYS (cur_term->Ottybs) +#endif +#endif + +#ifndef NOMACROS +#define set_curterm setcurterm +#define del_curterm delterm +#else /* NOMACROS */ + +#ifdef __STDC__ +extern TERMINAL *set_curterm(TERMINAL *); +extern int del_curterm(TERMINAL *); +#else /* __STDC__ */ +extern TERMINAL *set_curterm(); +extern int del_curterm(); +#endif /* __STDC__ */ + +#endif /* NOMACROS */ + +extern short term_errno; + +#ifdef SYSV +extern int prog_istermios; +extern int shell_istermios; +#endif + +extern char term_parm_err[], *term_err_strings[], *Def_term, + *boolnames[], *boolcodes[], *boolfnames[], + *numnames[], *numcodes[], *numfnames[], + *strnames[], *strcodes[], *strfnames[]; + +#ifdef __STDC__ +extern TERMINAL *setcurterm(TERMINAL *); + +#if defined(_XPG4_2) || defined(_LP64) || defined(__cplusplus) +extern char + *tparm(char *, long, long, long, long, long, long, long, long, long); +#else +/* this is wrong, but is needed for historical reasons */ +extern char *tparm(); +#endif + +extern char *tgetstr(char *, char **), + *tigetstr(char *), + *termname(void); + +extern int tgetent(char *, char *), tgetflag(char *), tgetnum(char *), + tputs(char *, int, int (*)(char)), putp(char *), + tigetint(char *), tigetflag(char *), tigetnum(char *), + vidputs(chtype, int (*)(char)), vidattr(chtype); + +extern int resetterm(void), fixterm(void), saveterm(void), + restartterm(char *, int, int *), delterm(TERMINAL *); + +extern void termerr(void), tinputfd(int); +#else /* __STDC__ */ +extern TERMINAL *setcurterm(); +extern char *tparm(), *tgoto(), *tgetstr(), *tigetstr(), + *termname(); + +extern int tgetent(), tgetflag(), tgetnum(), + tigetint(), tigetflag(), tigetnum(), + tputs(), putp(), vidputs(), vidattr(); + +extern int resetterm(), fixterm(), saveterm(), + restartterm(), delterm(); + +extern void termerr(), tinputfd(); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TERM_H */ +. +0r copyright.h +/copyright\.h/d +1,$s/\@(\#)maketerm.ed/\@(\#)term.h/ +1,$s/,\/\*/, \/\*/ +w term.h +!rm -f boolnames boolvals bool numnames numvals num strnames strvals str ./tmp/term.h.new ./tmp/tmp.awk ./tmp/tmp.term.h +q diff --git a/usr/src/lib/libcurses/screen/mbaddch.c b/usr/src/lib/libcurses/screen/mbaddch.c new file mode 100644 index 0000000000..b4807f5fa8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbaddch.c @@ -0,0 +1,262 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Clear the space occupied by a multicolumn character + */ + +int +_mbclrch(WINDOW *win, int y, int x) +{ + chtype *wcp, *ep, *wp, wc; + + /* ASSERT(_scrmax > 1); */ + + wcp = win->_y[y]; + wp = wcp + x; + + /* compute the bounds for the character */ + if (ISCBIT(*wp)) { + for (; wp >= wcp; --wp) + if (!ISCBIT(*wp)) + break; + if (wp < wcp) + return (ERR); + } + wc = RBYTE(*wp); + ep = wp + _curs_scrwidth[TYPE(wc)]; + if (ep > wcp + win->_maxx) + return (ERR); + + /* update the change structure */ + /*LINTED*/ + if ((x = (int)(wp - wcp)) < win->_firstch[y]) + /*LINTED*/ + win->_firstch[y] = (short)x; + /*LINTED*/ + if ((x = (int)(ep - wcp) - 1) > win->_lastch[y]) + /*LINTED*/ + win->_lastch[y] = (short)x; + + /* clear the character */ + for (; wp < ep; ++wp) + *wp = win->_bkgd; + return (OK); +} + + + +/* + * Make sure the window cursor point to a valid place. + * If win->_insmode or isedge, the cursor has to + * point to the start of a whole character; otherwise, the + * cursor has to point to a part of a whole character. + */ + +int +_mbvalid(WINDOW *win) +{ + chtype *wp, *wcp, *ecp, wc; + int x; + bool isedge; + + /* ASSERT(_scrmax > 1); */ + + x = win->_curx; + wcp = win->_y[win->_cury]; + wp = wcp + x; + if (!ISMBIT(*wp)) + return (OK); + + ecp = wcp + win->_maxx; + isedge = FALSE; + + /* make wp points to the start column of a mb-character */ + if (ISCBIT(*wp)) { + for (; wp >= wcp; --wp) + if (!ISCBIT(*wp)) + break; + if (wp < wcp) { + for (wp = wcp + x + 1; wp < ecp; ++wp) + if (!ISCBIT(*wp)) + break; + if (wp >= ecp) + return (ERR); + isedge = TRUE; + } + } + + /* make sure that wp points to a whole character */ + wc = RBYTE(*wp); + if (wp + _curs_scrwidth[TYPE(wc)] > ecp) { + for (wp -= 1; wp >= wcp; --wp) + if (!ISCBIT(*wp)) + break; + if (wp < wcp) + return (ERR); + isedge = TRUE; + } + + if (isedge || win->_insmode) + /*LINTED*/ + win->_curx = (short)(wp-wcp); + return (OK); +} + + + +/* + * Add/insert multi-byte characters + */ + +int +_mbaddch(WINDOW *win, chtype a, chtype c) +{ + int n, x, y, nc, m, len, nbyte, ty; + chtype *wcp, wc; + char *wch, rc[2]; + + /* ASSERT(_mbtrue); */ + + /* decode the character into a sequence of bytes */ + nc = 0; + if (ISCBIT(c)) + /*LINTED*/ + rc[nc++] = (char)(LBYTE(c)|MBIT); + if (ISMBIT(c)) + /*LINTED*/ + rc[nc++] = (char)RBYTE(c); + + a |= win->_attrs; + + /* add the sequence to the image */ + for (n = 0; n < nc; ++n) { + wc = RBYTE(rc[n]); + ty = TYPE(wc); + wch = win->_waitc; + + /* first byte of a multi-byte character */ + if (ty > 0 || win->_nbyte < 0) { + /*LINTED*/ + wch[0] = (char)wc; + win->_nbyte = cswidth[ty] + (ty == 0 ? 0 : 1); + win->_index = 1; + } else { + /* non-first byte */ + /*LINTED*/ + wch[win->_index] = (char)wc; + win->_index += 1; + } + + /* if character is not ready to process */ + if (win->_index < win->_nbyte) + continue; + + /* begin processing the character */ + nbyte = win->_nbyte; + win->_nbyte = -1; + wc = RBYTE(wch[0]); + len = _curs_scrwidth[TYPE(wc)]; + + /* window too small or char cannot be stored */ + if (len > win->_maxx || 2*len < nbyte) + continue; + + /* if the character won't fit into the line */ + if ((win->_curx + len) > win->_maxx && + (win->_insmode || waddch(win, '\n') == ERR)) + continue; + + y = win->_cury; + x = win->_curx; + wcp = win->_y[y] + x; + + if (win->_insmode) { + /* perform the right shift */ + if (_mbinsshift(win, len) == ERR) + continue; + } else if (_scrmax > 1) { + /* clear any multi-byte char about to be overwritten */ + for (m = 0; m < len; ++m) + if (ISMBIT(wcp[m]) && + _mbclrch(win, y, x + m) == ERR) + break; + if (m < len) + continue; + } + + /* pack two bytes at a time */ + for (m = nbyte/2; m > 0; m -= 1, wch += 2) + *wcp++ = _CHAR((RBYTE(wch[1]) << 8) | + RBYTE(wch[0])) | CBIT | a; + + /* do the remaining byte if any */ + if ((nbyte%2) != 0) + *wcp++ = RBYTE(wch[0]) | CBIT | a; + + /* fill-in for remaining display columns */ + for (m = (nbyte / 2) + (nbyte % 2); m < len; ++m) + *wcp++ = (CBIT|MBIT) | a; + + /* the first column has Continue BIT off */ + win->_y[y][x] &= ~CBIT; + + if (win->_insmode == FALSE) { + if (x < win->_firstch[y]) + /*LINTED*/ + win->_firstch[y] = (short)x; + if ((x += len-1) >= win->_maxx) + x = win->_maxx-1; + if (x > win->_lastch[y]) + /*LINTED*/ + win->_lastch[y] = (short)x; + + if ((win->_curx += len) >= win->_maxx) { + if (y >= (win->_maxy-1) || y == win->_bmarg) { + win->_curx = win->_maxx-1; + if (wscrl(win, 1) == ERR) + continue; + } else { + win->_cury += 1; + win->_curx = 0; + } + } + } + } + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/mbcharlen.c b/usr/src/lib/libcurses/screen/mbcharlen.c new file mode 100644 index 0000000000..48a7a6a54f --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbcharlen.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get the # of valid characters + */ + +int +mbcharlen(char *sp) +{ + int n, m, k, ty; + chtype c; + + n = 0; + for (; *sp != '\0'; ++sp, ++n) + if (ISMBIT(*sp)) { + c = RBYTE(*sp); + ty = TYPE(c & 0377); + m = cswidth[ty] - (ty == 0 ? 1 : 0); + for (sp += 1, k = 1; *sp != '\0' && k <= m; ++k, + ++sp) { + c = RBYTE(*sp); + if (TYPE(c) != 0) + break; + } + if (k <= m) + break; + } + return (n); +} diff --git a/usr/src/lib/libcurses/screen/mbdisplen.c b/usr/src/lib/libcurses/screen/mbdisplen.c new file mode 100644 index 0000000000..62660a26b3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbdisplen.c @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get the display length of a string. + */ + +int +mbdisplen(char *sp) +{ + int n, m, k, ty; + chtype c; + + n = 0; + for (; *sp != '\0'; ++sp) { + if (!ISMBIT(*sp)) + ++n; + else { + c = RBYTE(*sp); + ty = TYPE(c & 0377); + m = cswidth[ty] - (ty == 0 ? 1 : 0); + for (sp += 1, k = 1; *sp != '\0' && k <= m; + ++k, ++sp) { + c = RBYTE(*sp); + if (TYPE(c) != 0) + break; + } + if (k <= m) + break; + n += _curs_scrwidth[ty]; + } + } + return (n); +} diff --git a/usr/src/lib/libcurses/screen/mbgetwidth.c b/usr/src/lib/libcurses/screen/mbgetwidth.c new file mode 100644 index 0000000000..04ceb3a8a0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbgetwidth.c @@ -0,0 +1,116 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include <sys/types.h> +#include <ctype.h> + +#define CSWIDTH 514 + +short cswidth[4] = {-1, 1, 1, 1}; /* character length */ +short _curs_scrwidth[4] = {1, 1, 1, 1}; /* screen width */ + +/* + * This function is called only once in a program. + * Before cgetwidth() is called, setlocale() must be called. + */ + +void +mbgetwidth(void) +{ + unsigned char *cp = &__ctype[CSWIDTH]; + + cswidth[0] = cp[0]; + cswidth[1] = cp[1]; + cswidth[2] = cp[2]; + _curs_scrwidth[0] = cp[3]; + _curs_scrwidth[1] = cp[4]; + _curs_scrwidth[2] = cp[5]; + +} + +int +mbeucw(int c) +{ + c &= 0xFF; + + if (c & 0x80) { + if (c == SS2) { + return (cswidth[1]); + } else if (c == SS3) { + return (cswidth[2]); + } + return (cswidth[0]); + } + return (1); +} + +int +mbscrw(int c) +{ + c &= 0xFF; + + if (c & 0x80) { + if (c == SS2) { + return (_curs_scrwidth[1]); + } else if (c == SS3) { + return (_curs_scrwidth[2]); + } + return (_curs_scrwidth[0]); + } + return (1); +} + +int +wcscrw(wchar_t wc) +{ + int rv; + + switch (wc & EUCMASK) { + case P11: /* Code set 1 */ + rv = _curs_scrwidth[0]; + break; + case P01: /* Code set 2 */ + rv = _curs_scrwidth[1]; + break; + case P10: /* Code set 3 */ + rv = _curs_scrwidth[2]; + break; + default : /* Code set 0 */ + rv = 1; + break; + } + + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/mbinch.c b/usr/src/lib/libcurses/screen/mbinch.c new file mode 100644 index 0000000000..3f2127e0da --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbinch.c @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get the(y, x) character of a window and + * return it in a 0-terminated string. + */ +char +*wmbinch(WINDOW *win, int y, int x) +{ + short savx, savy; + int k; + chtype *wp, *ep, wc; + static char rs[CSMAX + 1]; + + k = 0; + savx = win->_curx; + savy = win->_cury; + + if (wmbmove(win, y, x) == ERR) + goto done; + wp = win->_y[win->_cury] + win->_curx; + wc = RBYTE(*wp); + ep = wp + _curs_scrwidth[TYPE(wc & 0377)]; + + for (; wp < ep; ++wp) { + if ((wc = RBYTE(*wp)) == MBIT) + break; + /*LINTED*/ + rs[k++] = (char)wc; + if ((wc = LBYTE(*wp)|MBIT) == MBIT) + break; + /*LINTED*/ + rs[k++] = (char)wc; + } +done : + win->_curx = savx; + win->_cury = savy; + rs[k] = '\0'; + return (rs); +} diff --git a/usr/src/lib/libcurses/screen/mbinsshift.c b/usr/src/lib/libcurses/screen/mbinsshift.c new file mode 100644 index 0000000000..9bcb51744e --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbinsshift.c @@ -0,0 +1,102 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Shift right an interval of characters + */ + +int +_mbinsshift(WINDOW *win, int len) +{ + int x, y, maxx, mv; + chtype *wcp, *wp, *ep; + + y = win->_cury; + x = win->_curx; + maxx = win->_maxx; + wcp = win->_y[y]; + + /* ASSERT(!ISCBIT(wcp[x])); */ + + /* shift up to a whole character */ + if (_scrmax > 1) { + wp = wcp + maxx - 1; + if (ISMBIT(*wp)) { + reg chtype rb; + + for (; wp >= wcp; --wp) + if (!ISCBIT(*wp)) + break; + if (wp < wcp) + return (ERR); + rb = RBYTE(*wp); + if ((wp + _curs_scrwidth[TYPE(rb)]) > (wcp + maxx)) + /*LINTED*/ + maxx = (int)(wp - wcp); + } + } + + /* see if any data need to move */ + if ((mv = maxx - (x+len)) <= 0) + return (OK); + + /* the end of the moved interval must be whole */ + if (ISCBIT(wcp[x + mv])) + (void) _mbclrch(win, y, x + mv - 1); + + /* move data */ + ep = wcp + x + len; + for (wp = wcp + maxx - 1; wp >= ep; --wp) + *wp = *(wp - len); + + /* clear a possible partial multibyte character */ + if (ISMBIT(*wp)) + for (ep = wp; ep >= wcp; --ep) { + mv = (int)(ISCBIT(*ep)); + *ep = win->_bkgd; + if (!mv) + break; + } + + /* update the change structure */ + if (x < win->_firstch[y]) + /*LINTED*/ + win->_firstch[y] = (short)x; + win->_lastch[y] = maxx - 1; + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/mbmove.c b/usr/src/lib/libcurses/screen/mbmove.c new file mode 100644 index 0000000000..a40ecbcbe0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbmove.c @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Move(cury, curx) of win to(y, x). + * It is guaranteed that the cursor is left at the start + * of a whole character nearest to(y, x). + */ + +int +wmbmove(WINDOW *win, int y, int x) +{ + chtype *wcp, *wp, *ep; + + if (y < 0 || x < 0 || y >= win->_maxy || x >= win->_maxx) + return (ERR); + + if (_scrmax > 1) { + wcp = win->_y[y]; + wp = wcp + x; + ep = wcp + win->_maxx; + + /* make wp points to the start of a character */ + if (ISCBIT(*wp)) { + for (; wp >= wcp; --wp) + if (!ISCBIT(*wp)) + break; + if (wp < wcp) { + wp = wcp+x+1; + for (; wp < ep; ++wp) + if (!ISCBIT(*wp)) + break; + } + } + + /* make sure that the character is whole */ + if (wp + _curs_scrwidth[TYPE(*wp)] > ep) + return (ERR); + + /* the new x position */ + /*LINTED*/ + x = (int)(wp - wcp); + } + + if (y != win->_cury || x != win->_curx) { + win->_nbyte = -1; + /*LINTED*/ + win->_cury = (short)y; + /*LINTED*/ + win->_curx = (short)x; + } + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/mbstowcs.c b/usr/src/lib/libcurses/screen/mbstowcs.c new file mode 100644 index 0000000000..c8cb391e6d --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbstowcs.c @@ -0,0 +1,54 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <widec.h> +#include <sys/types.h> +#include "synonyms.h" +#include <stdlib.h> +#include "curses_inc.h" + +size_t +_curs_mbstowcs(wchar_t *pwcs, const char *s, size_t n) +{ + int i, val; + + for (i = 0; i < n; i++) { + if ((val = _curs_mbtowc(pwcs++, s, MB_CUR_MAX)) == -1) + return (val); + if (val == 0) + break; + s += val; + } + return (i); +} diff --git a/usr/src/lib/libcurses/screen/mbtowc.c b/usr/src/lib/libcurses/screen/mbtowc.c new file mode 100644 index 0000000000..836faf34c1 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbtowc.c @@ -0,0 +1,92 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <widec.h> +#include "synonyms.h" +#include <ctype.h> +#include <sys/types.h> +#include "curses_wchar.h" + +int +_curs_mbtowc(wchar_t *wchar, const char *s, size_t n) +{ + int length, c; + wchar_t intcode; + char *olds = (char *)s; + wchar_t mask; + + if (s == (char *)0) + return (0); + if (n == 0) + return (-1); + c = (unsigned char)*s++; + if (c < 0200) { + if (wchar) + *wchar = c; + return (c ? 1 : 0); + } + intcode = 0; + if (c == SS2) { + if ((length = eucw2) == 0) + goto lab1; + mask = P01; + goto lab2; + } else if (c == SS3) { + if ((length = eucw3) == 0) + goto lab1; + mask = P10; + goto lab2; + } +lab1: + if (iscntrl(c)) { + if (wchar) + *wchar = c; + return (1); + } + length = eucw1 - 1; + mask = P11; + intcode = c & 0177; +lab2: + if (length + 1 > n || length < 0) + return (-1); + while (length--) { + if ((c = (unsigned char)*s++) < 0200 || iscntrl(c)) + return (-1); + intcode = (intcode << 7) | (c & 0x7F); + } + if (wchar) + *wchar = intcode | mask; + /*LINTED*/ + return ((int) (s - olds)); +} diff --git a/usr/src/lib/libcurses/screen/mbtranslate.c b/usr/src/lib/libcurses/screen/mbtranslate.c new file mode 100644 index 0000000000..13a1947c53 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mbtranslate.c @@ -0,0 +1,152 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + + +/* + * Translate process code to byte-equivalent + * Return the length of the byte-equivalent string + */ + +/* + * use _curs_wctomb() instead of _code2byte(code, bytes) + */ + + +/* + * Translate a set of byte to a single process code + */ + +/* + * use _curs_mbtowc() instead of wchar_t _byte2code(bytes) + */ + + +/* + * Translate a string of wchar_t to a byte string. + * code: the input code string + * byte: if not NULL, space to store the output string + * n: maximum number of codes to be translated. + */ +char +*_strcode2byte(wchar_t *code, char *byte, int n) +{ + char *bufp; + wchar_t *endcode; + static char *buf; + static int bufsize; + + /* compute the length of the code string */ + if (n < 0) + for (n = 0; code[n] != 0; ++n) + ; + + /* get space to store the translated string */ + if (!byte && (n*CSMAX+1) > bufsize) { + if (buf) + free(buf); + bufsize = n * CSMAX + 1; + if ((buf = malloc(bufsize * sizeof (char))) == NULL) + bufsize = 0; + } + + /* no space to do it */ + if (!byte && !buf) + return (NULL); + + /* start the translation */ + bufp = byte ? byte : buf; + endcode = code+n; + while (code < endcode && *code) { + bufp += _curs_wctomb(bufp, *code & TRIM); + ++code; + } + *bufp = '\0'; + + return (byte ? byte : buf); +} + + + +/* + * Translate a byte-string to a wchar_t string. + */ +wchar_t +*_strbyte2code(char *byte, wchar_t *code, int n) +{ + char *endbyte; + wchar_t *bufp; + static wchar_t *buf; + static int bufsize; + + if (n < 0) + for (n = 0; byte[n] != '\0'; ++n) + ; + + if (!code && (n + 1) > bufsize) { + if (buf) + free((char *)buf); + bufsize = n + 1; + if ((buf = (wchar_t *)malloc(bufsize * sizeof (wchar_t))) == + NULL) + bufsize = 0; + } + + if (!code && !buf) + return (NULL); + + bufp = code ? code : buf; + endbyte = byte + n; + + while (byte < endbyte && *byte) { + int type, width; + wchar_t wchar; + + type = TYPE(*byte & 0377); + width = cswidth[type]; + if (type == 1 || type == 2) + width++; + + if (byte + width <= endbyte) { + (void) _curs_mbtowc(&wchar, byte, width); + *bufp++ = wchar; + } + + byte += width; + } + *bufp = 0; + + return (code ? code : buf); +} diff --git a/usr/src/lib/libcurses/screen/memSset.c b/usr/src/lib/libcurses/screen/memSset.c new file mode 100644 index 0000000000..192d42b918 --- /dev/null +++ b/usr/src/lib/libcurses/screen/memSset.c @@ -0,0 +1,116 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses.h" + +/* + * additional memory routine to deal with memory areas in units of chtypes. + */ + +void +memSset(chtype *s, chtype c, int n) + +#if u3b +{ + int count; /* %r8 */ + char *from; /* %r7 */ + char *to; /* %r6 */ + + count = (n - 1) * sizeof (chtype); + if (count > 0) { + chtype *sfrom = s; /* %r5 */ + + to = (char *)(sfrom + 1); + from = (char *)sfrom; + *sfrom = c; + asm(" movblkb %r8, %r7, %r6"); + /* bcopy (count, to, from) */ + } else if (count == 0) + *s = c; +} +#else +#if u3b2 || u3b15 +{ + char *to; /* 0(%fp) */ + char *from; /* 4(%fp) */ + int count; /* %r8 */ + + count = (n - 1) * sizeof (chtype); + if (count > 0) { + chtype *sfrom = s; /* %r7 */ + + to = (char *)(sfrom + 1); + from = (char *)sfrom; + *sfrom = c; + +/* Evidently one can not specify the regs for movblb. So I move */ +/* them in myself below to the regs where they belong. */ + asm(" movw %r8,%r2"); /* count */ + asm(" movw 0(%fp),%r1"); /* to */ + asm(" movw 4(%fp),%r0"); /* from */ + asm(" movblb"); + } else if (count == 0) + *s = c; +} +#else +{ + while (n-- > 0) + *s++ = c; +} +#endif /* u3b2 || u3b15 */ +#endif /* u3b */ + +/* The vax block copy command doesn't work the way I want. */ +/* If anyone finds a version that does, I'd like to know. */ +#if __bad__vax__ + +/* this is the code within memcpy which shows how to do a block copy */ + +memcpy(char *to, char *from, int count) +{ + if (count > 0) { + asm(" movc3 12(ap),*4(ap),*8(ap)"); + } +} +#endif /* __bad__vax__ */ diff --git a/usr/src/lib/libcurses/screen/meta.c b/usr/src/lib/libcurses/screen/meta.c new file mode 100644 index 0000000000..36df6cad21 --- /dev/null +++ b/usr/src/lib/libcurses/screen/meta.c @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* TRUE => all 8 bits of input character should be passed through. */ + +int +_meta(int bf) +{ + /* + * Do the appropriate fiddling with the tty driver to make it send + * all 8 bits through. On SYSV this means clearing ISTRIP, on + * V7 you have to resort to RAW mode. + */ +#ifdef SYSV + if (bf) + PROGTTYS.c_iflag &= ~ISTRIP; + else + PROGTTYS.c_iflag |= ISTRIP; + (void) reset_prog_mode(); +#else /* SYSV */ + if (bf) + raw(); + else + noraw(); +#endif /* SYSV */ + + /* Do whatever is needed to put the terminal into meta-mode. */ + + if ((SP->fl_meta = bf) != 0) + (void) tputs(meta_on, 1, _outch); + else + (void) tputs(meta_off, 1, _outch); + (void) fflush(SP->term_file); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/mouse.c b/usr/src/lib/libcurses/screen/mouse.c new file mode 100644 index 0000000000..e94fc1437c --- /dev/null +++ b/usr/src/lib/libcurses/screen/mouse.c @@ -0,0 +1,149 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +mouse_set(long int mbe) +{ + if (get_mouse) { + SP->_trap_mbe = mbe; + (void) tputs(tparm_p1(get_mouse, mbe), 1, _outch); + (void) fflush(SP->term_file); + return (OK); + } + return (ERR); +} + +int +mouse_on(long int mbe) +{ + if (get_mouse) { + SP->_trap_mbe |= mbe; + (void) tputs(tparm_p1(get_mouse, (long) SP->_trap_mbe), + 1, _outch); + (void) fflush(SP->term_file); + return (OK); + } + return (ERR); +} + +int +mouse_off(long int mbe) +{ + if (get_mouse) { + SP->_trap_mbe &= ~mbe; + (void) tputs(tparm_p1(get_mouse, (long) SP->_trap_mbe), + 1, _outch); + (void) fflush(SP->term_file); + return (OK); + } + return (ERR); +} + + +int +request_mouse_pos(void) +{ + int i; + + if (req_mouse_pos) { + (void) tputs(req_mouse_pos, 1, _outch); + (void) fflush(SP->term_file); + + /* we now must wait for report of mouse position. How do */ + /* we know that this is mouse position report an not any- */ + /* thing else? thetch() returns KEY_MOUSE and the status */ + /* off all the buttons remains unchanged. */ + /* just to avoid going into infinite loop, we have a */ + /* counter. if 1000 responses won't have what we need, */ + /* we'll return error */ + + for (i = 0; i < 1000; i++) { + if ((tgetch(1) == KEY_MOUSE) && MOUSE_POS_REPORT) + break; + } + if (i == 1000) + return (ERR); + return (OK); + } + return (ERR); +} + +void +wmouse_position(WINDOW *win, int *x, int *y) +{ + /* mouse pointer outside the window, store -1's into x and y */ + + if (win->_begy > MOUSE_Y_POS || win->_begx > MOUSE_X_POS || + win->_begy+win->_maxy < MOUSE_Y_POS || + win->_begx+win->_maxx < MOUSE_X_POS) { + *x = -1; *y = -1; + } else { + *x = MOUSE_X_POS - win->_begx; + *y = MOUSE_Y_POS - win->_begy; + } +} + + +int +map_button(unsigned long a) +{ + SP->_map_mbe_to_key = a; + return (OK); +} + + +unsigned long +getmouse(void) +{ + return (SP->_trap_mbe); +} + + +unsigned long +getbmap(void) +{ + return (SP->_map_mbe_to_key); +} diff --git a/usr/src/lib/libcurses/screen/mvcur.c b/usr/src/lib/libcurses/screen/mvcur.c new file mode 100644 index 0000000000..4fb65568aa --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvcur.c @@ -0,0 +1,436 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Cursor motion optimization routine. This routine takes as parameters + * the screen positions that the cursor is currently at, and the position + * you want it to be at, and it will move the cursor there very + * efficiently. It isn't really optimal, since several approximations + * are taken in the interests of efficiency and simplicity. The code + * here considers directly addressing the cursor, and also considers + * local motions using left, right, up, down, tabs, backtabs, vertical + * and horizontal addressing, and parameterized motions. It does not + * consider using home down, or taking advantage of automatic margins on + * any of the four directions. (Two of these directions, left and right, + * are well defined by the am and bw capabilities, but up and down are + * not defined, nor are tab or backtab off the ends.) + * + * General strategies considered: + * CA Direct Cursor Addressing + * LM Local Motions from the old position + * HR Home + Local Motions from upper left corner + * HDR Home Down + Local Motions from lower left corner + * CR CR + Local Motions from left margin + * + * Local Motions can include + * Up cuu, cuu1, vpa + * Down cud, cud1, vpa + * Left cul, cul1, hpa, bs, cbt + * Right cuf, cuf1, hpa, tab, char moved over + */ + +/* This is called _ISMARK2 so it doesn't conflict with _ISMARK1 in wrefresh.c */ + +#define _ISMARK2(x) (mks[(x) / BITSPERBYTE] & (1<<((x) % BITSPERBYTE))) + +#define H_UP -1 +#define H_DO 1 + +static int Newy; +static int _homefirst(int, int, int, int), + _mvrel(int, int, int, int, int), + _mvvert(int, int, int), _mvhor(int, int, int), + _mvright(int, int, int), _mvleft(int, int, int); + +int +mvcur(int cury, int curx, int newy, int newx) +{ + int hu, /* cost home + relative */ + hd, /* cost home-down + relative */ + rl, /* cost relative */ + cm; /* cost direct cursor motion */ + + /* obvious case */ + if (cury == newy && curx == newx) + return (OK); + + /* not in the right mode for cursor movement */ + if (SP->fl_endwin) + return (ERR); + + if (!move_standout_mode && curscr->_attrs && !SP->_mks) + _VIDS(A_NORMAL, curscr->_attrs); + + if (!move_insert_mode && SP->phys_irm) + _OFFINSERT(); + + Newy = newy; + + /* cost of using cm */ + cm = _COST(Cursor_address); + + rl = hd = hu = LARGECOST; + + /* baudrate optimization */ + if (cm < LARGECOST && SP->baud >= 2400 && + cury >= 0 && cury < curscr->_maxy && + curx >= 0 && curx < curscr->_maxx) { + if (cursor_down && (newy == (cury + 1)) && + ((newx == curx) || (newx == 0 && carriage_return))) { + if (newx != curx) + _PUTS(carriage_return, 1); + _PUTS(cursor_down, 1); + goto done; + } + + /* fast horizontal move */ + if (cury == newy && newx < curx - 4 && newx > curx + 4) { + if (newx < curx) + rl = _mvleft(curx, newx, FALSE); + else + rl = _mvright(curx, newx, FALSE); + if (rl < cm) { + if (newx < curx) + rl = _mvleft(curx, newx, TRUE); + else + rl = _mvright(curx, newx, TRUE); + goto done; + } + } + } + + /* cost using relative movements */ + if (rl >= LARGECOST && cury >= 0 && cury < curscr->_maxy && + curx >= 0 && curx < curscr->_maxx) + rl = _mvrel(cury, curx, newy, newx, FALSE); + + /* cost of homing to upper-left corner first */ + if (cursor_home) + hu = _homefirst(newy, newx, H_UP, FALSE); + + /* cost of homing to lower-left corner first */ + if (cursor_to_ll) + hd = _homefirst(newy, newx, H_DO, FALSE); + + /* can't do any one of them */ + if (cm >= LARGECOST && rl >= LARGECOST && hu >= LARGECOST && + hd >= LARGECOST) + return (ERR); + + /* do the best one */ + if (cm <= rl && cm <= hu && cm <= hd) + _PUTS(tparm_p2(cursor_address, newy, newx), 1); + else + if (rl <= hu && rl <= hd) + (void) _mvrel(cury, curx, newy, newx, TRUE); + else + (void) _homefirst(newy, newx, hu <= hd ? + H_UP : H_DO, TRUE); + +done: + /* update cursor position */ + /*LINTED*/ + curscr->_curx = (short) newx; + /*LINTED*/ + curscr->_cury = (short) newy; + + return (OK); +} + +/* Move by homing first. */ + +static int +_homefirst(int ny, int nx, int type, int doit) +{ + char *home; + int cy, cost; + + if (type == H_UP) { + home = cursor_home; + cost = _COST(Cursor_home); + cy = 0; + } else { + home = cursor_to_ll; + cost = _COST(Cursor_to_ll); + cy = curscr->_maxy - 1; + } + + if (!home) + return (LARGECOST); + if (!doit) + return (cost + _mvrel(cy, 0, ny, nx, FALSE)); + + _PUTS(home, 1); + return (_mvrel(cy, 0, ny, nx, TRUE)); +} + +/* Move relatively */ + +static int +_mvrel(int cy, int cx, int ny, int nx, int doit) +{ + int cv, ch; + + /* do in this order since _mvhor may need the curscr image */ + cv = _mvvert(cy, ny, doit); + ch = _mvhor(cx, nx, doit); + + return (cv + ch); +} + +/* Move vertically */ + +static int +_mvvert(int cy, int ny, int doit) +{ + char *ve; + int dy, st_1, st_n, cv; + + if (cy == ny) + goto out; + + /* cost of stepwise movement */ + if (cy < ny) { + dy = ny-cy; + st_1 = _COST(Cursor_down) * dy; + st_n = _COST(Parm_down_cursor); + } else { + dy = cy-ny; + st_1 = _COST(Cursor_up) * dy; + st_n = _COST(Parm_up_cursor); + } + + /* cost of using vertical move */ + cv = _COST(Row_address); + + /* if calculating cost only */ + if (!doit) + return ((cv < st_1 && cv < st_n) ? cv : + (st_n < st_1) ? st_n : st_1); + + /* do it */ + if (cv < st_1 && cv < st_n) + _PUTS(tparm_p1(row_address, ny), 1); + else + if (st_n < st_1) { + if (cy < ny) + _PUTS(tparm_p1(parm_down_cursor, dy), 1); + else + _PUTS(tparm_p1(parm_up_cursor, dy), 1); + } else { + if (cy < ny) + ve = cursor_down; + else + ve = cursor_up; + for (; dy > 0; --dy) + _PUTS(ve, 1); + } + +out: + return (0); +} + +/* Move horizontally */ + +static int +_mvhor(int cx, int nx, int doit) +{ + int st, ch, hl; + + if (cx == nx) + goto out; + + /* cost using horizontal move */ + ch = _COST(Row_address); + + /* cost doing stepwise */ + st = cx < nx ? _mvright(cx, nx, FALSE) : _mvleft(cx, nx, FALSE); + + /* cost homeleft first */ + hl = (_COST(Carriage_return) < LARGECOST) ? + _COST(Carriage_return) + _mvright(0, nx, FALSE) : LARGECOST; + + if (!doit) + return ((ch < st && ch < hl) ? ch : (hl < st ? hl : st)); + + if (ch < st && ch < hl) + _PUTS(tparm_p1(column_address, nx), 1); + else + if (hl < st) { + _PUTS(carriage_return, 1); + (void) _mvright(0, nx, TRUE); + } else { + if (cx < nx) + (void) _mvright(cx, nx, TRUE); + else + (void) _mvleft(cx, nx, TRUE); + } +out: + return (0); +} + +/* Move right. */ + +static int +_mvright(int cx, int nx, int doit) +{ + chtype *scp; + char *mks; + int nt, tx, x, stcost, iscont; + + if (!cursor_right && !parm_right_cursor) + return (LARGECOST); + + scp = curscr->_y[Newy]; + mks = magic_cookie_glitch >= 0 ? SP->_mks[Newy] : NULL; + + if (cursor_right) { + /* number of tabs used in stepwise movement */ + nt = tab ? (nx / TABSIZE - cx / TABSIZE) : 0; + tx = (nt > 0) ? (cx / TABSIZE + nt) * TABSIZE : cx; + + /* calculate stepwise cost */ + stcost = nt * _COST(Tab); + iscont = 0; + for (x = tx; x < nx; ++x) { + if (iscont == 0 && !ISCBIT(scp[x])) + iscont = 1; + if ((!ceol_standout_glitch && !mks && + _ATTR(scp[x]) == curscr->_attrs) || + ceol_standout_glitch || (mks && !_ISMARK2(x))) { + if (!ISMBIT(scp[x])) + stcost += 1; + else if (iscont && !(nx - x == 1 && nx < + curscr->_maxx && ISCBIT(scp[nx]))) + stcost += 1; + else + stcost += _COST(Cursor_right); + } else + stcost += _COST(Cursor_right); + } + } else + stcost = LARGECOST; + + if (!doit) + return ((_COST(Parm_right_cursor) < stcost) ? + _COST(Parm_right_cursor) : stcost); + + /* actually move */ + if (_COST(Parm_right_cursor) < stcost) + _PUTS(tparm_p1(parm_right_cursor, nx-cx), 1); + else { + if (SP->phys_irm) + _OFFINSERT(); + for (; nt > 0; --nt) + _PUTS(tab, 1); + iscont = 0; + for (x = tx; x < nx; ++x) { + if (iscont == 0 && !ISCBIT(scp[x])) + iscont = 1; + if ((!ceol_standout_glitch && !mks && + _ATTR(scp[x]) == curscr->_attrs) || + ceol_standout_glitch || (mks && !_ISMARK2(x))) { + if (!ISMBIT(scp[x])) + (void) _outwch(_CHAR(scp[x])); + else if (iscont && !(nx - x == 1 && + nx < curscr->_maxx && ISCBIT(scp[nx]))) + (void) _outwch(_CHAR(scp[x])); + else + _PUTS(cursor_right, 1); + } else + _PUTS(cursor_right, 1); + } + } + + return (0); +} + +/* Move left */ + +static int +_mvleft(int cx, int nx, int doit) +{ + int tx, nt, x, stcost; + + if (!cursor_left && !parm_left_cursor) + return (LARGECOST); + + if (cursor_left) { + /* stepwise cost */ + tx = cx; + nt = 0; + if (back_tab) { + /* the TAB position >= nx */ + x = (nx % TABSIZE) ? (nx / TABSIZE + 1) * TABSIZE : nx; + + /* # of tabs used and position after using them */ + if (x < cx) { + nt = (cx / TABSIZE - x / TABSIZE) + + ((cx % TABSIZE) ? 1 : 0); + tx = x; + } + } + stcost = nt * _COST(Back_tab) + (tx-nx) * _COST(Cursor_left); + } else + stcost = LARGECOST; + + /* get cost only */ + if (!doit) + return ((_COST(Parm_left_cursor) < stcost) ? + _COST(Parm_left_cursor) : stcost); + + /* doit */ + if (_COST(Parm_left_cursor) < stcost) + _PUTS(tparm_p1(parm_left_cursor, cx - nx), 1); + else { + for (; nt > 0; --nt) + _PUTS(back_tab, 1); + for (; tx > nx; --tx) + _PUTS(cursor_left, 1); + } + + return (0); +} diff --git a/usr/src/lib/libcurses/screen/mvderwin.c b/usr/src/lib/libcurses/screen/mvderwin.c new file mode 100644 index 0000000000..4b6e33dbb3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvderwin.c @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Move a derived window inside its parent window. + * This routine does not change the screen relative + * parameters begx and begy. Thus, it can be used to + * display different parts of the parent window at + * the same screen coordinate. + */ + +int +mvderwin(WINDOW *win, int pary, int parx) +{ + int y, maxy; + WINDOW *par; + chtype obkgd, **wc, **pc; + short *begch, *endch, maxx; + + if ((par = win->_parent) == NULL) + goto bad; + if (pary == win->_pary && parx == win->_parx) + return (OK); + + maxy = win->_maxy-1; + maxx = win->_maxx-1; + if ((parx + maxx) >= par->_maxx || (pary + maxy) >= par->_maxy) +bad: + return (ERR); + + /* save all old changes */ + wsyncup(win); + + /* rearrange pointers */ + /*LINTED*/ + win->_parx = (short) parx; + /*LINTED*/ + win->_pary = (short) pary; + wc = win->_y; + pc = par->_y + pary; + begch = win->_firstch; + endch = win->_lastch; + for (y = 0; y <= maxy; ++y, ++wc, ++pc, ++begch, ++endch) { + *wc = *pc + parx; + *begch = 0; + *endch = maxx; + } + + /* change background to our own */ + obkgd = win->_bkgd; + win->_bkgd = par->_bkgd; + return (wbkgd(win, obkgd)); +} diff --git a/usr/src/lib/libcurses/screen/mvprintw.c b/usr/src/lib/libcurses/screen/mvprintw.c new file mode 100644 index 0000000000..e4421cb09e --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvprintw.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * implement the mvprintw commands. Due to the variable number of + * arguments, they cannot be macros. Sigh.... + * + */ + +int +/*VARARGS*/ +mvprintw(int y, int x, ...) +{ + char * fmt; + va_list ap; + + va_start(ap, x); + fmt = va_arg(ap, char *); + return (move(y, x) == OK ? vwprintw(stdscr, fmt, ap) : ERR); +} diff --git a/usr/src/lib/libcurses/screen/mvscanw.c b/usr/src/lib/libcurses/screen/mvscanw.c new file mode 100644 index 0000000000..9c1f86b292 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvscanw.c @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * implement the mvscanw commands. Due to the variable number of + * arguments, they cannot be macros. Another sigh.... + * + */ + +int +mvscanw(int y, int x, ...) +{ + char *fmt; + va_list ap; + + va_start(ap, x); + fmt = va_arg(ap, char *); + return (move(y, x) == OK ? vwscanw(stdscr, fmt, ap) : ERR); +} diff --git a/usr/src/lib/libcurses/screen/mvwin.c b/usr/src/lib/libcurses/screen/mvwin.c new file mode 100644 index 0000000000..a4dcb5030d --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvwin.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* relocate the starting position of a _window */ + +int +mvwin(WINDOW *win, int by, int bx) +{ + if ((by + win->_maxy) > LINES || (bx + win->_maxx) > COLS || + by < 0 || bx < 0) + return (ERR); + /*LINTED*/ + win->_begy = (short) by; + /*LINTED*/ + win->_begx = (short) bx; + (void) wtouchln(win, 0, win->_maxy, -1); + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/mvwprintw.c b/usr/src/lib/libcurses/screen/mvwprintw.c new file mode 100644 index 0000000000..6a0608c565 --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvwprintw.c @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * implement the mvprintw commands. Due to the variable number of + * arguments, they cannot be macros. Sigh.... + * + */ + +int +mvwprintw(WINDOW *win, int y, int x, ...) +{ + char *fmt; + va_list ap; + + va_start(ap, x); + fmt = va_arg(ap, char *); + return (wmove(win, y, x) == OK ? vwprintw(win, fmt, ap) : ERR); +} diff --git a/usr/src/lib/libcurses/screen/mvwscanw.c b/usr/src/lib/libcurses/screen/mvwscanw.c new file mode 100644 index 0000000000..e64ffd5e4f --- /dev/null +++ b/usr/src/lib/libcurses/screen/mvwscanw.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * implement the mvscanw commands. Due to the variable number of + * arguments, they cannot be macros. Another sigh.... + * + */ + +int +mvwscanw(WINDOW *win, int y, int x, ...) +{ + char *fmt; + va_list ap; + + va_start(ap, x); + + fmt = va_arg(ap, char *); + return (wmove(win, y, x) == OK ? vwscanw(win, fmt, ap) : ERR); +} diff --git a/usr/src/lib/libcurses/screen/napms.c b/usr/src/lib/libcurses/screen/napms.c new file mode 100644 index 0000000000..2f98e23076 --- /dev/null +++ b/usr/src/lib/libcurses/screen/napms.c @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include <stdio.h> +#include <sys/types.h> +#include <poll.h> + +/* + * napms. Sleep for ms milliseconds. We don't expect a particularly good + * resolution - 60ths of a second is normal, 10ths might even be good enough, + * but the rest of the program thinks in ms because the unit of resolution + * varies from system to system. (In some countries, it's 50ths, for example.) + * Vaxen running 4.2BSD and 3B's use 100ths. + * + * Here are some reasonable ways to get a good nap. + * + * (1) Use the poll() or select() system calls in SVr3 or Berkeley 4.2BSD. + * + * (2) Use the 1/10th second resolution wait in the System V tty driver. + * It turns out this is hard to do - you need a tty line that is + * always unused that you have read permission on to sleep on. + * + * (3) Install the ft (fast timer) device in your kernel. + * This is a psuedo-device to which an ioctl will wait n ticks + * and then send you an alarm. + * + * (4) Install the nap system call in your kernel. + * This system call does a timeout for the requested number of ticks. + * + * (5) Write a routine that busy waits checking the time with ftime. + * Ftime is not present on SYSV systems, and since this busy waits, + * it will drag down response on your system. But it works. + */ + +int +napms(int ms) +{ + struct pollfd pollfd; + + if (poll(&pollfd, 0L, ms) == -1) + perror("poll"); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/newkey.c b/usr/src/lib/libcurses/screen/newkey.c new file mode 100644 index 0000000000..265aa8868f --- /dev/null +++ b/usr/src/lib/libcurses/screen/newkey.c @@ -0,0 +1,112 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Set a new key or a new macro. + * + * rcvchars: the pattern identifying the key + * keyval: the value to return when the key is recognized + * macro: if this is not a function key but a macro, + * tgetch() will block on macros. + */ + +int +newkey(char *rcvchars, short keyval, bool macro) +{ + _KEY_MAP **keys, *key_info, + **prev_keys = cur_term->_keys; + short *numkeys = &cur_term->_ksz; + char *str; + size_t len; + + if ((!rcvchars) || (*rcvchars == '\0') || (keyval < 0) || + (((keys = (_KEY_MAP **) malloc(sizeof (_KEY_MAP *) * + (*numkeys + 1))) == NULL))) { + goto bad; + } + + len = strlen(rcvchars) + 1; + + if ((key_info = (_KEY_MAP *) malloc(sizeof (_KEY_MAP) + len)) == + NULL) { + free(keys); +bad : + term_errno = TERM_BAD_MALLOC; +#ifdef DEBUG + strcpy(term_parm_err, "newkey"); +#endif /* DEBUG */ + return (ERR); + } + + if (macro) { + (void) memcpy((char *) keys, (char *) prev_keys, + (*numkeys * sizeof (_KEY_MAP *))); + keys[*numkeys] = key_info; + } else { + short *first = &(cur_term->_first_macro); + + (void) memcpy((char *) keys, (char *) prev_keys, + (*first * sizeof (_KEY_MAP *))); + (void) memcpy((char *) &(keys[*first + 1]), + (char *) &(prev_keys[*first]), + ((*numkeys - *first) * sizeof (_KEY_MAP *))); + keys[(*first)++] = key_info; + cur_term->_lastmacro_ordered++; + } + if (prev_keys != NULL) + free(prev_keys); + cur_term->_keys = keys; + + (*numkeys)++; + key_info->_sends = str = (char *) key_info + sizeof (_KEY_MAP); + (void) memcpy(str, rcvchars, len); + key_info->_keyval = keyval; + cur_term->funckeystarter[*str] |= (macro ? _MACRO : _KEY); + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/newpad.c b/usr/src/lib/libcurses/screen/newpad.c new file mode 100644 index 0000000000..39be0be242 --- /dev/null +++ b/usr/src/lib/libcurses/screen/newpad.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +WINDOW * +newpad(int l, int nc) +{ + WINDOW *pad; + + pad = newwin(l, nc, 0, 0); + if (pad != (WINDOW *) NULL) + pad->_flags |= _ISPAD; + return (pad); +} diff --git a/usr/src/lib/libcurses/screen/newscreen.c b/usr/src/lib/libcurses/screen/newscreen.c new file mode 100644 index 0000000000..902c490088 --- /dev/null +++ b/usr/src/lib/libcurses/screen/newscreen.c @@ -0,0 +1,356 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +#ifdef _VR2_COMPAT_CODE +extern char _endwin; +#endif /* _VR2_COMPAT_CODE */ + +/* 1200 is put at the 0th location since 0 is probably a mistake. */ +static long baud_convert[] = { + 1200, 50, 75, 110, 135, 150, 200, 300, 600, 1200, + 1800, 2400, 4800, 9600, 19200, 38400, 57600, 76800, + 115200, 153600, 230400, 307200, 460800 + }; + +static char isfilter = 0; +static int _chk_trm(void); +static void _forget(void); + +/* + * newscreen sets up a terminal and returns a pointer to the terminal + * structure or NULL in case of an error. The parameters are: + * type: terminal type + * lsize, csize, tabsize: physical sizes + * infptr, outfptr: input and output stdio stream file pointers + */ + +SCREEN * +newscreen(char *type, int lsize, int csize, int tabsize, + FILE *outfptr, FILE *infptr) +{ + int old_lines = LINES, old_cols = COLS, retcode; +#ifndef _IOFBF + char *sobuf; +#endif /* _IOBUF */ + WINDOW *old_curscr = curscr; + SCREEN *old = SP; + TERMINAL *old_term = cur_term; + +#ifdef DEBUG + if (outf == NULL) { + outf = fopen("trace", "w"); + if (outf == NULL) { + perror("trace"); + exit(-1); + } + setbuf(outf, (char *)NULL); + } + + if (outf) + fprintf(outf, "NEWTERM(type=%s, outfptr=%x %d, infptr=%x %d) " + "isatty(2) %d, getenv %s\n", type, outfptr, + fileno(outfptr), infptr, fileno(infptr), isatty(2), + getenv("TERM")); +#endif /* DEBUG */ + + + /* read in terminfo file */ + + if (setupterm(type, fileno(outfptr), &retcode) != 0) + goto err2; + + /* the max length of a multi-byte character */ + _csmax = (cswidth[0] > cswidth[1]+1 ? + (cswidth[0] > cswidth[2]+1 ? cswidth[0] : cswidth[2]+1) : + (cswidth[1] > cswidth[2] ? cswidth[1]+1 : cswidth[2]+1)); + if (_csmax > CSMAX) + goto err2; + /* the max length of a multi-column character */ + _scrmax = _curs_scrwidth[0] > _curs_scrwidth[1] ? + (_curs_scrwidth[0] > _curs_scrwidth[2] ? _curs_scrwidth[0] : + _curs_scrwidth[2]) : (_curs_scrwidth[1] > _curs_scrwidth[2] ? + _curs_scrwidth[1] : _curs_scrwidth[2]); + /* true multi-byte/multi-column case */ + _mbtrue = (_csmax > 1 || _scrmax > 1); + + if ((curs_errno = _chk_trm()) != -1) { + (void) strcpy(curs_parm_err, cur_term->_termname); + goto err2; + } + + /* use calloc because almost everything needs to be zero */ + if ((SP = (SCREEN *) calloc(1, sizeof (SCREEN))) == NULL) + goto err1; + + SP->term_file = outfptr; + SP->input_file = infptr; + + /* + * The default is echo, for upward compatibility, but we do + * all echoing in curses to avoid problems with the tty driver + * echoing things during critical sections. + */ + + SP->fl_echoit = 1; + + /* set some fields for cur_term structure */ + + (void) typeahead(fileno(infptr)); + (void) tinputfd(fileno(infptr)); + + /* + * We use LINES instead of the SP variable and a local variable because + * slk_init and rip_init update the LINES value and application code + * may look at the value of LINES in the function called by rip_init. + */ + + /* LINTED */ + LINES = SP->lsize = lsize > 0 ? lsize : lines; + + /* force the output to be buffered */ +#ifdef _IOFBF + (void) setvbuf(outfptr, (char *)NULL, _IOFBF, 0); +#else /* _IOFBF */ + if ((sobuf = malloc(BUFSIZ)) == NULL) { + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "newscreen"); +#endif /* DEBUG */ + } + setbuf(outfptr, sobuf); +#endif /* _IOFBF */ + +#ifdef SYSV + SP->baud = baud_convert[_BRS(PROGTTYS)]; +#else /* SYSV */ + SP->baud = baud_convert[_BR(PROGTTY)]; +#endif /* SYSV */ + + /* figure out how much each terminal capability costs */ + _init_costs(); + + /* initialize the array of alternate characters */ + (void) init_acs(); + + SP->tcap = cur_term; + + /* set tty settings to something reasonable for us */ +#ifdef SYSV + PROGTTYS.c_lflag &= ~ECHO; + PROGTTYS.c_lflag |= ISIG; + PROGTTYS.c_oflag &= ~(OCRNL|ONLCR); /* why would anyone set OCRNL? */ +#else /* SYSV */ + PROGTTY.sg_flags &= ~(RAW|ECHO|CRMOD); +#endif /* SYSV */ + + (void) cbreak(); + + /* LINTED */ + COLS = SP->csize = csize > 0 ? csize : columns; + if (tabsize == 0) + tabsize = (init_tabs == -1) ? 8 : init_tabs; + /* LINTED */ + SP->tsize = (short)tabsize; +#ifdef DEBUG + if (outf) + fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS); +#endif /* DEBUG */ + + if ((curscr = SP->cur_scr = newwin(LINES, COLS, 0, 0)) == NULL) + goto err; + + SP->fl_endwin = 2; +#ifdef _VR2_COMPAT_CODE + _endwin = FALSE; +#endif /* _VR2_COMPAT_CODE */ + curscr->_sync = TRUE; + + /* + * This will tell _quick_echo(if it's ever called), whether + * _quick_echo should let wrefresh handle everything. + */ + + if (ceol_standout_glitch || (magic_cookie_glitch >= 0) || + tilde_glitch || (transparent_underline && erase_overstrike)) { + curscr->_flags |= _CANT_BE_IMMED; + } + if (!(SP->virt_scr = newwin(LINES, COLS, 0, 0))) + goto err; + _virtscr = SP->virt_scr; + + SP->virt_scr->_clear = FALSE; + + /* video mark map for cookie terminals */ + + if (ceol_standout_glitch || (magic_cookie_glitch >= 0)) { + int i, nc; + char **marks; + + if ((marks = (char **)calloc((unsigned)LINES, + sizeof (char *))) == NULL) + goto err; + SP->_mks = marks; + nc = (COLS / BITSPERBYTE) + (COLS % BITSPERBYTE ? 1 : 0); + if ((*marks = (char *)calloc((unsigned)nc * LINES, + sizeof (char))) == NULL) + goto err; + for (i = LINES - 1; i-- > 0; ++marks) + *(marks + 1) = *marks + nc; + } + + /* hash tables for lines */ + if ((SP->cur_hash = (int *)calloc((unsigned)2 * LINES, + sizeof (int))) == NULL) + goto err; + SP->virt_hash = SP->cur_hash + LINES; + + /* adjust the screen size if soft labels and/or ripoffline are used */ + if (_slk_init) + (*_slk_init)(); + if (_rip_init) + (*_rip_init)(); + + if ((SP->std_scr = newwin(LINES, COLS, 0, 0)) == NULL) { + /* free all the storage allocated above and return NULL */ +err: + delscreen(SP); + COLS = old_cols; + curscr = old_curscr; + LINES = old_lines; +err1: + SP = old; + + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "newscreen"); +#endif /* DEBUG */ + +err2: + cur_term = old_term; + return (NULL); + } +#ifdef DEBUG + if (outf) + fprintf(outf, "SP %x, stdscr %x, curscr %x\n", + SP, SP->std_scr, curscr); +#endif /* DEBUG */ + + if (((SP->imode = (enter_insert_mode && exit_insert_mode)) != 0) && + ((SP->dmode = (enter_delete_mode && exit_delete_mode)) != 0)) { + if (strcmp(enter_insert_mode, enter_delete_mode) == 0) + SP->sid_equal = TRUE; + if (strcmp(exit_insert_mode, exit_delete_mode) == 0) + SP->eid_equal = TRUE; + } + SP->ichok = (SP->imode || insert_character || parm_ich); + SP->dchok = (delete_character || parm_dch); + + stdscr = SP->std_scr; + TABSIZE = SP->tsize; + + return (SP); +} + +/* + * check if terminal have capabilities to do basic cursor movements and + * screen clearing + */ +static int +_chk_trm(void) +{ + short error_num = -1; +#ifdef DEBUG + if (outf) + fprintf(outf, "chk_trm().\n"); +#endif /* DEBUG */ + + if (generic_type) + error_num = CURS_UNKNOWN; + else { + if (isfilter) { + _forget(); + /* Only need to move left or right on current line */ + if (!(cursor_left || carriage_return || + column_address || parm_left_cursor)) { + goto out_stupid; + } + } else { + if ((hard_copy || over_strike) || + /* some way to move up, down, left */ + (!(cursor_address) && + (!((cursor_up || cursor_home) && cursor_down && + (cursor_left || carriage_return)))) || + (!clear_screen)) { +out_stupid: + error_num = CURS_STUPID; + } + } + } + return (error_num); +} + +int +filter(void) +{ + isfilter = 1; + return (OK); +} + +/* + * if (for some reason) user assumes that terminal has only one line, + * disable all capabilities that deal with non-horizontal cursor movement + */ +static void +_forget(void) +{ + row_address = cursor_address = clear_screen = parm_down_cursor = + cursor_up = cursor_down = NULL; + cursor_home = carriage_return; + lines = 1; +} diff --git a/usr/src/lib/libcurses/screen/newwin.c b/usr/src/lib/libcurses/screen/newwin.c new file mode 100644 index 0000000000..7427a7a589 --- /dev/null +++ b/usr/src/lib/libcurses/screen/newwin.c @@ -0,0 +1,135 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* allocate space for and set up defaults for a new _window */ + +#include <stdlib.h> +#include <sys/types.h> +#include "curses_inc.h" + +WINDOW * +newwin(int nlines, int ncols, int by, int bx) +{ + WINDOW *win; + int counter = 0; + + if (nlines <= 0) + nlines = LINES - by; + if (ncols <= 0) + ncols = COLS - bx; + + if ((by < 0) || (bx < 0) || ((win = _makenew(nlines, ncols, by, + bx)) == (WINDOW *) NULL) || (_image(win) == ERR)) { + return ((WINDOW *) NULL); + } + + while (counter < nlines) { + memSset(&win->_y[counter][0], (chtype) ' ', ncols); +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + int i = ncols; + + while (i--) + win->_y16[counter][i] = (_ochtype) ' '; + } +#endif /* _VR3_COMPAT_CODE */ + counter++; + } + + win->_yoffset = SP->Yabove; + return (win); +} + +int +_image(WINDOW *win) +{ + int i, nlines = win->_maxy; +#ifdef _VR3_COMPAT_CODE + size_t oscols = win->_maxx * sizeof (_ochtype); +#endif /* _VR3_COMPAT_CODE */ + size_t scols = win->_maxx * sizeof (chtype); + chtype **_y = win->_y; +#ifdef _VR3_COMPAT_CODE + _ochtype **_y16 = win->_y16; +#endif /* _VR3_COMPAT_CODE */ + + for (i = 0; i < nlines; i++) { +#ifdef _VR3_COMPAT_CODE + if (((_y[i] = (chtype *) malloc(scols)) == NULL) || + ((_y16update) && ((_y16[i] = (_ochtype *) + malloc(oscols)) == NULL))) +#else /* _VR3_COMPAT_CODE */ + if ((_y[i] = (chtype *) malloc(scols)) == + NULL) +#endif /* _VR3_COMPAT_CODE */ + { + int j; + + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "_image"); +#endif /* DEBUG */ +#ifdef _VR3_COMPAT_CODE + for (j = 0; j <= i; j++) { + if (_y[j] != NULL) + free((char *) _y[j]); + if ((_y16update) && (_y16[j] != NULL)) + free((char *) _y16[j]); + } +#else /* _VR3_COMPAT_CODE */ + for (j = 0; j < i; j++) + free((char *) _y[j]); +#endif /* _VR3_COMPAT_CODE */ + + free((char *) win->_firstch); + free((char *) win->_y); +#ifdef _VR3_COMPAT_CODE + if ((_y16update) && (win->_y16 != NULL)) + free((char *) win->_y16); +#endif /* _VR3_COMPAT_CODE */ + free((char *) win); + return (ERR); + } + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/nocbreak.c b/usr/src/lib/libcurses/screen/nocbreak.c new file mode 100644 index 0000000000..6dc3f5bc15 --- /dev/null +++ b/usr/src/lib/libcurses/screen/nocbreak.c @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +nocbreak(void) +{ +#ifdef SYSV + /* See comment in cbreak.c about ICRNL. */ + PROGTTYS.c_iflag |= ICRNL; + PROGTTYS.c_lflag |= ICANON; + PROGTTYS.c_cc[VEOF] = _CTRL('D'); + PROGTTYS.c_cc[VEOL] = 0; +#else /* SYSV */ + PROGTTY.sg_flags &= ~(CBREAK | CRMOD); +#endif /* SYSV */ + +#ifdef DEBUG +#ifdef SYSV + if (outf) + fprintf(outf, "nocbreak(), file %x, flags %x\n", + cur_term->Filedes, PROGTTYS.c_lflag); +#else /* SYSV */ + if (outf) + fprintf(outf, "nocbreak(), file %x, flags %x\n", + cur_term->Filedes, PROGTTY.sg_flags); +#endif /* SYSV */ +#endif /* DEBUG */ + + cur_term->_fl_rawmode = FALSE; + cur_term->_delay = -1; + (void) reset_prog_mode(); +#ifdef FIONREAD + cur_term->timeout = 0; +#endif /* FIONREAD */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/nodelay.c b/usr/src/lib/libcurses/screen/nodelay.c new file mode 100644 index 0000000000..7c8eb4dbc6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/nodelay.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * TRUE => don't wait for input, but return -1 instead. + */ + +int +nodelay(WINDOW *win, bool bf) +{ + win->_delay = (bf) ? 0 : -1; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/noraw.c b/usr/src/lib/libcurses/screen/noraw.c new file mode 100644 index 0000000000..e9be803904 --- /dev/null +++ b/usr/src/lib/libcurses/screen/noraw.c @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +noraw(void) +{ +#ifdef SYSV + /* Enable interrupt characters */ + PROGTTYS.c_lflag |= (ISIG|ICANON); + PROGTTYS.c_cc[VEOF] = _CTRL('D'); + PROGTTYS.c_cc[VEOL] = 0; + PROGTTYS.c_iflag |= IXON; +#else /* SYSV */ + PROGTTY.sg_flags &= ~(RAW|CBREAK); +#endif /* SYSV */ + +#ifdef DEBUG +#ifdef SYSV + if (outf) + fprintf(outf, "noraw(), file %x, flags %x\n", + cur_term->Filedes, PROGTTYS.c_lflag); +#else /* SYSV */ + if (outf) + fprintf(outf, "noraw(), file %x, flags %x\n", + cur_term->Filedes, PROGTTY.sg_flags); +#endif /* SYSV */ +#endif /* DEBUG */ + + cur_term->_fl_rawmode = FALSE; + cur_term->_delay = -1; + (void) reset_prog_mode(); +#ifdef FIONREAD + cur_term->timeout = 0; +#endif /* FIONREAD */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/notimeout.c b/usr/src/lib/libcurses/screen/notimeout.c new file mode 100644 index 0000000000..e6e09c029d --- /dev/null +++ b/usr/src/lib/libcurses/screen/notimeout.c @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include "curses_inc.h" + +int +notimeout(WINDOW *win, bool bf) +{ + win->_notimeout = (bf) ? TRUE : FALSE; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/object.h b/usr/src/lib/libcurses/screen/object.h new file mode 100644 index 0000000000..3e23e0f887 --- /dev/null +++ b/usr/src/lib/libcurses/screen/object.h @@ -0,0 +1,135 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + + +#ifndef _OBJECT_H +#define _OBJECT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * COPYRIGHT NOTICE + * + * This software is copyright(C) 1982 by Pavel Curtis + * + * Permission is granted to reproduce and distribute + * this file by any means so long as no fee is charged + * above a nominal handling fee and so long as this + * notice is always included in the copies. + * + * Other rights are reserved except as explicitly granted + * by written permission of the author. + * Pavel Curtis + * Computer Science Dept. + * 405 Upson Hall + * Cornell University + * Ithaca, NY 14853 + * + * Ph- (607) 256-4934 + * + * Pavel.Cornell@Udel-Relay (ARPAnet) + * decvax!cornell!pavel(UUCPnet) + */ + +/* + * $Header: RCS/object.v Revision 2.1 82/10/25 14:49:50 pavel Exp$ + * + * object.h - Format of compiled terminfo files + * + * Header(12 bytes), containing information given below + * Names Section, containing the names of the terminal + * Boolean Section, containing the values of all of the + * boolean capabilities + * A null byte may be inserted here to make + * sure that the Number Section begins on an + * even word boundary. + * Number Section, containing the values of all of the numeric + * capabilities, each as a short integer + * String Section, containing short integer offsets into the + * String Table, one per string capability + * String Table, containing the actual characters of the string + * capabilities. + * + * NOTE that all short integers in the file are stored using VAX/PDP-style + * byte-swapping, i.e., least-significant byte first. The code in + * read_entry() automatically fixes this up on machines which don't use + * this system(I hope). + * + * $Log: RCS/object.v $ + * Revision 2.1 82/10/25 14:49:50 pavel + * Added Copyright Notice + * + * Revision 2.0 82/10/24 15:18:19 pavel + * Beta-one Test Release + * + * Revision 1.3 82/08/23 22:31:12 pavel + * The REAL Alpha-one Release Version + * + * Revision 1.2 82/08/19 19:10:18 pavel + * Alpha Test Release One + * + * Revision 1.1 82/08/12 18:48:55 pavel + * Initial revision + * + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAGIC 0432 + +struct header +{ + short magic; /* Magic Number (0432) */ + short name_size; /* Size of names section */ + short bool_count; /* Number of booleans */ + short num_count; /* Number of numbers */ + short str_count; /* Number of strings */ + short str_size; /* Size of string table */ +}; + +#ifdef __cplusplus +} +#endif + +#endif /* _OBJECT_H */ diff --git a/usr/src/lib/libcurses/screen/otermcap.h b/usr/src/lib/libcurses/screen/otermcap.h new file mode 100644 index 0000000000..1d69ec5795 --- /dev/null +++ b/usr/src/lib/libcurses/screen/otermcap.h @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _OTERMCAP_H +#define _OTERMCAP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TBUFSIZE 2048 /* double the norm */ + +/* externs from libtermcap.a */ +extern int otgetflag(char *), otgetnum(char *), + otgetent(char *, char *), tnamatch(char *), tnchktc(void); +extern char *otgetstr(char *, char **); +extern char *tskip(char *); /* non-standard addition */ +extern int TLHtcfound; /* non-standard addition */ +extern char TLHtcname[]; /* non-standard addition */ + +#ifdef __cplusplus +} +#endif + +#endif /* _OTERMCAP_H */ diff --git a/usr/src/lib/libcurses/screen/outch.c b/usr/src/lib/libcurses/screen/outch.c new file mode 100644 index 0000000000..f7173d870e --- /dev/null +++ b/usr/src/lib/libcurses/screen/outch.c @@ -0,0 +1,89 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int outchcount; + +/* Write out one character to the tty and increment outchcount. */ +int +_outch(char c) +{ + return (_outwch((chtype)c)); +} + +int +_outwch(chtype c) +{ + chtype o; + +#ifdef DEBUG +#ifndef LONGDEBUG + if (outf) + if (c < ' ' || c == 0177) + fprintf(outf, "^%c", c^0100); + else + fprintf(outf, "%c", c&0177); +#else /* LONGDEBUG */ + if (outf) + fprintf(outf, "_outch: char '%s' term %x file %x=%d\n", + unctrl(c&0177), SP, cur_term->Filedes, fileno(SP->term_file)); +#endif /* LONGDEBUG */ +#endif /* DEBUG */ + + outchcount++; + + /* ASCII code */ + if (!ISMBIT(c)) + (void) putc((int)c, SP->term_file); + /* international code */ + else if ((o = RBYTE(c)) != MBIT) { + (void) putc((int)o, SP->term_file); + if (_csmax > 1 && (((o = LBYTE(c))|MBIT) != MBIT)) { + SETMBIT(o); + (void) putc((int)o, SP->term_file); + } + } + return (0); +} diff --git a/usr/src/lib/libcurses/screen/overlap.c b/usr/src/lib/libcurses/screen/overlap.c new file mode 100644 index 0000000000..75c799a933 --- /dev/null +++ b/usr/src/lib/libcurses/screen/overlap.c @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * This routine writes Srcwin on Dstwin. + * Only the overlapping region is copied. + */ + +int +_overlap(WINDOW *Srcwin, WINDOW *Dstwin, int Overlay) +{ + int sby, sbx, sey, sex, dby, dbx, dey, dex, + top, bottom, left, right; + +#ifdef DEBUG + if (outf) + fprintf(outf, "OVERWRITE(0%o, 0%o);\n", Srcwin, Dstwin); +#endif /* DEBUG */ + + sby = Srcwin->_begy; dby = Dstwin->_begy; + sbx = Srcwin->_begx; dbx = Dstwin->_begx; + sey = sby + Srcwin->_maxy; dey = dby + Dstwin->_maxy; + sex = sbx + Srcwin->_maxx; dex = dbx + Dstwin->_maxx; + + if (sey < dby || sby > dey || sex < dbx || sbx > dex) + return (ERR); + + top = _MAX(sby, dby); bottom = _MIN(sey, dey); + left = _MAX(sbx, dbx); right = _MIN(sex, dex); + + sby = top - sby; sbx = left - sbx; + dey = bottom - dby - 1; dex = right - dbx - 1; + dby = top - dby; dbx = left - dbx; + + return (copywin(Srcwin, Dstwin, sby, sbx, dby, dbx, dey, dex, Overlay)); +} diff --git a/usr/src/lib/libcurses/screen/pair_cont.c b/usr/src/lib/libcurses/screen/pair_cont.c new file mode 100644 index 0000000000..931de2bc58 --- /dev/null +++ b/usr/src/lib/libcurses/screen/pair_cont.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +pair_content(short pair, short *f, short *b) +{ + _Color_pair *ptp; + + if (pair < 1 || pair >= COLOR_PAIRS || + (ptp = cur_term->_pairs_tbl) == (_Color_pair *) NULL) + return (ERR); + + ptp += pair; + + if (!ptp->init) + return (ERR); + + *f = ptp->foreground; + *b = ptp->background; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/pechochar.c b/usr/src/lib/libcurses/screen/pechochar.c new file mode 100644 index 0000000000..ad08b9366e --- /dev/null +++ b/usr/src/lib/libcurses/screen/pechochar.c @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * These routines short-circuit much of the innards of curses in order to get + * a single character output to the screen quickly! + * + * pechochar(WINDOW *pad, chtype ch) is functionally equivalent to + * waddch(WINDOW *pad, chtype ch), prefresh(WINDOW *pad, `the same arguments + * as in the last prefresh or pnoutrefresh') + */ + +#include <sys/types.h> +#include "curses_inc.h" + +int +pechochar(WINDOW *pad, chtype ch) +{ + WINDOW *padwin; + int rv; + + /* + * If pad->_padwin exists(meaning that p*refresh have been + * previously called), call wechochar on it. Otherwise, call + * wechochar on the pad itself + */ + + if ((padwin = pad->_padwin) != NULL) { + padwin->_cury = pad->_cury - padwin->_pary; + padwin->_curx = pad->_curx - padwin->_parx; + rv = wechochar(padwin, ch); + pad->_cury = padwin->_cury + padwin->_pary; + pad->_curx = padwin->_curx + padwin->_parx; + return (rv); + } else + return (wechochar(pad, ch)); +} diff --git a/usr/src/lib/libcurses/screen/pechowchar.c b/usr/src/lib/libcurses/screen/pechowchar.c new file mode 100644 index 0000000000..cfb6d49276 --- /dev/null +++ b/usr/src/lib/libcurses/screen/pechowchar.c @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * These routines short-circuit much of the innards of curses in order to get + * a single character output to the screen quickly! + * + * pechochar(WINDOW *pad, chtype ch) is functionally equivalent to + * waddch(WINDOW *pad, chtype ch), prefresh(WINDOW *pad, `the same arguments + * as in the last prefresh or pnoutrefresh') + */ + +#include <sys/types.h> +#include "curses_inc.h" + +int +pechowchar(WINDOW *pad, chtype ch) +{ + WINDOW *padwin; + int rv; + + /* + * If pad->_padwin exists(meaning that p*refresh have been + * previously called), call wechochar on it. Otherwise, call + * wechochar on the pad itself + */ + + if ((padwin = pad->_padwin) != NULL) { + padwin->_cury = pad->_cury - padwin->_pary; + padwin->_curx = pad->_curx - padwin->_parx; + rv = wechowchar(padwin, ch); + pad->_cury = padwin->_cury + padwin->_pary; + pad->_curx = padwin->_curx + padwin->_parx; + return (rv); + } else + return (wechowchar(pad, ch)); +} diff --git a/usr/src/lib/libcurses/screen/pnoutref.c b/usr/src/lib/libcurses/screen/pnoutref.c new file mode 100644 index 0000000000..52588c7b9a --- /dev/null +++ b/usr/src/lib/libcurses/screen/pnoutref.c @@ -0,0 +1,53 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* wnoutrefresh for pads. */ + +int +pnoutrefresh(WINDOW *pad, int pby, int pbx, int sby, int sbx, int sey, int sex) +{ + return (_prefresh(wnoutrefresh, pad, pby, pbx, sby, sbx, sey, sex)); +} diff --git a/usr/src/lib/libcurses/screen/prefresh.c b/usr/src/lib/libcurses/screen/prefresh.c new file mode 100644 index 0000000000..cac4cb9dfb --- /dev/null +++ b/usr/src/lib/libcurses/screen/prefresh.c @@ -0,0 +1,188 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +/* + * Pad refresh. These routines are provided for upward compatibility + * with the 'pad' structure of Sys V.2. Since windows now can be of + * arbitrary size and derived windows can be moved within their + * parent windows effortlessly, a separate notion of 'pad' as + * a larger-than-screen window is no longer necessary. + * + * pminy, pminx: the area (pminy, pminx, maxy, maxx) of pad is refreshed + * sminy, sminx, smaxy, smaxx: the screen area to be affected. + */ + +int +prefresh(WINDOW *pad, int pminy, int pminx, int sminy, + int sminx, int smaxy, int smaxx) +{ + return (_prefresh(wrefresh, pad, pminy, pminx, sminy, + sminx, smaxy, smaxx)); +} + +int +_prefresh(int (*func)(WINDOW *), WINDOW *pad, int pminy, int pminx, + int sminy, int sminx, int smaxy, int smaxx) +{ + + /* + * If pad->_padwin doesn't exist(meaning that this is + * the first call to p*refresh) create it as a derived window + */ + + if (!pad->_padwin) { + if ((pad->_padwin = derwin(pad, pad->_maxy, pad->_maxx, + 0, 0)) == NULL) { + goto bad; + } + /* else pad->_padwin->_use_idl = TRUE; */ + + /* + * The following makes parent window to run in fast mode + * by creating an illusion that it has no derived windows + */ + + pad->_ndescs--; + } + + if (_padjust(pad, pminy, pminx, sminy, sminx, smaxy, smaxx) == ERR) +bad: + return (ERR); + + (*func)(pad->_padwin); + return (OK); +} + +int +_padjust(WINDOW *pad, int pminy, int pminx, int sminy, + int sminx, int smaxy, int smaxx) +{ + short prows, pcols, y; + WINDOW *padwin = pad->_padwin; + chtype **p_y, **o_y; + + /* make sure the area requested to be updated is on the pad */ + + if ((pminy >= pad->_maxy) || (pminx >= pad->_maxx)) + return (ERR); + + /* determine the area of the pad to be updated */ + + if (pminy < 0) + pminy = 0; + if (pminx < 0) + pminx = 0; + + /* determine the screen area affected */ + + if (sminy < 0) + sminy = 0; + if (sminx < 0) + sminx = 0; + if (smaxy < sminy) + smaxy = LINES - 1; + if (smaxx < sminx) + smaxx = COLS - 1; + + /* + * Modify the area of the pad to be updated taking into + * consideration screen parameters. + */ + + if ((prows = (smaxy - sminy) + 1) > (y = pad->_maxy - pminy)) + prows = y; + if ((pcols = (smaxx - sminx) + 1) > (y = pad->_maxx - pminx)) + pcols = y; + + if (((padwin->_cury = pad->_cury - pminy) < 0) || + (padwin->_cury >= prows)) + padwin->_cury = 0; + if (((padwin->_curx = pad->_curx - pminx) < 0) || + (padwin->_curx >= pcols)) + padwin->_curx = 0; + + padwin->_leave = pad->_leave; + padwin->_use_idl = pad->_use_idl; + + + /* + * If padwin refers to the same derwin, return. Otherwise + * update the coordinates and malloc'ed areas of the padwin + */ + + if ((padwin->_begy == sminy) && (padwin->_begx == sminx) && + (padwin->_maxy == prows) && (padwin->_maxx == pcols) && + (padwin->_y[0] == (pad->_y[pminy] + pminx)) && + (!(pad->_flags & _WINSDEL))) { + goto good; + } + + /* update the coordinates of the pad */ + + padwin->_maxy = prows; + padwin->_maxx = pcols; + /* LINTED */ + padwin->_begy = (short)sminy; + /* LINTED */ + padwin->_begx = (short)sminx; + /* LINTED */ + padwin->_pary = (short)pminy; + /* LINTED */ + padwin->_parx = (short)pminx; + + /* update the malloc'ed areas */ + + p_y = padwin->_y; + o_y = pad->_y; + + for (y = 0; y < prows; y++, pminy++) + p_y[y] = o_y[pminy] + pminx; + + (void) wtouchln(padwin, 0, prows, TRUE); +good: + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/print.c b/usr/src/lib/libcurses/screen/print.c new file mode 100644 index 0000000000..870515a0e3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/print.c @@ -0,0 +1,712 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2001 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" +#include "print.h" +#include <signal.h> /* use this file to determine if this is SVR4.0 system */ + +#ifdef SIGSTOP /* SVR4.0 and beyond */ +#define _ULIBTI "/usr/share/lib/terminfo" +#else +#define _ULIBTI "/usr/lib/terminfo" +#endif + +char *progname; + +/* global variables */ +static enum printtypes printing = pr_none; +static int onecolumn = 0; /* print a single column */ +static int width = 60; /* width of multi-column printing */ +static int restrictterm = 1; /* restrict termcap names */ + +/* local variables */ +static int printed = 0; +static size_t caplen = 0; + +void +pr_init(enum printtypes type) +{ + printing = type; +} + +void +pr_onecolumn(int onoff) +{ + onecolumn = onoff; +} + +void +pr_width(int nwidth) +{ + if (nwidth > 0) + width = nwidth; +} + +void +pr_caprestrict(int onoff) +{ + restrictterm = onoff; +} + +static char capbools[] = + "ambsbwdadbeoeshchshzinkmmimsncnsosptulxbxnxoxsxt"; +static int ncapbools = sizeof (capbools) / sizeof (capbools[0]); + +static char capnums[] = + "codBdCdFdNdTknlipbsgug"; +static int ncapnums = sizeof (capnums) / sizeof (capnums[0]); + +static char capstrs[] = + "ALDCDLDOICLERISFSRUPaealasbcbtcdcechclcmcsctcvdcdldmdsedeifshoi1i2i" + "cifimipisk0k1k2k3k4k5k6k7k8k9kbkdkekhklkokrkskul0l1l2l3l4l5l6l7l" + "8l9ndnlpcr1r2r3rcrfrpscsesosrsttetitsucueupusvbvevivs"; +static int ncapstrs = sizeof (capstrs) / sizeof (capstrs[0]); + +static int +findcapname(char *capname, char *caplist, int listsize) +{ + int low = 0, mid, high = listsize - 2; + while (low <= high) { + mid = (low + high) / 4 * 2; + if (capname[0] == caplist[mid]) { + if (capname[1] == caplist[mid + 1]) + return (1); + else if (capname[1] < caplist[mid + 1]) + high = mid - 2; + else + low = mid + 2; + } else if (capname[0] < caplist[mid]) + high = mid - 2; + else + low = mid + 2; + } + return (0); +/* + * for (; *caplist; caplist += 2) + * if (caplist[0] == capname[0] && caplist[1] == capname[1]) + * return (1); + * return (0); + */ +} + +/* + * Print out the first line of an entry. + */ +void +pr_heading(char *term, char *synonyms) +{ + int do_print = 0; /* Can we print the path of the file ? */ + char buffer[512]; /* Holds search pathname */ + FILE *work_fp; /* Used to try and open the files */ + char tail[4]; /* Used for terminfo pathname suffix */ + char *terminfo; /* The value of $TERMINFO */ + + + /* + * Try to obtain $TERMINFO + */ + terminfo = getenv("TERMINFO"); + + if (term == (char *)0) + term = ""; + /* + * Build the suffix for this device + */ + tail[0] = '/'; + tail[1] = *term; + tail[2] = '/'; + tail[3] = '\0'; + + /* + * If we have it - use it, otherwise use /usr/share/lib/terminfo + * as base directory + */ + if (terminfo != NULL) + (void) sprintf(buffer, "%s%s%s", terminfo, tail, term); + else + (void) sprintf(buffer, "%s%s%s", _ULIBTI, tail, term); + + /* + * Attempt to open the file. + */ + if ((work_fp = fopen(buffer, "r")) == NULL) { + /* + * Open failed. If we were looking in /usr/share/lib/terminfo + * we are done, otherwise look there next. + */ + if (strncmp(buffer, _ULIBTI, strlen(_ULIBTI)) == 0) { + /* + * We are done. Not in /usr/share/lib/terminfo, + * and $TERMINFO is not set. + */ + (void) fprintf(stderr, "Error: Term \"%s\" not " + "found in %s\n", term, _ULIBTI); + } else { + /* + * Check /usr/share/lib/terminfo last. If this fails, + * all hope is lost as we know it is not in $TERMINFO. + */ + (void) sprintf(buffer, "%s%s%s", _ULIBTI, tail, term); + + if ((work_fp = fopen(buffer, "r")) == NULL) { + /* + * All hope is lost + */ + (void) fprintf(stderr, "Error: Term \"%s\" not " + "found in %s or %s\n", term, _ULIBTI, + getenv("TERMINFO")); + } else do_print = 1; + } + } else do_print = 1; + + /* + * If we found it - print the comment(after closing the file) + */ + if (do_print && *term) { + (void) fclose(work_fp); + (void) printf("# Reconstructed via infocmp from file: " + "%s\n", buffer); + } + + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s,\n", synonyms); + break; + case (int)pr_cap: + (void) printf("%s:\\\n", synonyms); + caplen = strlen(synonyms) + 1; + break; + case (int)pr_longnames: + (void) printf("Terminal type %s\n", term); + (void) printf(" %s\n", synonyms); + break; + } +} + +void +pr_bheading(void) +{ + if (printing == pr_longnames) + (void) printf("flags\n"); + printed = 0; +} + +void +pr_boolean(char *infoname, char *capname, char *fullname, int value) +{ + int vlen; + size_t nlen; + + if (printing == pr_cap && restrictterm && + !findcapname(capname, capbools, ncapbools)) + return; + + if (onecolumn) { + if (value < 0) + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s@,\n", infoname); + break; + case (int)pr_cap: + (void) printf("\t:%s@:\\\n", capname); + caplen += 4 + strlen(capname); + break; + case (int)pr_longnames: + (void) printf(" %s@\n", fullname); + } + else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s,\n", infoname); + break; + case (int)pr_cap: + (void) printf("\t:%s:\\\n", capname); + caplen += 3 + strlen(capname); + break; + case (int)pr_longnames: + (void) printf(" %s\n", fullname); + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: nlen = strlen(infoname); + break; + case (int)pr_cap: nlen = strlen(capname); + break; + case (int)pr_longnames: + nlen = strlen(fullname); + break; + } + vlen = (value < 0) ? 1 : 0; + if ((printed > 0) && (printed + nlen + vlen + 1 > width)) { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\\\n"); + caplen += 1; + } + printed = 0; + } + if (printed == 0) { + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t"); + printed = 8; + break; + case (int)pr_cap: + (void) printf("\t:"); + printed = 9; + caplen += 2; + break; + case (int)pr_longnames: + (void) printf(" "); + printed = 2; + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf(" "); + break; + case (int)pr_cap: + (void) printf(":"); + caplen += 1; + } + printed++; + } + if (value < 0) + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s@,", infoname); + printed += nlen + 2; + break; + case (int)pr_cap: + (void) printf("%s@", capname); + printed += nlen + 1; + caplen += nlen + 1; + break; + case (int)pr_longnames: + (void) printf("%s@,", fullname); + printed += nlen + 2; + } + else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s,", infoname); + printed += nlen + 1; + break; + case (int)pr_cap: + (void) printf("%s", capname); + printed += nlen; + caplen += nlen; + break; + case (int)pr_longnames: + (void) printf("%s,", fullname); + printed += nlen + 1; + } + } +} + +void +pr_bfooting(void) +{ + if (!onecolumn && (printed > 0)) + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\\\n"); + caplen += 1; + } +} + +void +pr_nheading(void) +{ + if (printing == pr_longnames) + (void) printf("\nnumbers\n"); + printed = 0; +} + +/* + * Return the length of the number if it were printed out + * with %d. The number is guaranteed to be in the range + * 0..maxshort. + */ +static int +digitlen(int value) +{ + return (value >= 10000 ? 5 : + value >= 1000 ? 4 : + value >= 100 ? 3 : + value >= 10 ? 2 : + value >= 0 ? 1 : 0); +} + +void +pr_number(char *infoname, char *capname, char *fullname, int value) +{ + int vlen; + size_t nlen; + + if (printing == pr_cap && restrictterm && + !findcapname(capname, capnums, ncapnums)) + return; + + if (onecolumn) { + if (value < 0) + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s@,\n", infoname); + break; + case (int)pr_cap: + (void) printf("\t:%s@:\\\n", capname); + caplen += 4 + strlen(capname); + break; + case (int)pr_longnames: + (void) printf(" %s @\n", fullname); + } + else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s#%d,\n", infoname, + value); + break; + case (int)pr_cap: + (void) printf("\t:%s#%d:\\\n", + capname, value); + caplen += 4 + strlen(capname) + + digitlen(value); + break; + case (int)pr_longnames: + (void) printf(" %s = %d\n", fullname, + value); + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: + nlen = strlen(infoname); + break; + case (int)pr_cap: + nlen = strlen(capname); + break; + case (int)pr_longnames: + nlen = strlen(fullname); + break; + } + vlen = digitlen(value); + if ((printed > 0) && (printed + nlen + vlen + 2 > width)) { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\\\n"); + caplen += 1; + } + printed = 0; + } + if (printed == 0) { + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t"); + printed = 8; + break; + case (int)pr_cap: + (void) printf("\t:"); + printed = 9; + caplen += 2; + break; + case (int)pr_longnames: + (void) printf(" "); + printed = 2; + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf(" "); + break; + case (int)pr_cap: + (void) printf(":"); + caplen += 1; + } + printed++; + } + if (value < 0) { + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s@,", infoname); + printed += nlen + 2; + break; + case (int)pr_cap: + (void) printf("%s@", capname); + printed += nlen + 1; + caplen += nlen + 1; + break; + case (int)pr_longnames: + (void) printf("%s@,", fullname); + printed += nlen + 2; + } + } else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s#%d,", infoname, + value); + printed += nlen + vlen + 2; + break; + case (int)pr_cap: + (void) printf("%s#%d", capname, value); + printed += nlen + vlen + 1; + caplen += nlen + vlen + 1; + break; + case (int)pr_longnames: + (void) printf("%s = %d,", fullname, + value); + printed += nlen + vlen + 4; + } + } +} + +void +pr_nfooting(void) +{ + if (!onecolumn && (printed > 0)) + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\\\n"); + caplen += 1; + } +} + +void +pr_sheading(void) +{ + if (printing == pr_longnames) + (void) printf("\nstrings\n"); + printed = 0; +} + +void +pr_string(char *infoname, char *capname, char *fullname, char *value) +{ + char *evalue; + int badcapvalue; + size_t nlen, vlen; + + if (printing == pr_cap) { + if (restrictterm && !findcapname(capname, capstrs, ncapstrs)) + return; + if (value) + value = infotocap(value, &badcapvalue); + } + + if (onecolumn) { + if (value == NULL) + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s@,\n", infoname); + break; + case (int)pr_cap: + (void) printf("\t:%s@:\\\n", capname); + caplen += 4 + strlen(capname); + break; + case (int)pr_longnames: + (void) printf(" %s@\n", fullname); + } + else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t%s=", infoname); + tpr(stdout, value); + (void) printf(",\n"); + break; + case (int)pr_cap: + (void) printf("\t:%s%s=", + badcapvalue ? "." : "", capname); + caplen += 3 + strlen(capname) + + (badcapvalue ? 1 : 0); + caplen += cpr(stdout, value); + (void) printf(":\\\n"); + caplen += 1; + break; + case (int)pr_longnames: + (void) printf(" %s = '", fullname); + tpr(stdout, value); + (void) printf("'\n"); + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: + nlen = strlen(infoname); + break; + case (int)pr_cap: + nlen = strlen(capname); + if (badcapvalue) + nlen++; + break; + case (int)pr_longnames: + nlen = strlen(fullname); + } + if (value == NULL) + vlen = 1; + else + if (printing == pr_cap) + vlen = strlen(evalue = cexpand(value)); + else + vlen = strlen(evalue = iexpand(value)); + if ((printed > 0) && (printed + nlen + vlen + 1 > width)) { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\\\n"); + caplen += 1; + } + printed = 0; + } + if (printed == 0) { + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("\t"); + printed = 8; + break; + case (int)pr_cap: + (void) printf("\t:"); + printed = 9; + caplen += 2; + break; + case (int)pr_longnames: + (void) printf(" "); + printed = 2; + } + } else { + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf(" "); + break; + case (int)pr_cap: + (void) printf(":"); + caplen += 1; + } + printed++; + } + if (value == NULL) { + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s@,", infoname); + printed += nlen + 2; + break; + case (int)pr_cap: + (void) printf("%s@", capname); + printed += nlen + 1; + caplen += nlen + 1; + break; + case (int)pr_longnames: + (void) printf("%s@,", fullname); + printed += nlen + 2; + } + } else + switch ((int)printing) { + case (int)pr_terminfo: + (void) printf("%s=%s,", infoname, + evalue); + printed += nlen + vlen + 2; + break; + case (int)pr_cap: + if (badcapvalue) { + (void) printf("."); + caplen += 1; + } + (void) printf("%s=%s", capname, + evalue); + printed += nlen + vlen + 1; + caplen += nlen + vlen + 1; + break; + case (int)pr_longnames: + (void) printf("%s = '%s',", fullname, + evalue); + printed += nlen + vlen + 6; + } + } +} + +void +pr_sfooting(void) +{ + if (onecolumn) { + if (printing == pr_cap) + (void) printf("\n"); + } else { + if (printed > 0) + switch ((int)printing) { + case (int)pr_terminfo: + case (int)pr_longnames: + (void) printf("\n"); + break; + case (int)pr_cap: + (void) printf(":\n"); + caplen += 1; + } + } + if (caplen >= 1024) { + (void) fprintf(stderr, "%s: WARNING: termcap entry is too " + "long!\n", progname); + } + + if (printing == pr_longnames) + (void) printf("end of strings\n"); +} diff --git a/usr/src/lib/libcurses/screen/print.h b/usr/src/lib/libcurses/screen/print.h new file mode 100644 index 0000000000..f48c3f3f75 --- /dev/null +++ b/usr/src/lib/libcurses/screen/print.h @@ -0,0 +1,85 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + + +#ifndef _PRINT_H +#define _PRINT_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +/* externs from iexpand.c, cexpand.c */ +extern void tpr(FILE *, char *); +extern int cpr(FILE *, char *); +extern char *cexpand(char *), *iexpand(char *), + *cconvert(char *), *rmpadding(char *, char *, int *); + +/* externs from print.c */ +enum printtypes + { + pr_none, + pr_terminfo, /* print terminfo listing */ + pr_cap, /* print termcap listing */ + pr_longnames /* print C variable name listing */ +}; + +extern void pr_onecolumn(int); +extern void pr_caprestrict(int); +extern void pr_width(int); +extern void pr_init(enum printtypes); +extern void pr_heading(char *, char *); +extern void pr_bheading(void); +extern void pr_boolean(char *, char *, char *, int); +extern void pr_bfooting(void); +extern void pr_nheading(void); +extern void pr_number(char *, char *, char *, int); +extern void pr_nfooting(void); +extern void pr_sheading(void); +extern void pr_string(char *, char *, char *, char *); +extern void pr_sfooting(void); +extern char *progname; + +#ifdef __cplusplus +} +#endif + +#endif /* _PRINT_H */ diff --git a/usr/src/lib/libcurses/screen/printw.c b/usr/src/lib/libcurses/screen/printw.c new file mode 100644 index 0000000000..880af03cd2 --- /dev/null +++ b/usr/src/lib/libcurses/screen/printw.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * printw and friends + * + */ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine implements a printf on the standard screen. + */ +/*VARARGS1*/ +int +printw(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + return (vwprintw(stdscr, fmt, ap)); +} diff --git a/usr/src/lib/libcurses/screen/putp.c b/usr/src/lib/libcurses/screen/putp.c new file mode 100644 index 0000000000..bd54431d19 --- /dev/null +++ b/usr/src/lib/libcurses/screen/putp.c @@ -0,0 +1,82 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Handy functions to put out a string with padding. + * These make two assumptions: + * (1) Output is via stdio to stdout through putchar. + * (2) There is no count of affected lines. Thus, this + * routine is only valid for certain capabilities, + * i.e. those that don't have *'s in the documentation. + */ +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Routine to act like putchar for passing to tputs. + * _outchar should really be a void since it's used by tputs + * and tputs doesn't look at return code. However, tputs also has the function + * pointer declared as returning an int so we didn't change it. + */ +int +_outchar(char ch) +{ + (void) putchar(ch); + return (0); +} + +/* Handy way to output a string. */ + +int +putp(char *str) +{ + return (tputs(str, 1, _outchar)); +} + +/* Handy way to output video attributes. */ + +int +vidattr(chtype newmode) +{ + return (vidputs(newmode, _outchar)); +} diff --git a/usr/src/lib/libcurses/screen/putwin.c b/usr/src/lib/libcurses/screen/putwin.c new file mode 100644 index 0000000000..115bbd811b --- /dev/null +++ b/usr/src/lib/libcurses/screen/putwin.c @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Write a window to a file. + * + * win: the window to write out. + * filep: the file to write to. + */ + +int +putwin(WINDOW *win, FILE *filep) +{ + int maxx, nelt; + chtype **wcp, **ecp; + + /* write everything from _cury to _bkgd inclusive */ + nelt = sizeof (WINDOW) - sizeof (win->_y) - sizeof (win->_parent) - + sizeof (win->_parx) - sizeof (win->_pary) - + sizeof (win->_ndescs) - sizeof (win->_delay); + + if (fwrite((char *) &(win->_cury), 1, nelt, filep) != nelt) + goto err; + + /* Write the character image */ + maxx = win->_maxx; + ecp = (wcp = win->_y) + win->_maxy; + while (wcp < ecp) + if (fwrite((char *) *wcp++, sizeof (chtype), + maxx, filep) != maxx) +err: + return (ERR); + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/quick_echo.c b/usr/src/lib/libcurses/screen/quick_echo.c new file mode 100644 index 0000000000..366f11de74 --- /dev/null +++ b/usr/src/lib/libcurses/screen/quick_echo.c @@ -0,0 +1,102 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +extern int outchcount; + +/* + * These routines short-circuit much of the innards of curses in order to get + * a single character output to the screen quickly! It is used by waddch(). + */ + +int +_quick_echo(WINDOW *win, chtype ch) +{ + short y = win->_cury; + short SPy = y + win->_begy + win->_yoffset; + short SPx = (win->_curx - 1) + win->_begx; + chtype rawc = _CHAR(ch), rawattrs = _ATTR(ch); + + if ((curscr->_flags & _CANT_BE_IMMED) || + (win->_flags & _WINCHANGED) || + (win->_clear) || (curscr->_clear) || + (_virtscr->_flags & _WINCHANGED) || + (SPy > ((LINES + SP->Yabove) - 1)) || (SPx > (COLS - 1)) || + (SP->slk && (SP->slk->_changed == TRUE))) { + win->_flags |= _WINCHANGED; + return (wrefresh(win)); + } + + outchcount = 0; + win->_firstch[y] = _INFINITY; + win->_lastch[y] = -1; + /* If the cursor is not in the right place, put it there! */ + if ((SPy != curscr->_cury) || (SPx != curscr->_curx)) { + (void) mvcur(curscr->_cury, curscr->_curx, SPy, SPx); + curscr->_cury = SPy; + } + curscr->_curx = SPx + 1; + _CURHASH[SPy] = _NOHASH; + if (ch != ' ') { + if (SPx > _ENDNS[SPy]) + _ENDNS[SPy] = SPx; + if (SPx < _BEGNS[SPy]) + _BEGNS[SPy] = SPx; + } + _virtscr->_y[SPy][SPx] = curscr->_y[SPy][SPx] = ch; + + if (rawattrs != curscr->_attrs) + _VIDS(rawattrs, curscr->_attrs); + + if (SP->phys_irm) + _OFFINSERT(); + + /* Write it out! */ + /* LINTED */ + (void) _outch((char) rawc); + (void) fflush(SP->term_file); + + return (outchcount); +} diff --git a/usr/src/lib/libcurses/screen/raw.c b/usr/src/lib/libcurses/screen/raw.c new file mode 100644 index 0000000000..3653964b57 --- /dev/null +++ b/usr/src/lib/libcurses/screen/raw.c @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ +#include <sys/types.h> +#include "curses_inc.h" + +int +raw(void) +{ +#ifdef SYSV + /* Disable interrupt characters */ + PROGTTYS.c_lflag &= ~(ISIG|ICANON); + PROGTTYS.c_cc[VMIN] = 1; + PROGTTYS.c_cc[VTIME] = 0; + PROGTTYS.c_iflag &= ~IXON; +#else + PROGTTY.sg_flags &= ~CBREAK; + PROGTTY.sg_flags |= RAW; +#endif + +#ifdef DEBUG +#ifdef SYSV + if (outf) + fprintf(outf, "raw(), file %x, iflag %x, cflag %x\n", + cur_term->Filedes, PROGTTYS.c_iflag, PROGTTYS.c_cflag); +#else + if (outf) + fprintf(outf, "raw(), file %x, flags %x\n", + cur_term->Filedes, PROGTTY.sg_flags); +#endif /* SYSV */ +#endif + + if (!needs_xon_xoff) + xon_xoff = 0; /* Cannot use xon/xoff in raw mode */ + cur_term->_fl_rawmode = 2; + cur_term->_delay = -1; + (void) reset_prog_mode(); +#ifdef FIONREAD + cur_term->timeout = 0; +#endif /* FIONREAD */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/redrawwin.c b/usr/src/lib/libcurses/screen/redrawwin.c new file mode 100644 index 0000000000..ec6d824b00 --- /dev/null +++ b/usr/src/lib/libcurses/screen/redrawwin.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +redrawwin(WINDOW *win) +{ + return (wredrawln(win, 0, win->_maxy)); +} diff --git a/usr/src/lib/libcurses/screen/reset_sh.c b/usr/src/lib/libcurses/screen/reset_sh.c new file mode 100644 index 0000000000..27503eb974 --- /dev/null +++ b/usr/src/lib/libcurses/screen/reset_sh.c @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <unistd.h> +#include "curses_inc.h" + +int +reset_shell_mode(void) +{ +#ifdef DIOCSETT + /* + * Restore any virtual terminal setting. This must be done + * before the TIOCSETN because DIOCSETT will clobber flags like xtabs. + */ + cur_term -> old.st_flgs |= TM_SET; + (void) ioctl(cur_term->Filedes, DIOCSETT, &cur_term -> old); +#endif /* DIOCSETT */ +#ifdef SYSV + if (_BRS(SHELLTTYS)) { + if (shell_istermios < 0) { + int i; + + SHELLTTY.c_lflag = SHELLTTYS.c_lflag; + SHELLTTY.c_oflag = SHELLTTYS.c_oflag; + SHELLTTY.c_iflag = SHELLTTYS.c_iflag; + SHELLTTY.c_cflag = SHELLTTYS.c_cflag; + for (i = 0; i < NCC; i++) + SHELLTTY.c_cc[i] = SHELLTTYS.c_cc[i]; + (void) ioctl(cur_term -> Filedes, TCSETAW, &SHELLTTY); + } else + (void) ioctl(cur_term -> Filedes, TCSETSW, &SHELLTTYS); +#ifdef LTILDE + if (cur_term -> newlmode != cur_term -> oldlmode) + (void) ioctl(cur_term -> Filedes, TIOCLSET, + &cur_term -> oldlmode); +#endif /* LTILDE */ + } +#else /* SYSV */ + if (_BR(SHELLTTY)) { + (void) ioctl(cur_term -> Filedes, TIOCSETN, &SHELLTTY); +#ifdef LTILDE + if (cur_term -> newlmode != cur_term -> oldlmode) + (void) ioctl(cur_term -> Filedes, TIOCLSET, + &cur_term -> oldlmode); +#endif /* LTILDE */ + } +#endif /* SYSV */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/resetty.c b/usr/src/lib/libcurses/screen/resetty.c new file mode 100644 index 0000000000..591da0a325 --- /dev/null +++ b/usr/src/lib/libcurses/screen/resetty.c @@ -0,0 +1,94 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +resetty(void) +{ +#ifdef SYSV + if ((_BRS(SP->save_tty_bufs)) != 0) { + PROGTTYS = SP->save_tty_bufs; + prog_istermios = 0; +#ifdef DEBUG + if (outf) + fprintf(outf, "resetty(), file %x, SP %x, flags %x, " + "%x, %x, %x\n", cur_term->Filedes, SP, + PROGTTYS.c_iflag, PROGTTYS.c_oflag, + PROGTTYS.c_cflag, PROGTTYS.c_lflag); +#endif /* DEBUG */ + (void) reset_prog_mode(); + } else if ((_BR(SP->save_tty_buf)) != 0) { + int i; + + PROGTTY = SP->save_tty_buf; + prog_istermios = -1; +#ifdef DEBUG + if (outf) + fprintf(outf, "resetty(), file %x, SP %x, flags %x, " + "%x, %x, %x\n", cur_term->Filedes, SP, + PROGTTY.c_iflag, PROGTTY.c_oflag, + PROGTTY.c_cflag, PROGTTY.c_lflag); +#endif /* DEBUG */ + PROGTTYS.c_lflag = PROGTTY.c_lflag; + PROGTTYS.c_oflag = PROGTTY.c_oflag; + PROGTTYS.c_iflag = PROGTTY.c_iflag; + PROGTTYS.c_cflag = PROGTTY.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTYS.c_cc[i] = PROGTTY.c_cc[i]; + (void) reset_prog_mode(); + } +#else /* SYSV */ + if ((_BR(SP->save_tty_buf)) != 0) { + PROGTTY = SP->save_tty_buf; +#ifdef DEBUG + if (outf) + fprintf(outf, "resetty(), file %x, SP %x, flags %x\n", + cur_term->Filedes, SP, PROGTTY.sg_flags); +#endif /* DEBUG */ + (void) reset_prog_mode(); + } +#endif /* SYSV */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/restart.c b/usr/src/lib/libcurses/screen/restart.c new file mode 100644 index 0000000000..69a143c7ed --- /dev/null +++ b/usr/src/lib/libcurses/screen/restart.c @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * This is useful after saving/restoring memory from a file (e.g. as + * in a rogue save game). It assumes that the modes and windows are + * as wanted by the user, but the terminal type and baud rate may + * have changed. + */ + +extern char _called_before; + +int +/* The next line causes a lint warning because errret is not used */ +restartterm(char *term, int filenum, int *errret) +/* int filenum - This is a UNIX file descriptor, not a stdio ptr. */ +{ + int saveecho = SP->fl_echoit; + int savecbreak = cur_term->_fl_rawmode; + int savenl; + +#ifdef SYSV + savenl = PROGTTYS.c_iflag & ONLCR; +#else /* SYSV */ + savenl = PROGTTY.sg_flags & CRMOD; +#endif /* SYSV */ + + _called_before = 0; + (void) setupterm(term, filenum, (int *) 0); + + /* Restore curses settable flags, leaving other stuff alone. */ + SP->fl_echoit = saveecho; + + (void) nocbreak(); + (void) noraw(); + if (savecbreak == 1) + (void) cbreak(); + else + if (savecbreak == 2) + (void) raw(); + + if (savenl) + (void) nl(); + else + (void) nonl(); + + (void) reset_prog_mode(); + + LINES = SP->lsize; + COLS = columns; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/ring.c b/usr/src/lib/libcurses/screen/ring.c new file mode 100644 index 0000000000..d741595962 --- /dev/null +++ b/usr/src/lib/libcurses/screen/ring.c @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +_ring(bool bf) +{ + static char offsets[2] = {45 /* flash_screen */, 1 /* bell */ }; + char **str_array = (char **) cur_strs; +#ifdef DEBUG + if (outf) + fprintf(outf, "_ring().\n"); +#endif /* DEBUG */ + _PUTS(str_array[offsets[bf]] ? str_array[offsets[bf]] : + str_array[offsets[1 - bf]], 0); + (void) fflush(SP->term_file); + if (_INPUTPENDING) + (void) doupdate(); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/ripoffline.c b/usr/src/lib/libcurses/screen/ripoffline.c new file mode 100644 index 0000000000..a1662a4530 --- /dev/null +++ b/usr/src/lib/libcurses/screen/ripoffline.c @@ -0,0 +1,98 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * This routine is used by initialization routines. It sets it up + * such that a line is removed from the user's screen by initscr. This + * function must be called BEFORE initscr. It works by leaving a cookie + * which tells initscr to reduce the size of stdscr by one for each line + * ripped off. This routine has been generalized so that other applications + * can make use of it in a straightforward manner. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +static struct _ripdef +{ + int line; + int (*initfunction)(WINDOW *, int); +} _ripstruct[5]; + +static char _ripcounter; + +static void +_init_rip_func(void) +{ + int i, flag; + + for (i = 0; i < _ripcounter; i++) { + LINES = --SP->lsize; +/* + * We don't need to check for newwin returning NULL because even if + * we did and broke from the for loop, the application's initfunction + * would not be called and they would have a NULL window pointer. Their + * code would then blow up if they don't check it anyway. Therefore, + * we can send in the newwin and their code has to check for NULL in either + * case. + * + * NOTE: The application has the responsibilty to do a delwin !!! + */ + (*_ripstruct[i].initfunction) (newwin(1, COLS, + ((flag = _ripstruct[i].line) > 0) ? 0 : LINES, 0), COLS); + if (flag > 0) + SP->Yabove++; + } + _ripcounter = 0; +} + +int +ripoffline(int line, int (*initfunction)(WINDOW *, int)) +{ + if (_ripcounter < 5) { + _ripstruct[_ripcounter].line = line; + _ripstruct[_ripcounter++].initfunction = initfunction; + } + _rip_init = _init_rip_func; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/savetty.c b/usr/src/lib/libcurses/screen/savetty.c new file mode 100644 index 0000000000..b652015661 --- /dev/null +++ b/usr/src/lib/libcurses/screen/savetty.c @@ -0,0 +1,83 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Routines to deal with setting and resetting modes in the tty driver. + * See also setupterm.c in the termlib part. + */ +#include <sys/types.h> +#include "curses_inc.h" + +int +savetty(void) +{ +#ifdef SYSV + if (prog_istermios < 0) { + int i; + + PROGTTY.c_lflag = PROGTTYS.c_lflag; + PROGTTY.c_oflag = PROGTTYS.c_oflag; + PROGTTY.c_iflag = PROGTTYS.c_iflag; + PROGTTY.c_cflag = PROGTTYS.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTY.c_cc[i] = PROGTTYS.c_cc[i]; + SP->save_tty_buf = PROGTTY; + } else + SP->save_tty_bufs = PROGTTYS; +#else /* SYSV */ + SP->save_tty_buf = PROGTTY; +#endif /* SYSV */ +#ifdef DEBUG +#ifdef SYSV + if (outf) + fprintf(outf, "savetty(), file %x, SP %x, flags %x,%x,%x,%x\n", + cur_term->Filedes, SP, PROGTTYS.c_iflag, PROGTTYS.c_oflag, + PROGTTYS.c_cflag, PROGTTYS.c_lflag); +#else + if (outf) + fprintf(outf, "savetty(), file %x, SP %x, flags %x\n", + cur_term->Filedes, SP, PROGTTY.sg_flags); +#endif +#endif + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/scanw.c b/usr/src/lib/libcurses/screen/scanw.c new file mode 100644 index 0000000000..6a9faf804d --- /dev/null +++ b/usr/src/lib/libcurses/screen/scanw.c @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * scanw and friends + * + */ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine implements a scanf on the standard screen. + */ +/*VARARGS1*/ + +int +scanw(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + return (vwscanw(stdscr, fmt, ap)); +} diff --git a/usr/src/lib/libcurses/screen/scr_all.c b/usr/src/lib/libcurses/screen/scr_all.c new file mode 100644 index 0000000000..66c794581b --- /dev/null +++ b/usr/src/lib/libcurses/screen/scr_all.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdio.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* Set <screen> idea of the screen image to that stored in "file". */ + +int +_scr_all(char *file, int which) +{ + int rv; + FILE *filep; + + if ((filep = fopen(file, "r")) == NULL) + return (ERR); + rv = scr_reset(filep, which); + (void) fclose(filep); + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/scr_dump.c b/usr/src/lib/libcurses/screen/scr_dump.c new file mode 100644 index 0000000000..494914f034 --- /dev/null +++ b/usr/src/lib/libcurses/screen/scr_dump.c @@ -0,0 +1,70 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdio.h> +#include "curses_inc.h" + +/* + * Dump a screen image to a file. This routine and scr_reset + * can be used to communicate the screen image across processes. + */ + +int +scr_dump(char *file) +{ + int rv; + FILE *filep; + + if ((filep = fopen(file, "w")) == NULL) { +#ifdef DEBUG + if (outf) + (void) fprintf(outf, "scr_dump: cannot open " + "\"%s\".\n", file); +#endif /* DEBUG */ + return (ERR); + } + rv = scr_ll_dump(filep); + (void) fclose(filep); + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/scr_ll_dump.c b/usr/src/lib/libcurses/screen/scr_ll_dump.c new file mode 100644 index 0000000000..95154b79d0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/scr_ll_dump.c @@ -0,0 +1,137 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +int +scr_ll_dump(FILE *filep) +{ + short magic = SVR3_DUMP_MAGIC_NUMBER, rv = ERR; + char *thistty; + SLK_MAP *slk = SP->slk; + struct stat statbuf; + + if (fwrite((char *) &magic, sizeof (short), 1, filep) != 1) + goto err; + + /* write term name and modification time */ + if ((thistty = ttyname(cur_term->Filedes)) == NULL) + statbuf.st_mtime = 0; + else + (void) stat(thistty, &statbuf); + + if (fwrite((char *) &(statbuf.st_mtime), sizeof (time_t), + 1, filep) != 1) + goto err; + + /* write curscr */ + if (_INPUTPENDING) + (void) force_doupdate(); + if (putwin(curscr, filep) == ERR) + goto err; + + /* next output: 0 no slk, 1 hardware slk, 2 simulated slk */ + + magic = (!slk) ? 0 : (slk->_win) ? 2 : 1; + if (fwrite((char *) &magic, sizeof (int), 1, filep) != 1) + goto err; + if (magic) { + short i, labmax = slk->_num, lablen = slk->_len + 1; + + /* output the soft labels themselves */ + if ((fwrite((char *) &labmax, + sizeof (short), 1, filep) != 1) || + (fwrite((char *) &lablen, sizeof (short), + 1, filep) != 1)) { + goto err; + } + for (i = 0; i < labmax; i++) + if ((fwrite(slk->_ldis[i], sizeof (char), lablen, + filep) != lablen) || (fwrite(slk->_lval[i], + sizeof (char), lablen, filep) != lablen)) { + goto err; + } + } + + /* now write information about colors. Use the following format. */ + /* Line 1 is mandatory, the remaining lines are required only if */ + /* line one is 1. */ + /* line 1: 0 (no colors) or 1 (colors) */ + /* line 2: number of colors, number of color pairs, can_change */ + /* X lines: Contents of colors (r, g, b) */ + /* Y lines: Contents of color-pairs */ + + magic = ((cur_term->_pairs_tbl) ? 1 : 0); + if (fwrite((char *) &magic, sizeof (int), 1, filep) != 1) + goto err; + if (magic) { + /* number of colors and color_pairs */ + if ((fwrite((char *) &COLORS, sizeof (int), 1, filep) != 1) || + (fwrite((char *) &COLOR_PAIRS, sizeof (int), 1, filep) != + 1) || (fwrite((char *) &can_change, sizeof (char), 1, + filep) != 1)) + goto err; + + /* contents of color_table */ + + if (can_change) { + if (fwrite((char *) &(cur_term->_color_tbl->r), + sizeof (_Color), COLORS, filep) != COLORS) + goto err; + } + + /* contents of pairs_table */ + + if (fwrite((char *) &(cur_term->_pairs_tbl->foreground), + sizeof (_Color_pair), COLOR_PAIRS, filep) != COLOR_PAIRS) + goto err; + } + + /* success */ + rv = OK; +err : + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/scr_reset.c b/usr/src/lib/libcurses/screen/scr_reset.c new file mode 100644 index 0000000000..5d5a359fbf --- /dev/null +++ b/usr/src/lib/libcurses/screen/scr_reset.c @@ -0,0 +1,311 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> + +/* + * Initialize the screen image to be the image contained + * in the given file. This is usually used in a child process + * to initialize its idea of the screen image to be that of its + * parent. + * + * filep: pointer to the output stream + * type: 0: <curses> should assume that the physical screen is + * EXACTLY as stored in the file. Therefore, we take + * special care to make sure that /dev/tty and the terminal + * did not change in any way. This information can then + * be used in the update optimization of the new program + * so that the screen does not have to be cleared. Instead, + * curses, by knowing what's on the screen can optimally + * update it with the information of the new program. + * + * 1: Tell <curses> that the stored image should be + * the physical image. Sort of like a huge waddstr onto + * curscr. This can be used when a library wants to save + * a screen image and restore it at a later time. + * + * 2: Tell <curses> that the stored image is the physical + * image and also it is what the new program wants on the + * screen. This can be be thought of as a screen inheritance + * function. + */ + +int +scr_reset(FILE *filep, int type) +{ + WINDOW *win = NULL, *win1 = NULL; + int *hash, y; + char clearit = FALSE; + short magic; + struct stat statbuf; + time_t ttytime; + + if (type != 1 && exit_ca_mode && *exit_ca_mode && non_rev_rmcup) { + if (type == 0) + goto err; + else { +#ifdef DEBUG + if (outf) + fprintf(outf, "clear it because of " + "exit_ca_mode\n"); +#endif /* DEBUG */ + clearit = TRUE; + } + } + + /* check magic number */ + if (fread((char *) &magic, sizeof (short), 1, filep) != 1) + goto err; + if (magic != SVR3_DUMP_MAGIC_NUMBER) + goto err; + + /* get modification time of image in file */ + if (fread((char *) &ttytime, sizeof (time_t), 1, filep) != 1) + goto err; + + if ((type != 1) && ((ttyname(cur_term->Filedes) == NULL) || + (fstat(cur_term->Filedes, &statbuf) < 0) || + (statbuf.st_mtime != ttytime))) { + if (type == 0) + goto err; + else { +#ifdef DEBUG + if (outf) + fprintf(outf, "Filedes = %hd, " + "statbuf.st_mtime = %d, " + "ttytime = %d\n", cur_term->Filedes, + statbuf.st_mtime, ttytime); +#endif /* DEBUG */ + clearit = TRUE; + } + } + + /* if get here, everything is ok, read the curscr image */ + if (((win = getwin(filep)) == NULL) || + ((type == 2) && ((win1 = dupwin(win)) == NULL)) || + (win->_maxy != curscr->_maxy) || (win->_maxx != curscr->_maxx) || + /* soft labels */ + (fread((char *) &magic, sizeof (int), 1, filep) != 1)) + goto err; + + /* + * if soft labels were dumped, we would like either read them + * or advance the file pointer pass them + */ + if (magic) { + short i, labmax, lablen; + SLK_MAP *slk = SP->slk; + /* + * Why doesn't the following line and the two below + * that access those variables work ? + */ + /* + * char **labdis = SP->slk->_ldis, **labval = SP->slk->_lval; + */ + + if ((fread((char *) &labmax, sizeof (short), 1, filep) != 1) || + (fread((char *) &lablen, sizeof (short), 1, filep) != 1)) { + goto err; + } + + if (slk != NULL) { + if ((labmax != slk->_num) || + (lablen != (slk->_len + 1))) + goto err; + + for (i = 0; i < labmax; i++) { + /* + * if ((fread(labdis[i], sizeof (char), lablen, + * filep) != lablen) || + * (fread(labval[i], sizeof (char), lablen, + * filep != lablen)) + */ + if ((fread(slk->_ldis[i], sizeof (char), + lablen, filep) != lablen) || + (fread(slk->_lval[i], + sizeof (char), lablen, filep) != lablen)) { + goto err; + } + } + (*_do_slk_tch)(); + } else { + if (fseek(filep, (long) (2 * labmax * lablen * + sizeof (char)), 1) != 0) + goto err; + } + } + + /* read the color information(if any) from the file */ + + if (fread((char *) &magic, sizeof (int), 1, filep) != 1) + goto err; + + if (magic) { + int colors, color_pairs; + bool could_change; + int i; + + /* if the new terminal doesn't support colors, or it supports */ + /* less colors (or color_pairs) than the old terminal, or */ + /* start_color() has not been called, simply advance the file */ + /* pointer pass the color related info. */ + /* Note: must to read the first line of color info, even if the */ + /* new terminal doesn't support color, in order to know how to */ + /* deal with the rest of the file */ + + if ((fread((char *) &colors, sizeof (int), 1, filep) != 1) || + (fread((char *) &color_pairs, sizeof (int), 1, + filep) != 1) || (fread((char *) &could_change, + sizeof (char), 1, filep) != 1)) + goto err; + + if (max_pairs == -1 || cur_term->_pairs_tbl == NULL || + colors > max_colors || color_pairs > max_pairs) { + if (fseek(filep, (long) (colors * sizeof (_Color) + + color_pairs * sizeof (_Color_pair)), 1) != 0) + goto err; + } else { + _Color_pair *ptp, *save_ptp; + + /* if both old and new terminals could modify colors, read in */ + /* color table, and call init_color for each color */ + + if (could_change) { + if (can_change) { + _Color *ctp, *save_ctp; + + if ((save_ctp = (ctp = (_Color *) + malloc(colors * + sizeof (_Color)))) == NULL) + goto err; + + if (fread(ctp, sizeof (_Color), + colors, filep) != colors) + goto err; + + for (i = 0; i < colors; i++, ctp++) { + /* LINTED */ + (void) init_color((short)i, + ctp->r, ctp->g, ctp->b); + } + free(save_ctp); + } else { + + /* the old terminal could modify colors, by the new one */ + /* cannot skip over color_table info. */ + + if (fseek(filep, (long) (colors * + sizeof (_Color)), 1) != 0) + goto err; + } + } + + /* read color_pairs info. call init_pair for each pair */ + + if ((save_ptp = (ptp = (_Color_pair *) + malloc(color_pairs * sizeof (_Color_pair)))) == + NULL) + goto err; + if (fread(ptp, sizeof (_Color_pair), color_pairs, + filep) != color_pairs) { +err: + if (win != NULL) + (void) delwin(win); + if (win1 != NULL) + (void) delwin(win1); + if (type == 0) + curscr->_clear = TRUE; + return (ERR); + } + + for (i = 1, ++ptp; i <= color_pairs; i++, ptp++) { + if (ptp->init) + /* LINTED */ + (void) init_pair((short)i, + ptp->foreground, ptp->background); + } + free(save_ptp); + } + } + + /* substitute read in window for the curscr */ + switch (type) { + case 1: + case 2: + (void) delwin(_virtscr); + hash = _VIRTHASH; + if (type == 1) { + SP->virt_scr = _virtscr = win; + _VIRTTOP = 0; + _VIRTBOT = curscr->_maxy - 1; + break; + } + SP->virt_scr = _virtscr = win1; + _VIRTTOP = curscr->_maxy; + _VIRTBOT = -1; + /* clear the hash table */ + for (y = curscr->_maxy; y > 0; --y) + *hash++ = _NOHASH; + /* LINTED */ /* Known fall-through on case statement. */ + case 0: + { + int saveflag = curscr->_flags & _CANT_BE_IMMED; + + (void) delwin(curscr); + SP->cur_scr = curscr = win; + curscr->_sync = TRUE; + curscr->_flags |= saveflag; + hash = _CURHASH; + } + } + + /* clear the hash table */ + for (y = curscr->_maxy; y > 0; --y) + *hash++ = _NOHASH; + + curscr->_clear = clearit; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/scrollok.c b/usr/src/lib/libcurses/screen/scrollok.c new file mode 100644 index 0000000000..d692c9d209 --- /dev/null +++ b/usr/src/lib/libcurses/screen/scrollok.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +scrollok(WINDOW *win, bool bf) +{ + win->_scroll = (bf) ? TRUE : FALSE; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/setcurscreen.c b/usr/src/lib/libcurses/screen/setcurscreen.c new file mode 100644 index 0000000000..e9db6e5446 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setcurscreen.c @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +SCREEN * +setcurscreen(SCREEN *new) +{ + SCREEN *rv = SP; + + if (new != SP) { + +#ifdef DEBUG + if (outf) + fprintf(outf, "setterm: old %x, new %x\n", rv, new); +#endif /* DEBUG */ + + SP = new; + if (new) { + (void) setcurterm(SP->tcap); + LINES = SP->lsize; + COLS = SP->csize; + TABSIZE = SP->tsize; + stdscr = SP->std_scr; + curscr = SP->cur_scr; + _virtscr = SP->virt_scr; + } + } + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/setcurterm.c b/usr/src/lib/libcurses/screen/setcurterm.c new file mode 100644 index 0000000000..c1e8ac4e69 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setcurterm.c @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Establish the terminal that the #defines in term.h refer to. + */ + +TERMINAL * +setcurterm(TERMINAL *newterminal) +{ + TERMINAL *oldterminal = cur_term; + + if (newterminal) { +#ifdef _VR3_COMPAT_CODE + acs_map = cur_term->_acs32map; +#else /* _VR3_COMPAT_CODE */ + acs_map = cur_term->_acsmap; +#endif /* _VR3_COMPAT_CODE */ + cur_bools = newterminal->_bools; + cur_nums = newterminal->_nums; + cur_strs = newterminal->_strs; + cur_term = newterminal; + } + return (oldterminal); +} diff --git a/usr/src/lib/libcurses/screen/setecho.c b/usr/src/lib/libcurses/screen/setecho.c new file mode 100644 index 0000000000..b0af26e429 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setecho.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +_setecho(int bf) +{ + SP->fl_echoit = bf; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/setkeymap.c b/usr/src/lib/libcurses/screen/setkeymap.c new file mode 100644 index 0000000000..8d337244f9 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setkeymap.c @@ -0,0 +1,290 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include "curses_inc.h" + +static short keycodes[] = { + KEY_BACKSPACE, + KEY_CATAB, + KEY_CLEAR, + KEY_CTAB, + KEY_DC, + KEY_DL, + KEY_DOWN, + KEY_EIC, + KEY_EOL, + KEY_EOS, + KEY_F(0), + KEY_F(1), + KEY_F(10), + KEY_F(2), + KEY_F(3), + KEY_F(4), + KEY_F(5), + KEY_F(6), + KEY_F(7), + KEY_F(8), + KEY_F(9), + KEY_HOME, + KEY_IC, + KEY_IL, + KEY_LEFT, + KEY_LL, + KEY_NPAGE, + KEY_PPAGE, + KEY_RIGHT, + KEY_SF, + KEY_SR, + KEY_STAB, + KEY_UP, + KEY_A1, + KEY_A3, + KEY_B2, + KEY_C1, + KEY_C3, + KEY_BTAB, + KEY_BEG, + KEY_CANCEL, + KEY_CLOSE, + KEY_COMMAND, + KEY_COPY, + KEY_CREATE, + KEY_END, + KEY_ENTER, + KEY_EXIT, + KEY_FIND, + KEY_HELP, + KEY_MARK, + KEY_MESSAGE, + KEY_MOVE, + KEY_NEXT, + KEY_OPEN, + KEY_OPTIONS, + KEY_PREVIOUS, + KEY_PRINT, + KEY_REDO, + KEY_REFERENCE, + KEY_REFRESH, + KEY_REPLACE, + KEY_RESTART, + KEY_RESUME, + KEY_SAVE, + KEY_SUSPEND, + KEY_UNDO, + KEY_SBEG, + KEY_SCANCEL, + KEY_SCOMMAND, + KEY_SCOPY, + KEY_SCREATE, + KEY_SDC, + KEY_SDL, + KEY_SELECT, + KEY_SEND, + KEY_SEOL, + KEY_SEXIT, + KEY_SFIND, + KEY_SHELP, + KEY_SHOME, + KEY_SIC, + KEY_SLEFT, + KEY_SMESSAGE, + KEY_SMOVE, + KEY_SNEXT, + KEY_SOPTIONS, + KEY_SPREVIOUS, + KEY_SPRINT, + KEY_SREDO, + KEY_SREPLACE, + KEY_SRIGHT, + KEY_SRSUME, + KEY_SSAVE, + KEY_SSUSPEND, + KEY_SUNDO, + KEY_MOUSE + }; + +static _KEY_MAP *p; +static bool *funckey; +static short *codeptr; + +static void +_laddone(char *txt) +{ + p->_sends = (txt); + p->_keyval = *codeptr; + funckey[(unsigned char)(txt)[0]] |= _KEY; + p++; +} + +/* Map text into num, updating the map structure p. */ + +static void +_keyfunc(char **keyptr, char **lastkey) +{ + for (; keyptr <= lastkey; keyptr++, codeptr++) + if (*keyptr) { + p->_sends = (*keyptr); + p->_keyval = *codeptr; + funckey[(unsigned char)(*keyptr)[0]] |= _KEY; + p++; + } +} + +/* Map text into num, updating the map structure p. */ + +static void +_keyfunc2(char **keyptr, char **lastkey) +{ + short code_value = KEY_F(11); + + for (; *keyptr && keyptr <= lastkey; keyptr++, code_value++) { + p->_sends = *keyptr; + p->_keyval = (short) code_value; + funckey[(unsigned char)*keyptr[0]] |= _KEY; + p++; + } +} + +int +setkeymap(void) +{ + _KEY_MAP keymap[((sizeof (keycodes) / sizeof (short)) + + ((KEY_F(63) - KEY_F(11)) + 1))], **key_ptrs; + short numkeys; + int numbytes, key_size = cur_term->_ksz; + + if (cur_term->internal_keys != NULL) + return (ERR); + p = keymap; + codeptr = keycodes; + funckey = cur_term->funckeystarter; + + /* If backspace key sends \b, don't map it. */ + if (key_backspace && strcmp(key_backspace, "\b")) + _laddone(key_backspace); + codeptr++; + + _keyfunc(&key_catab, &key_dl); + + /* If down arrow key sends \n, don't map it. */ + if (key_down && strcmp(key_down, "\n")) + _laddone(key_down); + codeptr++; + + _keyfunc(&key_eic, &key_il); + + /* If left arrow key sends \b, don't map it. */ + if (key_left && strcmp(key_left, "\b")) + _laddone(key_left); + codeptr++; + + _keyfunc(&key_ll, &key_up); + _keyfunc(&key_a1, &key_c3); + _keyfunc(&key_btab, &key_btab); + _keyfunc(&key_beg, &key_sundo); + _keyfunc2(&key_f11, &key_f63); + _keyfunc(&key_mouse, &key_mouse); + + /* + * malloc returns the address of a list of pointers to + * (_KEY_MAP *) structures + */ + + if ((key_ptrs = (_KEY_MAP **) + /* LINTED */ + malloc((key_size + (numkeys = (short)(p - keymap))) * + sizeof (_KEY_MAP *))) == NULL) { + goto out; + } + + /* + * Number of bytes needed is the number of structures times their size + * malloc room for our array of _KEY_MAP structures + */ + + if ((p = (_KEY_MAP *) malloc((unsigned) + /* LINTED */ + (numbytes = (int)(sizeof (_KEY_MAP) * numkeys)))) == NULL) { + /* Can't do it, free list of pointers, indicate */ + /* error upon return. */ + free((char *) key_ptrs); +out: + term_errno = TERM_BAD_MALLOC; +#ifdef DEBUG + strcpy(term_parm_err, "setkeymap"); + termerr(); +#endif /* DEBUG */ + return (ERR); + } + + if (key_size != 0) { + (void) memcpy((char *) &(key_ptrs[numkeys]), + (char *) cur_term->_keys, (key_size * + sizeof (_KEY_MAP *))); + free(cur_term->_keys); + } + (void) memcpy((char *) (cur_term->internal_keys = p), + (char *) keymap, numbytes); + cur_term->_keys = key_ptrs; + cur_term->_ksz += numkeys; + /* + * Reset _lastkey_ordered to -1 since we put the keys read in + * from terminfo at the beginning of the keys table. + */ + cur_term->_lastkey_ordered = -1; + cur_term->_lastmacro_ordered += numkeys; + cur_term->_first_macro += numkeys; + + /* Initialize our pointers to the structures */ + while (numkeys--) + *key_ptrs++ = p++; +#ifdef DEBUG + if (outf) + fprintf(outf, "return key structure %x, ending at %x\n", + keymap, p); +#endif /* DEBUG */ + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/setnonl.c b/usr/src/lib/libcurses/screen/setnonl.c new file mode 100644 index 0000000000..014082456d --- /dev/null +++ b/usr/src/lib/libcurses/screen/setnonl.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +_setnonl(int bf) +{ + SP->fl_nonl = bf; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/setqiflush.c b/usr/src/lib/libcurses/screen/setqiflush.c new file mode 100644 index 0000000000..ef09a8231a --- /dev/null +++ b/usr/src/lib/libcurses/screen/setqiflush.c @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Set/unset flushing the output queue on interrupts or quits. + */ + +void +_setqiflush(int yes) +{ +#ifdef SYSV + if (yes) + cur_term->Nttybs.c_lflag &= ~NOFLSH; + else + cur_term->Nttybs.c_lflag |= NOFLSH; + (void) reset_prog_mode(); +#endif /* SYSV */ +} diff --git a/usr/src/lib/libcurses/screen/setsyx.c b/usr/src/lib/libcurses/screen/setsyx.c new file mode 100644 index 0000000000..8774a85d70 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setsyx.c @@ -0,0 +1,71 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * Set the current screen coordinates (y, x). + * + * This routine may be called before doupdate(). It tells doupdate() + * where to leave the cursor instead of the location of (x, y) of the + * last window that was wnoutrefreshed or pnoutrefreshed. + * If x and y are negative, then the cursor will be left wherever + * curses decides to leave it, as if leaveok() had been TRUE for the + * last window refreshed. + */ + +#include <sys/types.h> +#include "curses_inc.h" + +int +setsyx(int y, int x) +{ + if (y < 0 && x < 0) { + SP->virt_scr->_leave = TRUE; + } else { + _virtscr->_cury = y + SP->Yabove; + /* LINTED */ + _virtscr->_curx = (short) x; + _virtscr->_leave = FALSE; + _virtscr->_flags |= _WINMOVED; + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/setterm.c b/usr/src/lib/libcurses/screen/setterm.c new file mode 100644 index 0000000000..0b35776f40 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setterm.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#undef setterm + +int +setterm(char *name) +{ + return (setupterm(name, 1, (int *) NULL)); +} diff --git a/usr/src/lib/libcurses/screen/setupterm.c b/usr/src/lib/libcurses/screen/setupterm.c new file mode 100644 index 0000000000..c1f4bdeb04 --- /dev/null +++ b/usr/src/lib/libcurses/screen/setupterm.c @@ -0,0 +1,839 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <stdio.h> +#include <sys/types.h> +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include "curses_inc.h" + +#define TERMPATH "/usr/share/lib/terminfo/" +#define TERMPATHLEN 512 + +extern bool _use_env; /* in curses.c */ + +chtype bit_attributes[NUM_ATTRIBUTES] = { + A_STANDOUT, + A_UNDERLINE, + A_ALTCHARSET, + A_REVERSE, + A_BLINK, + A_DIM, + A_BOLD, + A_INVIS, + A_PROTECT + }; + +char *Def_term = "unknown", /* default terminal type */ + term_parm_err[32], ttytype[BUFSIZ], _frst_tblstr[1400]; + +TERMINAL _first_term, *cur_term = &_first_term; +struct _bool_struct _frst_bools, *cur_bools = &_frst_bools; +struct _num_struct _frst_nums, *cur_nums = &_frst_nums; +struct _str_struct _frst_strs, *cur_strs = &_frst_strs; + +/* _called_before is used/cleared by delterm.c and restart.c */ +char _called_before = 0; +short term_errno = -1; + +#ifdef SYSV +int prog_istermios = -1; +int shell_istermios = -1; +#endif + +#ifdef DUMPTI +extern char *boolfnames[], *boolnames[], *boolcodes[], + *numfnames[], *numnames[], *numcodes[], + *strfnames[], *strnames[], *strcodes[]; + +main(int argc, char **argv) /* FOR DEBUG ONLY */ +{ + if (argc > 1) + setupterm(argv[1], 1, (int *)0); + else + setupterm((char *)0, 1, (int *)0); + return (0); +} + +_Pr(int ch) /* FOR DEBUG ONLY */ +{ + if (ch >= 0200) { + printf("M-"); + ch -= 0200; + } + if ((ch < ' ') || (ch == 0177)) + printf("^%c", ch ^ 0100); + else + printf("%c", ch); +} + +_Sprint(int n, char *string) /* FOR DEBUG ONLY */ +{ + int ch; + + if (n == -1) { + printf(".\n"); + return; + } + printf(", string = '"); + while (ch = *string++) + _Pr(ch&0377); + + printf("'.\n"); +} + +_Mprint(int n, char *memory) /* FOR DEBUG ONLY */ +{ + unsigned char ch; + + while (ch = *memory++, n-- > 0) + _Pr(ch&0377); +} + +#define _Vr2getshi() _Vr2getsh(ip-2) + +#if vax || pdp11 +#define _Vr2getsh(ip) (* (short *)(ip)) +#endif /* vax || pdp11 */ + +#ifndef _Vr2getsh +/* + * Here is a more portable version, which does not assume byte ordering + * in shorts, sign extension, etc. + */ +_Vr2getsh(char *p) +{ + int rv; + + if (*p == (char)0377) + return (-1); + rv = (unsigned char) *p++; + rv += (unsigned char) *p * 256; + return (rv); +} +#endif /* _Vr2getsh */ + +#endif /* DUMPTI */ + +#define _Getshi() _Getsh(ip); ip += 2 + +/* + * "function" to get a short from a pointer. The short is in a standard + * format: two bytes, the first is the low order byte, the second is + * the high order byte (base 256). The only negative numbers allowed are + * -1 and -2, which are represented as 255,255 and 255,254 This format + * happens to be the same as the hardware on the pdp-11, vax, and 386, + * making it fast and convenient and small to do this on a pdp-11. + */ + +#if vax || pdp11 || i386 +#define _Getsh(ip) (* (short *)ip) +#endif /* vax || pdp11 */ +/* + * The following macro is partly due to Mike Laman, laman@sdcsvax + * NCR @ Torrey Pines. - Tony Hansen + */ +#if u3b || u3b15 || u3b2 || m68000 +#define _Getsh(ip) ((short)(*((unsigned char *)ip) | (*(ip+1) << 8))) +#endif /* u3b || u3b15 || u3b2 || m68000 */ + +#ifndef _Getsh +/* + * Here is a more portable version, which does not assume byte ordering + * in shorts, sign extension, etc. For the sake of the porters, + * two alternative implementations, for the machines that don't have + * casting to "unsigned char", are also given, but commented out. + * Not ANSI C implementation assumes that the * C preprocessor does + * sign-extension the same as on the machine being compiled for. + */ +static int +_Getsh(char *p) +{ + int rv, rv2; + + rv = (unsigned char) p[0]; + rv2 = (unsigned char) p[1]; + + /* the following stuff is only for porting. See the comment above */ + +#ifdef FOR_PORTING +#if CHAR_MIN < 0 + rv = (*p++) & 0377; + rv2 = (*p) & 0377; +#else /* CHAR_MIN < 0 */ + rv = *p++; + rv2 = *p; +#endif /* CHAR_MIN < 0 */ + +#endif /* FOR_PORTING */ + + if ((rv2 == 0377) && ((rv == 0377) || (rv == 0376))) + return (-1); + return (rv + (rv2 * 256)); +} +#endif /* _Getsh */ + +/* + * setupterm: low level routine to dig up terminfo from database + * and read it in. Parms are terminal type (0 means use getenv("TERM"), + * file descriptor all output will go to (for ioctls), and a pointer + * to an int into which the error return code goes (0 means to bomb + * out with an error message if there's an error). Thus, + * setupterm((char *)0, 1, (int *)0) is a reasonable way for a simple + * program to set up. + */ +int +setupterm(char *term, int filenum, int *errret) + /* filenum - This is a UNIX file descriptor, not a stdio ptr. */ +{ + char tiebuf[4096]; + char fname[TERMPATHLEN]; + char *ip; + char *cp; + int n, tfd; + char *lcp, *ccp, **on_sequences, **str_array; + int snames, nbools, nints, nstrs, sstrtab; + char *strtab; +#ifdef DUMPTI + int Vr2val; +#endif /* DUMPTI */ + + (void) mbgetwidth(); + + if (term == NULL) + term = getenv("TERM"); + + if (term == NULL || *term == '\0') + term = Def_term; + + tfd = -1; + errno = 0; /* ehr3 */ + + if (errret != 0) + *errret = -1; + + if (((cp = getenv("TERMINFO")) != 0) && *cp) { + /* $TERMINFO/?/$TERM */ + if (snprintf(fname, sizeof (fname), + "%s/%c/%s", cp, *term, term) >= sizeof (fname)) { + term_errno = TERMINFO_TOO_LONG; + goto out_err; + } + + tfd = open(fname, 0); +#ifdef DUMPTI + printf("looking in file %s\n", fname); +#endif /* DUMPTI */ + if ((tfd < 0) && (errno == EACCES)) + goto cant_read; + } + + if (tfd < 0) { + /* /usr/share/lib/terminfo/?/$TERM */ + if (snprintf(fname, sizeof (fname), + "%s/%c/%s", TERMPATH, *term, term) >= sizeof (fname)) { + term_errno = TERMINFO_TOO_LONG; + goto out_err; + } + + tfd = open(fname, 0); +#ifdef DUMPTI + printf("looking in file %s\n", fname); +#endif /* DUMPTI */ + + } + + if (tfd < 0) { + if (errno == EACCES) { +cant_read: + term_errno = NOT_READABLE; + } else { + if (access(TERMPATH, 0) == -1) + term_errno = UNACCESSIBLE; + else { + term_errno = NO_TERMINAL; + if (errret != 0) + *errret = 0; + } + } + /* + * if the length of the specified terminal name is longer + * than 31, it will be chopped after the 31st byte. + * This should be a rare case. + */ + (void) strncpy(term_parm_err, term, 31); + term_parm_err[31] = '\0'; + goto out_err; + } + + /* LINTED */ + n = (int)read(tfd, tiebuf, sizeof (tiebuf)); + (void) close(tfd); + + if (n <= 0) { +corrupt: + term_errno = CORRUPTED; + goto out_err; + } else + if (n == sizeof (tiebuf)) { + term_errno = ENTRY_TOO_LONG; + goto out_err; + } + cp = ttytype; + ip = tiebuf; + + /* Pick up header */ + snames = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Magic number = %d, %#o [%d, %#o].\n", snames, + snames, Vr2val, Vr2val); +#endif /* DUMPTI */ + if (snames != MAGNUM) + goto corrupt; + snames = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Size of names = %d, %#o [%d, %#o].\n", snames, + snames, Vr2val, Vr2val); +#endif /* DUMPTI */ + + nbools = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Number of bools = %d, %#o [%d, %#o].\n", nbools, + nbools, Vr2val, Vr2val); +#endif /* DUMPTI */ + + nints = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Number of ints = %d, %#o [%d, %#o].\n", nints, nints, + Vr2val, Vr2val); +#endif /* DUMPTI */ + + nstrs = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Number of strings = %d, %#o [%d, %#o].\n", nstrs, nstrs, + Vr2val, Vr2val); +#endif /* DUMPTI */ + + sstrtab = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Size of string table = %d, %#o [%d, %#o].\n", sstrtab, + sstrtab, Vr2val, Vr2val); + printf("Names are: %.*s.\n", snames, ip); +#endif /* DUMPTI */ + + /* allocate all of the space */ + strtab = NULL; + if (_called_before) { + /* 2nd or more times through */ + if ((cur_term = (TERMINAL *) + calloc(sizeof (TERMINAL), 1)) == NULL) + goto badmalloc; + if ((cur_bools = (struct _bool_struct *) + calloc(sizeof (struct _bool_struct), 1)) == NULL) + goto freeterminal; + if ((cur_nums = (struct _num_struct *) + calloc(sizeof (struct _num_struct), 1)) == NULL) + goto freebools; + if ((cur_strs = (struct _str_struct *) + calloc(sizeof (struct _str_struct), 1)) == NULL) { +freenums: + free((char *)cur_nums); +freebools: + free((char *)cur_bools); +freeterminal: + free((char *)cur_term); +badmalloc: + term_errno = TERM_BAD_MALLOC; +#ifdef DEBUG + strcpy(term_parm_err, "setupterm"); +#endif /* DEBUG */ +out_err: + if (errret == 0) { + termerr(); + exit(-term_errno); + } else + return (ERR); + } + } else { + /* First time through */ + _called_before = TRUE; + cur_term = &_first_term; + cur_bools = &_frst_bools; + cur_nums = &_frst_nums; + cur_strs = &_frst_strs; + if (sstrtab < sizeof (_frst_tblstr)) + strtab = _frst_tblstr; + } + + if (strtab == NULL) { + if ((strtab = (char *)malloc((unsigned)sstrtab)) == NULL) { + if (cur_strs != &_frst_strs) + free((char *)cur_strs); + goto freenums; + } + } + + /* no more catchable errors */ + if (errret) + *errret = 1; + + (void) strncpy(cur_term->_termname, term, 14); + /* In case the name is exactly 15 characters */ + cur_term->_termname[14] = '\0'; + cur_term->_bools = cur_bools; + cur_term->_nums = cur_nums; + cur_term->_strs = cur_strs; + cur_term->_strtab = strtab; + cur_term->sgr_mode = cur_term->sgr_faked = A_NORMAL; + + if (filenum == 1 && !isatty(filenum)) + filenum = 2; /* Allow output redirect */ + /* LINTED */ + cur_term->Filedes = (short)filenum; + _blast_keys(cur_term); + cur_term->_iwait = cur_term->fl_typeahdok = cur_term->_chars_on_queue = + cur_term->_fl_rawmode = cur_term->_ungotten = 0; + cur_term->_cursorstate = 1; + cur_term->_delay = cur_term->_inputfd = cur_term->_check_fd = -1; + (void) memset((char *)cur_term->_regs, 0, 26 * sizeof (short)); + +#ifndef DUMPTI + (void) def_shell_mode(); + /* This is a useful default for PROGTTY, too */ +#ifdef SYSV + if (shell_istermios < 0) { + int i; + + SHELLTTY.c_lflag = SHELLTTYS.c_lflag; + SHELLTTY.c_oflag = SHELLTTYS.c_oflag; + SHELLTTY.c_iflag = SHELLTTYS.c_iflag; + SHELLTTY.c_cflag = SHELLTTYS.c_cflag; + for (i = 0; i < NCC; i++) + SHELLTTY.c_cc[i] = SHELLTTYS.c_cc[i]; + PROGTTY = SHELLTTY; + prog_istermios = -1; + + PROGTTYS.c_lflag = PROGTTY.c_lflag; + PROGTTYS.c_oflag = PROGTTY.c_oflag; + PROGTTYS.c_iflag = PROGTTY.c_iflag; + PROGTTYS.c_cflag = PROGTTY.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTYS.c_cc[i] = PROGTTY.c_cc[i]; + } else { + PROGTTYS = SHELLTTYS; + prog_istermios = 0; + } +#else /* SYSV */ + PROGTTY = SHELLTTY; +#endif /* SYSV */ +#endif /* DUMPTI */ + + /* Skip names of terminals */ + (void) memcpy((char *)cp, (char *)ip, (snames * sizeof (*cp))); + ip += snames; + + /* + * Pull out the booleans. + * The for loop below takes care of a new curses with an old tic + * file and visa-versa. nbools says how many bools the tic file has. + * So, we only loop for as long as there are bools to read. + * However, if this is an old curses that doesn't have all the + * bools that this new tic has dumped, then the extra if + * "if (cp < fp)" says that if we are going to read into our structure + * passed its size don't do it but we still need to keep bumping + * up the pointer of what we read in from the terminfo file. + */ + { + char *fp = &cur_bools->Sentinel; + char s; +#ifdef DUMPTI + int tempindex = 0; +#endif /* DUMPTI */ + cp = &cur_bools->_auto_left_margin; + while (nbools--) { + s = *ip++; +#ifdef DUMPTI + printf("Bool %s [%s] (%s) = %d.\n", + boolfnames[tempindex], boolnames[tempindex], + boolcodes[tempindex], s); + tempindex++; +#endif /* DUMPTI */ + if (cp < fp) + *cp++ = s & 01; + } + if (cp < fp) + (void) memset(cp, 0, ((fp - cp) * sizeof (bool))); + } + + /* Force proper alignment */ + if (((unsigned long) ip) & 1) + ip++; + + /* + * Pull out the numbers. + */ + { + short *sp = &cur_nums->_columns; + short *fp = &cur_nums->Sentinel; + int s; +#ifdef DUMPTI + int tempindex = 0; +#endif /* DUMPTI */ + + while (nints--) { + s = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("Num %s [%s] (%s) = %d [%d].\n", + numfnames[tempindex], numnames[tempindex], + numcodes[tempindex], s, Vr2val); + tempindex++; +#endif /* DUMPTI */ + if (sp < fp) + if (s < 0) + *sp++ = -1; + else + /* LINTED */ + *sp++ = (short)s; + } + if (sp < fp) + (void) memset((char *)sp, '\377', + ((fp - sp) * sizeof (short))); + } + + if (_use_env) { + /* + * This ioctl defines the window size and overrides what + * it says in terminfo. + */ + { + struct winsize w; + + if (ioctl(filenum, TIOCGWINSZ, &w) != -1) { + if (w.ws_row != 0) + cur_nums->_lines = w.ws_row; + if (w.ws_col != 0) + cur_nums->_columns = w.ws_col; +#ifdef DUMPTI + printf("ioctl TIOCGWINSZ override: " + "(lines, columns) = (%d, %d)\n", + w.ws_row, w.ws_col); +#endif /* DUMPTI */ + } + } + + /* + * Check $LINES and $COLUMNS. + */ + { + int ilines, icolumns; + + lcp = getenv("LINES"); + ccp = getenv("COLUMNS"); + if (lcp) + if ((ilines = atoi(lcp)) > 0) { + /* LINTED */ + cur_nums->_lines = (short)ilines; +#ifdef DUMPTI + printf("$LINES override: lines = %d\n", + ilines); +#endif /* DUMPTI */ + } + if (ccp) + if ((icolumns = atoi(ccp)) > 0) { + /* LINTED */ + cur_nums->_columns = (short)icolumns; +#ifdef DUMPTI + printf("$COLUMNS override: columns = " + "%d\n", icolumns); +#endif /* DUMPTI */ + } + } + } + + /* Pull out the strings. */ + { + char **pp = &cur_strs->strs._back_tab; + char **fp = &cur_strs->strs4.Sentinel; +#ifdef DUMPTI + int tempindex = 0; + char *startstr = ip + sizeof (short) * + nstrs; + + printf("string table = '"); + _Mprint(sstrtab, startstr); + printf("'\n"); +#endif /* DUMPTI */ + + while (nstrs--) { + n = _Getshi(); +#ifdef DUMPTI + Vr2val = _Vr2getshi(); + printf("String %s [%s] (%s) offset = %d [%d]", + strfnames[tempindex], strnames[tempindex], + strcodes[tempindex], n, Vr2val); + tempindex++; +#endif /* DUMPTI */ + if (pp < fp) { +#ifdef DUMPTI + _Sprint(n, startstr+n); +#endif /* DUMPTI */ + if (n < 0) + *pp++ = NULL; + else + *pp++ = strtab + n; + } +#ifdef DUMPTI + else + _Sprint(-1, (char *)0); +#endif /* DUMPTI */ + } + if (pp < fp) + (void) memset((char *)pp, 0, ((fp - pp) * sizeof (charptr))); + } + + (void) memcpy(strtab, ip, sstrtab); + +#ifndef DUMPTI + + /* + * If tabs are being expanded in software, turn this off + * so output won't get messed up. Also, don't use tab + * or backtab, even if the terminal has them, since the + * user might not have hardware tabs set right. + */ +#ifdef SYSV + if ((PROGTTYS.c_oflag & TABDLY) == TAB3) { + PROGTTYS.c_oflag &= ~TABDLY; + (void) reset_prog_mode(); + goto next; + } +#else /* SYSV */ + if ((PROGTTY.sg_flags & XTABS) == XTABS) { + PROGTTY.sg_flags &= ~XTABS; + (void) reset_prog_mode(); + goto next; + } +#endif /* SYSV */ + if (dest_tabs_magic_smso) { +next: + cur_strs->strs2._tab = cur_strs->strs._back_tab = NULL; + } + +#ifdef LTILDE + ioctl(cur_term -> Filedes, TIOCLGET, &n); +#endif /* LTILDE */ +#endif /* DUMPTI */ + +#ifdef _VR2_COMPAT_CODE + (void) memcpy(&cur_term->_b1, &cur_bools->_auto_left_margin, + (char *)&cur_term->_c1 - (char *)&cur_term->_b1); + (void) memcpy((char *)&cur_term->_c1, (char *)&cur_nums->_columns, + (char *)&cur_term->_Vr2_Astrs._s1 - (char *)&cur_term->_c1); + (void) memcpy((char *)&cur_term->_Vr2_Astrs._s1, + (char *)&cur_strs->strs._back_tab, + (char *)&cur_term->Filedes - (char *)&cur_term->_Vr2_Astrs._s1); +#endif /* _VR2_COMPAT_CODE */ + + on_sequences = cur_term->turn_on_seq; + str_array = (char **)cur_strs; + { + static char offsets[] = { + 35, /* enter_standout_mode, */ + 36, /* enter_underline_mode, */ + 25, /* enter_alt_charset_mode, */ + 34, /* enter_reverse_mode, */ + 26, /* enter_blink_mode, */ + 30, /* enter_dim_mode, */ + 27, /* enter_bold_mode, */ + 32, /* enter_secure_mode, */ + 33, /* enter_protected_mode, */ + }; + + for (n = 0; n < NUM_ATTRIBUTES; n++) { + if ((on_sequences[n] = str_array[offsets[n]]) != 0) + cur_term->bit_vector |= bit_attributes[n]; + } + } + + if (!(set_attributes)) { + static char faked_attrs[] = { 1, 3, 4, 6 }, + offsets[] = { + 43, /* exit_standout_mode, */ + 44, /* exit_underline_mode, */ + 38, /* exit_alt_charset_mode, */ + }; + char **off_sequences = cur_term->turn_off_seq; + int i; + + if ((max_attributes == -1) && (ceol_standout_glitch || + (magic_cookie_glitch >= 0))) + max_attributes = 1; + + /* Figure out what attributes need to be faked. */ + /* See vidupdate.c */ + + for (n = 0; n < sizeof (faked_attrs); n++) { + if (on_sequences[0] != NULL) { + if ((!on_sequences[i = faked_attrs[n]]) || + (strcmp(on_sequences[i], + on_sequences[0]) == 0)) { + cur_term->sgr_faked |= + bit_attributes[i]; + } + } else { + if (!on_sequences[i = faked_attrs[n]]) { + cur_term->sgr_faked |= + bit_attributes[i]; + } + } + } + + cur_term->check_turn_off = A_STANDOUT | A_UNDERLINE | + A_ALTCHARSET; + + for (n = 0; n < sizeof (offsets); n++) { + if ((!(off_sequences[n] = str_array[offsets[n]])) || + ((n > 0) && off_sequences[0] && + (strcmp(off_sequences[n], off_sequences[0]) == + 0)) || ((n == 2) && (exit_attribute_mode) && + (strcmp(exit_attribute_mode, off_sequences[n]) == + 0))) { + cur_term->check_turn_off &= ~bit_attributes[n]; + } + } + } + cur_term->cursor_seq[0] = cursor_invisible; + cur_term->cursor_seq[1] = cursor_normal; + cur_term->cursor_seq[2] = cursor_visible; + cur_term->_pairs_tbl = (_Color_pair *) NULL; + cur_term->_color_tbl = (_Color *) NULL; + + return (OK); +} + +void +_blast_keys(TERMINAL *terminal) +{ + terminal->_keys = NULL; + terminal->internal_keys = NULL; + terminal->_ksz = terminal->_first_macro = 0; + terminal->_lastkey_ordered = terminal->_lastmacro_ordered = -1; + (void) memset((char *)terminal->funckeystarter, 0, 0400 * + sizeof (bool)); +} + +#ifndef DUMPTI + +int +reset_prog_mode(void) +{ +#ifdef SYSV + if (_BRS(PROGTTYS)) { + if (prog_istermios < 0) { + int i; + + PROGTTY.c_lflag = PROGTTYS.c_lflag; + PROGTTY.c_oflag = PROGTTYS.c_oflag; + PROGTTY.c_iflag = PROGTTYS.c_iflag; + PROGTTY.c_cflag = PROGTTYS.c_cflag; + for (i = 0; i < NCC; i++) + PROGTTY.c_cc[i] = PROGTTYS.c_cc[i]; + (void) ioctl(cur_term -> Filedes, TCSETAW, &PROGTTY); + } else + (void) ioctl(cur_term -> Filedes, TCSETSW, &PROGTTYS); + } +#else /* SYSV */ + if (_BR(PROGTTY)) + (void) ioctl(cur_term -> Filedes, TIOCSETN, &PROGTTY); +#endif /* SYSV */ + +#ifdef LTILDE + ioctl(cur_term -> Filedes, TIOCLGET, &cur_term -> oldlmode); + cur_term -> newlmode = cur_term -> oldlmode & ~LTILDE; + if (cur_term -> newlmode != cur_term -> oldlmode) + ioctl(cur_term -> Filedes, TIOCLSET, &cur_term -> newlmode); +#endif /* LTILDE */ +#ifdef DIOCSETT + if (cur_term -> old.st_termt == 0) + ioctl(cur_term->Filedes, DIOCGETT, &cur_term -> old); + cur_term -> new = cur_term -> old; + cur_term -> new.st_termt = 0; + cur_term -> new.st_flgs |= TM_SET; + ioctl(cur_term->Filedes, DIOCSETT, &cur_term -> new); +#endif /* DIOCSETT */ + return (OK); +} + +int +def_shell_mode(void) +{ +#ifdef SYSV + if ((shell_istermios = + ioctl(cur_term -> Filedes, TCGETS, &SHELLTTYS)) < 0) { + int i; + + (void) ioctl(cur_term -> Filedes, TCGETA, &SHELLTTY); + SHELLTTYS.c_lflag = SHELLTTY.c_lflag; + SHELLTTYS.c_oflag = SHELLTTY.c_oflag; + SHELLTTYS.c_iflag = SHELLTTY.c_iflag; + SHELLTTYS.c_cflag = SHELLTTY.c_cflag; + for (i = 0; i < NCC; i++) + SHELLTTYS.c_cc[i] = SHELLTTY.c_cc[i]; + } +#else /* SYSV */ + (void) ioctl(cur_term -> Filedes, TIOCGETP, &SHELLTTY); +#endif /* SYSV */ + return (OK); +} + +#endif /* DUMPTI */ diff --git a/usr/src/lib/libcurses/screen/slk_atroff.c b/usr/src/lib/libcurses/screen/slk_atroff.c new file mode 100644 index 0000000000..7cebce0c67 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_atroff.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +slk_attroff(chtype a) +{ + WINDOW *win; + + /* currently we change slk attribute only when using software */ + /* slk's. However, we may introduce a new terminfo variable */ + /* which would allow manipulating the hardware slk's as well */ + + if ((SP->slk == NULL) || ((win = SP->slk->_win) == NULL)) + return (ERR); + + return (wattroff(win, a)); +} diff --git a/usr/src/lib/libcurses/screen/slk_atron.c b/usr/src/lib/libcurses/screen/slk_atron.c new file mode 100644 index 0000000000..fc0ad0249a --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_atron.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +slk_attron(chtype a) +{ + WINDOW *win; + + /* currently we change slk attribute only when using software */ + /* slk's. However, we may introduce a new terminfo variable */ + /* which would allow manipulating the hardware slk's as well */ + + if ((SP->slk == NULL) || ((win = SP->slk->_win) == NULL)) + return (ERR); + + return (wattron(win, a)); +} diff --git a/usr/src/lib/libcurses/screen/slk_atrset.c b/usr/src/lib/libcurses/screen/slk_atrset.c new file mode 100644 index 0000000000..5435ca3205 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_atrset.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +slk_attrset(chtype a) +{ + WINDOW *win; + + /* currently we change slk attribute only when using software */ + /* slk's. However, we may introduce a new terminfo variable */ + /* which would allow manipulating the hardware slk's as well */ + + if ((SP->slk == NULL) || ((win = SP->slk->_win) == NULL)) + return (ERR); + + return (wattrset(win, a)); +} diff --git a/usr/src/lib/libcurses/screen/slk_clear.c b/usr/src/lib/libcurses/screen/slk_clear.c new file mode 100644 index 0000000000..942ac796c2 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_clear.c @@ -0,0 +1,76 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Clear the soft labels. */ + +int +slk_clear(void) +{ + SLK_MAP *slk; + int i; + char * spaces = " "; + + if ((slk = SP->slk) == NULL) + return (ERR); + + slk->_changed = 2; /* This means no more soft labels. */ + if (slk->_win) { + (void) werase(slk->_win); + (void) wrefresh(slk->_win); + } else { + /* send hardware clear sequences */ + for (i = 0; i < slk->_num; i++) + _PUTS(tparm_p2(plab_norm, i + 1, + (long) spaces), 1); + _PUTS(label_off, 1); + (void) fflush(SP->term_file); + } + + for (i = 0; i < slk->_num; ++i) + slk->_lch[i] = FALSE; + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/slk_label.c b/usr/src/lib/libcurses/screen/slk_label.c new file mode 100644 index 0000000000..a4f1f35923 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_label.c @@ -0,0 +1,68 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Return the current label of key number 'n'. */ + +char * +slk_label(int n) +{ + SLK_MAP *slk = SP->slk; + + /* + * strip initial blanks + * + * for (; *lab != '\0'; ++lab) + * if (*lab != ' ') + * break; + * strip trailing blanks + * + * for (; cp > lab; --cp) + * if (*(cp-1) != ' ') + * break; + */ + + return ((!slk || n < 1 || n > slk->_num) ? NULL : slk->_lval[n - 1]); +} diff --git a/usr/src/lib/libcurses/screen/slk_noutref.c b/usr/src/lib/libcurses/screen/slk_noutref.c new file mode 100644 index 0000000000..1eee4b8373 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_noutref.c @@ -0,0 +1,59 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Wnoutrefresh for the softkey window. */ + +int +slk_noutrefresh(void) +{ + if (SP->slk == NULL) + return (ERR); + + if (SP->slk->_win && _slk_update()) + (void) wnoutrefresh(SP->slk->_win); + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/slk_refresh.c b/usr/src/lib/libcurses/screen/slk_refresh.c new file mode 100644 index 0000000000..fe1e93fdf6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_refresh.c @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Update the soft-label window. */ + +int +slk_refresh(void) +{ + if (_slk_update()) { + return (wrefresh(SP->slk->_win)); + } + return (0); +} + +/* Update soft labels. Return TRUE if a window was updated. */ + +int +_slk_update(void) +{ + WINDOW *win; + SLK_MAP *slk; + int i; + + if ((slk = SP->slk) == NULL || (slk->_changed != TRUE)) + return (FALSE); + + win = slk->_win; + for (i = 0; i < slk->_num; ++i) + if (slk->_lch[i]) { + if (win) + (void) mvwaddstr(win, 0, slk->_labx[i], + slk->_ldis[i]); + else + _PUTS(tparm_p2(plab_norm, i + 1, + (long)slk->_ldis[i]), 1); + + slk->_lch[i] = FALSE; + } + if (!win) { + _PUTS(label_on, 1); + /* + * Added an fflush because if application code calls a + * slk_refresh or a slk_noutrefresh + * and a doupdate nothing will get flushed since this + * information is not being kept in curscr or _virtscr. + */ + (void) fflush(SP->term_file); + } + + slk->_changed = FALSE; + + return (win ? TRUE : FALSE); +} diff --git a/usr/src/lib/libcurses/screen/slk_restore.c b/usr/src/lib/libcurses/screen/slk_restore.c new file mode 100644 index 0000000000..6ce47297fc --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_restore.c @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Restore screen labels. */ + +int +slk_restore(void) +{ + if (SP->slk) { + SP->slk->_changed = TRUE; + (void) slk_touch(); + (void) slk_refresh(); + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/slk_set.c b/usr/src/lib/libcurses/screen/slk_set.c new file mode 100644 index 0000000000..afd010e52c --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_set.c @@ -0,0 +1,98 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <string.h> +#include <unistd.h> +#include "curses_inc.h" + +/* + * Set a soft label. + * + * n: label number + * lab: the string + * f: 0, 1, 2 for left, center, right-justification + */ + +int +slk_set(int n, char *lab, int f) +{ + SLK_MAP *slk = SP->slk; + int len, slklen = slk->_len, left; + char *cp, nlab[LABLEN + 1]; + + if ((slk == NULL) || f < 0 || f > 2 || n < 1 || n > slk->_num) + return (ERR); + + /* 0-indexing internally */ + n--; + + if (lab == NULL) { + lab = ""; + + } else { + /* chop lengthy label */ + /* LINTED */ + if ((len = (int) strlen(lab)) > slklen) + lab[len = slklen] = '\0'; + } + + /* make the new display label */ + for (cp = nlab + slklen - 1; cp >= nlab; cp--) + *cp = ' '; + nlab[slklen] = '\0'; + if (f == 0) + left = 0; + else + left = (slklen - len) / ((f == 1) ? 2 : 1); + + (void) memcpy(nlab + left, lab, len); + + if (strcmp(slk->_ldis[n], nlab) != 0) { + (void) memcpy(slk->_lval[n], lab, len + 1); + (void) memcpy(slk->_ldis[n], nlab, slklen + 1); + slk->_changed = slk->_lch[n] = TRUE; + } + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/slk_start.c b/usr/src/lib/libcurses/screen/slk_start.c new file mode 100644 index 0000000000..0cf6a8cd4a --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_start.c @@ -0,0 +1,249 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +/* + * Initialize usage of soft labels + * This routine should be called before each call of newscreen + * or initscr to initialize for the next terminal. + * + * ng: number of groupings. If gp is NULL, it denotes one + * of two default groupings: + * 0: - - - - - - - - + * 1: - - - - - - - - + * gp: groupings. + */ + +static void _init_slk_func(void); +static int _slk_setpos(int, short *); +static int _ngroups, _groups[LABMAX]; + +int +slk_start(int ng, int *gp) +{ + int i = 0, j = 0; + + if (gp == NULL) { + switch (ng) { + case 2 : + _ngroups = 2; + _groups[0] = 4; + _groups[1] = 4; + break; + + case 3 : +no_format : + _ngroups = 3; + _groups[0] = 3; + _groups[1] = 2; + _groups[2] = 3; + break; + + default : + if (label_format) { + int k; + char ch1[3], *ch = label_format; + + /*CONSTCOND*/ + while (TRUE) { + if ((*ch == ',') || + (*ch == '\0')) { + ch1[i] = '\0'; + if ((k = atoi(ch1)) <= + 0) + goto err; + _groups[j++] = k; + i = 0; + if (*ch == '\0') { + break; + } + } else + ch1[i++] = *ch++; + } + } else + goto no_format; + break; + } + } else { + for (; i < ng; i++) { + if ((j += gp[i]) > LABMAX) +err : + return (ERR); + _groups[i] = gp[i]; + } + _ngroups = ng; + } + + /* signal newscreen() */ + _slk_init = _init_slk_func; + return (OK); +} + +static void +_init_slk_func(void) +{ + int i, len, num; + SLK_MAP *slk; + char *cp, *ep; + WINDOW *win; + + /* clear this out to ready for next time */ + _slk_init = NULL; + + /* get space for slk structure */ + if ((slk = (SLK_MAP *) malloc(sizeof (SLK_MAP))) == NULL) { + curs_errno = CURS_BAD_MALLOC; +#ifdef DEBUG + strcpy(curs_parm_err, "_init_slk_func"); +#endif /* DEBUG */ + return; + } + + /* compute actual number of labels */ + num = 0; + for (i = 0; i < _ngroups; i++) + num += _groups[i]; + + /* max label length */ + if (plab_norm && (label_height * label_width >= LABLEN) && + (num_labels >= num)) { + win = NULL; + goto next; + } else { + if ((win = newwin(1, COLS, LINES - 1, 0)) == NULL) + goto err; + win->_leave = TRUE; + (void) wattrset(win, A_REVERSE | A_DIM); + + /* remove one line from the screen */ + LINES = --SP->lsize; + if ((len = (COLS - 1) / (num + 1)) > LABLEN) { +next : + len = LABLEN; + } + } + + /* positions to place labels */ + if (len <= 0 || num <= 0 || (_slk_setpos(len, slk->_labx) == ERR)) { + if (win != NULL) + (void) delwin(win); +err : + free(slk); + } else { + /* LINTED */ + slk->_num = (short) num; + /* LINTED */ + slk->_len = (short) len; + + for (i = 0; i < num; ++i) { + cp = slk->_ldis[i]; + ep = cp + len; + for (; cp < ep; ++cp) + *cp = ' '; + *ep = '\0'; + slk->_lval[i][0] = '\0'; + slk->_lch[i] = TRUE; + } + + slk->_changed = TRUE; + slk->_win = win; + + _do_slk_ref = _slk_update; + _do_slk_tch = slk_touch; + _do_slk_noref = slk_noutrefresh; + + SP->slk = slk; + } +} + + +/* + * Compute placements of labels. The general idea is to spread + * the groups out evenly. This routine is designed for the day + * when > 8 labels and other kinds of groupings may be desired. + * + * The main assumption behind the algorithm is that the total + * # of labels in all the groups is <= LABMAX. + * + * len: length of a label + * labx: to return the coords of the labels. + */ + +static int +_slk_setpos(int len, short *labx) +{ + int i, k, n, spread, left, begadd; + int grpx[LABMAX]; + + /* compute starting coords for each group */ + grpx[0] = 0; + if (_ngroups > 1) { + /* spacing between groups */ + for (i = 0, n = 0; i < _ngroups; ++i) + n += _groups[i] * (len + 1) - 1; + if ((spread = (COLS - (n + 1))/(_ngroups - 1)) <= 0) + return (ERR); + left = (COLS-(n + 1)) % (_ngroups - 1); + begadd = (_ngroups / 2) - (left / 2); + + /* coords of groups */ + for (i = 1; i < _ngroups; ++i) { + grpx[i] = grpx[i - 1] + (_groups[i - 1] * + (len + 1) - 1) + spread; + if (left > 0 && i > begadd) { + grpx[i]++; + left--; + } + } + } + + /* now set coords of each label */ + n = 0; + for (i = 0; i < _ngroups; ++i) + for (k = 0; k < _groups[i]; ++k) + labx[n++] = grpx[i] + k * (len + 1); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/slk_touch.c b/usr/src/lib/libcurses/screen/slk_touch.c new file mode 100644 index 0000000000..3128176bc8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/slk_touch.c @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Make the labels appeared changed. */ + +int +slk_touch(void) +{ + SLK_MAP *slk; + int i; + + if (((slk = SP->slk) == NULL) || (slk->_changed == 2)) + return (ERR); + + for (i = 0; i < slk->_num; ++i) + slk->_lch[i] = TRUE; + slk->_changed = TRUE; + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/start_col.c b/usr/src/lib/libcurses/screen/start_col.c new file mode 100644 index 0000000000..1eda194cbd --- /dev/null +++ b/usr/src/lib/libcurses/screen/start_col.c @@ -0,0 +1,168 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +#ifdef PC6300PLUS +#include <fcntl.h> +#include <sys/console.h> +#endif + +int +start_color(void) +{ + short i, j; + _Color *color_tbl; + +#ifdef PC6300PLUS + struct console con; +#endif + + /* if not a color terminal, return error */ + + if ((COLOR_PAIRS = max_pairs) == -1) + return (ERR); + + /* we have only 6 bits to store color-pair info */ + + if (COLOR_PAIRS > 64) + COLOR_PAIRS = 64; + +#ifdef PC6300PLUS + ioctl(cur_term->Filedes, CONIOGETDATA, &con); + if (!con.color) + return (ERR); +#endif + + /* allocate pairs_tbl */ + + if ((cur_term->_pairs_tbl = + (_Color_pair *) malloc((COLOR_PAIRS+1) * + sizeof (_Color_pair))) == NULL) + goto err2; + + COLORS = max_colors; + +/* the following is not required because we assume that color 0 is */ +/* always a default background. if this will change, we may want */ +/* to store the default colors in entry 0 of pairs_tbl. */ +/* + * cur_term->_pairs_tbl[0].foreground = 0; + * cur_term->_pairs_tbl[0].background = COLORS; + */ + + /* if terminal can change the definition of the color */ + /* allocate color_tbl */ + + if (can_change) + if ((color_tbl = (cur_term->_color_tbl = + (_Color *) malloc(COLORS * sizeof (_Color)))) == NULL) + goto err1; + + /* allocate color mark map for cookie terminals */ + + if (ceol_standout_glitch || (magic_cookie_glitch >= 0)) { + int i, nc; + char **marks; + + if ((marks = (char **) calloc((unsigned) LINES, + sizeof (char *))) == NULL) + goto err; + SP->_color_mks = marks; + nc = (COLS / BITSPERBYTE) + (COLS % BITSPERBYTE ? 1 : 0); + if ((*marks = (char *) calloc((unsigned) nc * LINES, + sizeof (char))) == NULL) { + free(marks); +err: free(color_tbl); +err1: free(cur_term->_pairs_tbl); +err2: return (ERR); + } + + for (i = LINES - 1; i-- > 0; ++marks) + *(marks + 1) = *marks + nc; + } + + if (can_change) { + /* initialize color_tbl with the following colors: black, blue, */ + /* green, cyan, red, magenta, yellow, black. if table has more */ + /* than 8 entries, use the same 8 colors for the following 8 */ + /* positions, and then again, and again .... If table has less */ + /* then 8 entries, use as many colors as will fit in. */ + + for (i = 0; i < COLORS; i++) { + j = i%8; + + if (j%2) + color_tbl[i].b = 1000; + else + color_tbl[i].b = 0; + + if ((j%4) > 1) + color_tbl[i].g = 1000; + else + color_tbl[i].g = 0; + + if (j > 3) + color_tbl[i].r = 1000; + else + color_tbl[i].r = 0; + } + + if (orig_colors) + (void) tputs(orig_colors, 1, _outch); + } + + if (orig_pair) + (void) tputs(tparm_p0(orig_pair), 1, _outch); + + /* for Tek terminals set the background color to zero */ + + if (set_background) { + (void) tputs(tparm_p1(set_background, 0), 1, _outch); + cur_term->_cur_pair.background = 0; + cur_term->_cur_pair.foreground = -1; + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/subwin.c b/usr/src/lib/libcurses/screen/subwin.c new file mode 100644 index 0000000000..c1c94375dd --- /dev/null +++ b/usr/src/lib/libcurses/screen/subwin.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +WINDOW * +subwin(WINDOW *win, int l, int nc, int by, int bx) +{ + return (derwin(win, l, nc, by - win->_begy, bx - win->_begx)); +} diff --git a/usr/src/lib/libcurses/screen/syncok.c b/usr/src/lib/libcurses/screen/syncok.c new file mode 100644 index 0000000000..a28f76174e --- /dev/null +++ b/usr/src/lib/libcurses/screen/syncok.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +syncok(WINDOW *win, bool bf) +{ + return (win->_parent ? win->_sync = bf : ERR); +} diff --git a/usr/src/lib/libcurses/screen/synonyms.h b/usr/src/lib/libcurses/screen/synonyms.h new file mode 100644 index 0000000000..51d1e96b31 --- /dev/null +++ b/usr/src/lib/libcurses/screen/synonyms.h @@ -0,0 +1,441 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYNONYMS_H +#define _SYNONYMS_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) + +/* external data */ +#define altzone _altzone +#define daylight _daylight +#define lone _lone +#define lten _lten +#define lzero _lzero +#define timezone _timezone +#define tzname _tzname + +/* functions */ +#define Msgdb _Msgdb +#define a64l _a64l +#define access _access +#define acct _acct +#define addseverity _addseverity +#define adjtime _adjtime +#define alarm _alarm +#define ascftime _ascftime +#define brk _brk +#define brkbase _brkbase +#define cat_init _cat_init +#define cat_malloc_init _cat_malloc_init +#define cat_name _cat_name +#define catclose _catclose +#define catgets _catgets +#define catopen _catopen +#define cfgetispeed _cfgetispeed +#define cfgetospeed _cfgetospeed +#define cfree _cfree +#define cfsetispeed _cfsetispeed +#define cfsetospeed _cfsetospeed +#define cftime _cftime +#define chdir _chdir +#define chmod _chmod +#define chown _chown +#define chroot _chroot +#define close _close +#define closedir _closedir +#define closelog _closelog +#define countbase _countbase +#define creat _creat +#define crypt _crypt +#define ctermid _ctermid +#define cuserid _cuserid +#define dial _dial +#define drand48 _drand48 +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define edata _edata +#define encrypt _encrypt +#define end _end +#define endgrent _endgrent +#define endpwent _endpwent +#define endspent _endspent +#define endutent _endutent +#define endutxent _endutxent +#define environ _environ +#define erand48 _erand48 +#define etext _etext +#define ev_traptousr _ev_traptousr +#define ev_usrtrapret _ev_usrtrapret +#define evsys _evsys +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define exportfs _exportfs +#define fattach _fattach +#define fchdir _fchdir +#define fchmod _fchmod +#define fchown _fchown +#define fcntl _fcntl +#define fcvt _fcvt +#define fdetach _fdetach +#define fdopen _fdopen +#define ffs _ffs +#define fgetgrent _fgetgrent +#define fgetpwent _fgetpwent +#define fgetspent _fgetspent +#define finite _finite +#define fmount _fmount +#define fmtmsg _fmtmsg +#define fork _fork +#define fpathconf _fpathconf +#define fpclass _fpclass +#define fpgetmask _fpgetmask +#define fpgetround _fpgetround +#define fpgetsticky _fpgetsticky +#define fpsetmask _fpsetmask +#define fpsetround _fpsetround +#define fpsetsticky _fpsetsticky +#define fptrap _fptrap +#define fstat _fstat +#define fstatvfs _fstatvfs +#define fsync _fsync +#define ftok _ftok +#define ftruncate _ftruncate +#define ftw _ftw +#define funmount _funmount +#define gcvt _gcvt +#define getcontext _getcontext +#define getcwd _getcwd +#define getdents _getdents +#define getegid _getegid +#define geteuid _geteuid +#define getgid _getgid +#define getgrent _getgrent +#define getgrgid _getgrgid +#define getgrnam _getgrnam +#define getgroups _getgroups +#define gethz _gethz +#define getitimer _getitimer +#define getlogin _getlogin +#define getmntany _getmntany +#define getmntent _getmntent +#define getmsg _getmsg +#define getopt _getopt +#define getpagesize _getpagesize +#define getpass _getpass +#define getpgid _getpgid +#define getpgrp _getpgrp +#define getpid _getpid +#define getpmsg _getpmsg +#define getppid _getppid +#define getpw _getpw +#define getpwent _getpwent +#define getpwnam _getpwnam +#define getpwuid _getpwuid +#define getrlimit _getrlimit +#define getsid _getsid +#define getspent _getspent +#define getspnam _getspnam +#define getsubopt _getsubopt +#define gettimeofday _gettimeofday +#define gettxt _gettxt +#define getuid _getuid +#define getutent _getutent +#define getutid _getutid +#define getutline _getutline +#define getutxent _getutxent +#define getutxid _getutxid +#define getutxline _getutxline +#define getvfsany _getvfsany +#define getvfsent _getvfsent +#define getvfsfile _getvfsfile +#define getvfsspec _getvfsspec +#define getw _getw +#define grantpt _grantpt +#define gsignal _gsignal +#define gtty _gtty +#define hcreate _hcreate +#define hdestroy _hdestroy +#define hrtalarm _hrtalarm +#define hrtascftime _hrtascftime +#define hrtasctime _hrtasctime +#define hrtcancel _hrtcancel +#define hrtcftime _hrtcftime +#define hrtcntl _hrtcntl +#define hrtctime _hrtctime +#define hrtnewres _hrtnewres +#define hrtsleep _hrtsleep +#define hrtstrftime _hrtstrftime +#define hsearch _hsearch +#define id2str _id2str +#define initgroups _initgroups +#define insque _insque +#define ioctl _ioctl +#define isastream _isastream +#define isatty _isatty +#define jrand48 _jrand48 +#define kill _kill +#define l3tol _l3tol +#define l64a _l64a +#define ladd _ladd +#define lchown _lchown +#define lckpwdf _lckpwdf +#define lcong48 _lcong48 +#define ldivide _ldivide +#define lexp10 _lexp10 +#define lfind _lfind +#define link _link +#define llog10 _llog10 +#define lmul _lmul +#define lockf _lockf +#define lrand48 _lrand48 +#define lsearch _lsearch +#define lseek _lseek +#define lshiftl _lshiftl +#define lsign _lsign +#define lstat _lstat +#define lsub _lsub +#define ltol3 _ltol3 +#define makecontext _makecontext +#define mctl _mctl +#define memalign _memalign +#define memccpy _memccpy +#define memcntl _memcntl +#define mincore _mincore +#define mkdir _mkdir +#define mkfifo _mkfifo +#define mknod _mknod +#define mktemp _mktemp +#define mlock _mlock +#define mlockall _mlockall +#define mmap _mmap +#define monitor _monitor +#define mount _mount +#define mprotect _mprotect +#define mrand48 _mrand48 +#define msgctl _msgctl +#define msgget _msgget +#define msgrcv _msgrcv +#define msgsnd _msgsnd +#define msync _msync +#define munlock _munlock +#define munlockall _munlockall +#define munmap _munmap +#define nfs_getfh _nfs_getfh +#define nfssvc _nfssvc +#define nftw _nftw +#define nice _nice +#define nrand48 _nrand48 +#define nuname _nuname +#define open _open +#define opendir _opendir +#define openlog _openlog +#define pathconf _pathconf +#define pause _pause +#define pclose _pclose +#define pipe _pipe +#define plock _plock +#define poll _poll +#define popen _popen +#define profil _profil +#define psiginfo _psiginfo +#define psignal _psignal +#define ptrace _ptrace +#define ptsname _ptsname +#define putenv _putenv +#define putmsg _putmsg +#define putpmsg _putpmsg +#define putpwent _putpwent +#define putspent _putspent +#define pututline _pututline +#define pututxline _pututxline +#define putw _putw +#define read _read +#define readdir _readdir +#define readlink _readlink +#define readv _readv +#define realpath _realpath +#define remque _remque +#define rfsys _rfsys +#define rmdir _rmdir +#define sbrk _sbrk +#define seed48 _seed48 +#define seekdir _seekdir +#define select _select +#define semctl _semctl +#define semget _semget +#define semop _semop +#define setcontext _setcontext +#define setegid _setegid +#define seteuid _seteuid +#define setgid _setgid +#define setgrent _setgrent +#define setgroups _setgroups +#define setitimer _setitimer +#define setkey _setkey +#define setlogmask _setlogmask +#define setpgid _setpgid +#define setpgrp _setpgrp +#define setpwent _setpwent +#define setrlimit _setrlimit +#define setsid _setsid +#define setspent _setspent +#define settimeofday _settimeofday +#define setuid _setuid +#define setutent _setutent +#define setutxent _setutxent +#define shmat _shmat +#define shmctl _shmctl +#define shmdt _shmdt +#define shmget _shmget +#define sig2str _sig2str +#define sigaction _sigaction +#define sigaddset _sigaddset +#define sigaltstack _sigaltstack +#define sigdelset _sigdelset +#define sigemptyset _sigemptyset +#define sigfillset _sigfillset +#define sigflag _sigflag +#define sighold _sighold +#define sigignore _sigignore +#define sigismember _sigismember +#define siglongjmp _siglongjmp +#define sigpause _sigpause +#define sigpending _sigpending +#define sigprocmask _sigprocmask +#define sigrelse _sigrelse +#define sigsend _sigsend +#define sigsendset _sigsendset +#define sigset _sigset +#define sigsetjmp _sigsetjmp +#define sigsuspend _sigsuspend +#define sleep _sleep +#define srand48 _srand48 +#define ssignal _ssignal +#define stat _stat +#define statfs _statfs +#define statvfs _statvfs +#define stime _stime +#define str2id _str2id +#define str2sig _str2sig +#define strdup _strdup +#define stty _stty +#define swab _swab +#define swapcontext _swapcontext +#define swapctl _swapctl +#define symlink _symlink +#define sync _sync +#define sys3b _sys3b +#define sys_errlist _sys_errlist +#define sys_nerr _sys_nerr +#define syscall _syscall +#define sysconf _sysconf +#define sysfs _sysfs +#define sysinfo _sysinfo +#define syslog _syslog +#define tcdrain _tcdrain +#define tcflow _tcflow +#define tcflush _tcflush +#define tcgetattr _tcgetattr +#define tcgetpgrp _tcgetpgrp +#define tcgetsid _tcgetsid +#define tcsendbreak _tcsendbreak +#define tcsetattr _tcsetattr +#define tcsetpgrp _tcsetpgrp +#define tdelete _tdelete +#define tell _tell +#define telldir _telldir +#define tempnam _tempnam +#define tfind _tfind +#define times _times +#define truncate _truncate +#define tsearch _tsearch +#define ttyname _ttyname +#define ttyslot _ttyslot +#define twalk _twalk +#define tzname _tzname +#define tzset _tzset +#define uadmin _uadmin +#define ulckpwdf _ulckpwdf +#define ulimit _ulimit +#define umask _umask +#define umount _umount +#define uname _uname +#define undial _undial +#define unlink _unlink +#define unlockpt _unlockpt +#define unordered _unordered +#define updutmp _updutmp +#define updwtmpx _updwtmpx +#define utime _utime +#define utmpname _utmpname +#define utmpxname _utmpxname +#define utssys _utssys +#define valloc _valloc +#define vfork _vfork +#define vsyslog _vsyslog +#define wait _wait +#define waitid _waitid +#define waitpid _waitpid +#define write _write +#define writev _writev +#define _assert __assert +#define _ctype __ctype +#define _filbuf __filbuf +#define _flsbuf __flsbuf +#define _iob __iob + +#else /* not __STDC__ */ + +#define const + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SYNONYMS_H */ diff --git a/usr/src/lib/libcurses/screen/tcsearch.c b/usr/src/lib/libcurses/screen/tcsearch.c new file mode 100644 index 0000000000..e40e25f474 --- /dev/null +++ b/usr/src/lib/libcurses/screen/tcsearch.c @@ -0,0 +1,67 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <string.h> + +int +_tcsearch(char *cap, short offsets[], char *names[], int size, int n) +{ + int l = 0, u = size - 1; + int m, cmp; + + while (l <= u) { + m = (l + u) / 2; + cmp = ((n == 0) ? strcmp(cap, names[offsets[m]]) : + strncmp(cap, names[offsets[m]], n)); + + if (cmp < 0) + u = m - 1; + else + if (cmp > 0) + l = m + 1; + else + return (offsets[m]); + } + return (-1); +} diff --git a/usr/src/lib/libcurses/screen/termattrs.c b/usr/src/lib/libcurses/screen/termattrs.c new file mode 100644 index 0000000000..f87c4d36dd --- /dev/null +++ b/usr/src/lib/libcurses/screen/termattrs.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +chtype +termattrs(void) +{ + return (cur_term->bit_vector); +} diff --git a/usr/src/lib/libcurses/screen/termcap.ed b/usr/src/lib/libcurses/screen/termcap.ed new file mode 100644 index 0000000000..da57358091 --- /dev/null +++ b/usr/src/lib/libcurses/screen/termcap.ed @@ -0,0 +1,188 @@ +H +!rm -f termcap.c +0a +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Simulation of termcap using terminfo. + * This file is created from termcap.ed. DO NOT EDIT ME! + */ + +/* + * These are declared so people won't get undefineds if they use + * old documentation. We don't do anything with them. + */ + +#include <sys/types.h> +#include <string.h> +#include "curses_inc.h" + +char *UP; +char *BC; +char PC; +short ospeed; + +/* ARGSUSED */ +int +tgetent(char *bp, char *name) +{ + int rv; + + if (setupterm(name, 1, &rv) >= 0) + /* Leave things as they were (for compatibility) */ + (void) reset_shell_mode(); + return (rv); +} + +/* Make a 2 letter code into an integer we can switch on easily */ +#define _TWO(s1, s2) (s1 + 256*s2) +#define _TWOSTR(str) _TWO(*str, str[1]) + +static char * +_stripdelays(char *inbuf, char *outbuf, int size) +{ + char *saveoutbuf = outbuf; + + if (inbuf == NULL) + return (0); + else + while (size && *inbuf) + if (*inbuf == '$' && *(inbuf+1) == '<') + /* LINTED */ + while (*inbuf && *inbuf++ != '>'); + else { + size--; + *outbuf++ = *inbuf++; + *outbuf = 0; + } + return (saveoutbuf); +} + +/* generated by sort on caps */ +static short booloffsets[] = + { /* generated by sort on caps */ +. +!sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp +.r !cat ./tmp/termcap.tmp +.a + }; + +/* generated by sort on caps */ +static short numoffsets[] = + { +. +!sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp +.r !cat ./tmp/termcap.tmp +.a + }; + +/* generated by sort on caps */ +static short stroffsets[] = + { +. +!sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $3, i++}' | sort > ./tmp/termcap.tmp +.r !cat ./tmp/termcap.tmp +!rm ./tmp/termcap.tmp +.a + }; + +/* + * Return the value of the boolean capability tcstr. + * Return 0 if the capability is not found. + */ + +int +tgetflag(char *tcstr) +{ + char *p; + char stripped[16]; + + switch (_TWOSTR(tcstr)) { + /* Special cases that do not have exact terminfo equivalents */ + case _TWO('b','s'): + /* bs: true if ^H moves the cursor left */ + p = _stripdelays(cursor_left, stripped, 16); + return (p && *p == 8 && p[1] == 0); + case _TWO('p','t'): + /* pt: true if terminal has ^I tabs every 8 spaces */ + p = _stripdelays(tab, stripped, 16); + return (p && *p == 9 && p[1] == 0); + case _TWO('n','c'): + /* cr: true if ^M does not return the cursor */ + p = _stripdelays(carriage_return, stripped, 16); + return (! (p && *p == 13 && p[1] == 0)); + case _TWO('n','s'): + /* ns: true if no way to scroll the terminal */ + return (scroll_forward == NULL); + } + { + int n = _NUMELEMENTS(booloffsets); + int offset = _tcsearch(tcstr, booloffsets, boolcodes, n, 2); + char *bool_array = (char *) cur_bools; + + if (offset == -1) + return (0); + else + return (bool_array[offset]); + } +} + +/* + * Return the value of the numeric capability tcstr. + * Return -1 if the capability is not found. + */ + +int +tgetnum(char *tcstr) +{ + int n = _NUMELEMENTS(numoffsets); + int offset = _tcsearch(tcstr, numoffsets, numcodes, n, 2); + short *num_array = (short *) cur_nums; + + if (offset == -1) + return (-1); + else + return (num_array[offset]); +} + +/* + * Return the string capability for capability "id". We also copy + * it into *area for upward compatibility with a few programs that + * actually expect it to be copied, at a slight cost in speed. + */ + +char * +tgetstr(char *tcstr, char **area) +{ + int n = _NUMELEMENTS(stroffsets); + int offset = _tcsearch(tcstr, stroffsets, strcodes, n, 2); + char **str_array = (char **) cur_strs; + char *rv; + + if (offset == -1) + return (0); + rv = str_array[offset]; + if (area && *area && rv) { + (void) strcpy(*area, rv); + *area += strlen(rv) + 1; + } + return (rv); +} +. +w termcap.c +q diff --git a/usr/src/lib/libcurses/screen/termerr.c b/usr/src/lib/libcurses/screen/termerr.c new file mode 100644 index 0000000000..660937665d --- /dev/null +++ b/usr/src/lib/libcurses/screen/termerr.c @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include "_curs_gettext.h" +#include <signal.h> /* use this file to determine if this is SVR4.0 system */ +#include <sys/types.h> + +char *term_err_strings[8]; +static int first_term_err_message = 0; + +void +termerr(void) +{ + if (first_term_err_message == 0) { + first_term_err_message = 1; + term_err_strings[0] = +#ifdef SIGSTOP /* SVR4.0 and beyond */ + _curs_gettext("/usr/share/lib/terminfo is unaccessible"); +#else + _curs_gettext("/usr/lib/terminfo is unaccessible"); +#endif + term_err_strings[1] = + _curs_gettext("I don't know anything about your \"%s\" terminal"); + term_err_strings[2] = + _curs_gettext("corrupted terminfo entry"); + term_err_strings[3] = + _curs_gettext("terminfo entry too long"); + term_err_strings[4] = + _curs_gettext("TERMINFO pathname for device exceeds 512 characters"); + term_err_strings[5] = +#ifdef DEBUG + "malloc returned NULL in function \"%s\""; +#else + _curs_gettext("malloc returned NULL"); +#endif /* DEBUG */ + term_err_strings[6] = + _curs_gettext("terminfo file for \"%s\" terminal is not readable"); + } + + (void) fprintf(stderr, _curs_gettext("Sorry, ")); + (void) fprintf(stderr, term_err_strings[term_errno-1], term_parm_err); + (void) fprintf(stderr, ".\r\n"); +} diff --git a/usr/src/lib/libcurses/screen/termname.c b/usr/src/lib/libcurses/screen/termname.c new file mode 100644 index 0000000000..aa28e0c2ef --- /dev/null +++ b/usr/src/lib/libcurses/screen/termname.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +char * +termname(void) +{ + return (cur_term->_termname); +} diff --git a/usr/src/lib/libcurses/screen/tgetch.c b/usr/src/lib/libcurses/screen/tgetch.c new file mode 100644 index 0000000000..c0f8ca0bd4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/tgetch.c @@ -0,0 +1,632 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include <signal.h> +#include <unistd.h> +#ifdef DEBUG +#include <ctype.h> +#endif /* DEBUG */ + +/* + * Read a key typed from the terminal + * + * interpret: = 0 for single-char key only + * = 1 for matching function key and macro patterns. + * = 2 same as 1 but no time-out for funckey matching. + */ + +static int _getkey(int, chtype *); +static int _fpk(void); +static int _pk(void); + +chtype +tgetch(int interpret) +{ + int i = 0, j, collapse = 1; +#define WAIT3 333 + chtype inp; + chtype *inputQ = cur_term->_input_queue; + char *chars_onQ = &(cur_term->_chars_on_queue); + +#ifdef SYSV + /* + * Register the fact that getch is being used so + * that typeahead checking can be done. + * This code should GO AWAY when a poll() or FIONREAD can + * be done on the file descriptor as then the check + * will be non-destructive. + */ + cur_term->fl_typeahdok = TRUE; +#endif /* SYSV */ + + /* ask for input */ + if (cur_term->_ungotten > 0) { + cur_term->_ungotten--; + /* decode an ungetch()'d character */ + inp = -inputQ[0]; + } else { + /* Only read a character if there is no typeahead/peekahead. */ + if (*chars_onQ == 0) { + /* (*chars_onQ)++; MR */ +#ifdef FIONREAD + inp = _readchar(); +#else /* FIONREAD */ + inp = (chtype) _pk(); + if ((int)inp == ERR) { + /* + * interpret is set to 0 so that down below we don't + * drop into getkey since we already know there can't be + * a key that starts with -1. Also, we don't want to + * access funckeystarter[-1]. + */ + interpret = FALSE; + } +#endif /* FIONREAD */ + (*chars_onQ)++; + } else + inp = inputQ[0]; + +#ifdef DEBUG + if (outf) + fprintf(outf, "TGETCH read '%s'\n", unctrl(inp)); +#endif /* DEBUG */ + + /* Check for arrow and function keys */ + if (interpret && cur_term->funckeystarter[inp]) + collapse = _getkey(interpret - 1, &inp); + } + + /* Collapse the input queue to remove the escape */ + /* sequence from the stack. */ + + j = *chars_onQ; + (*chars_onQ) -= collapse; + while (collapse < j) + inputQ[i++] = inputQ[collapse++]; + return (inp); +} + +#ifdef FIONREAD +static int +_readchar() +{ + int i; + unsigned char c; + + if (cur_term->_delay == 0) { + int arg; + + (void) ioctl(cur_term->_inputfd, FIONREAD, &arg); +#ifdef DEBUG + if (outf) + fprintf(outf, "FIONREAD returns %d\n", arg); +#endif /* DEBUG */ + if (arg < 1) + return (-1); + } else + if (cur_term->_delay > 0) { + char c; + int infd; + + infd = 1 << cur_term->_inputfd; + t.tv_sec = cur_term->_delay / 1000; + t.tv_usec = (cur_term->_delay % 1000) * 1000; + i = select(20, &infd, (int *)NULL, (int *)NULL, &t); + if (i < 0) + return (ERR); + i = read(cur_term->_inputfd, &c, 1); + } else + i = read(cur_term->_inputfd, &c, 1); + +#ifdef DEBUG + if (outf) + fprintf(outf, "read from %d returns %d chars, first %o\n", + cur_term->_inputfd, i, c); +#endif /* DEBUG */ + + if (i > 0) + return (c); + else + return (ERR); +} +#endif /* !FIONREAD */ + +#ifdef DEBUG +extern char *_asciify(); +#endif /* DEBUG */ + +/* + * This algorithm is a "learning" algorithm. The premise is + * that keys used once are like to be used again and again. + * Since the time for a linear search of the table is so + * expensive, we move keys that are found up to the top of + * the list, making the access to a repeated key very fast and + * keys that have been used before close to the top. + */ + +static int +_getkey(int blockpeek, chtype *inp) +{ + _KEY_MAP **kp = cur_term->_keys; + int key, num_keys = cur_term->_ksz; + int i; + chtype *inputQ = cur_term->_input_queue; + char *chars_onQ = &(cur_term->_chars_on_queue), + flag = cur_term->funckeystarter[*inp]; + int first, collapse = 1; + + +#ifdef DEBUG + if (outf) + fprintf(outf, "getkey(): looking in linear table, " + "inp=%d\n", *inp); +#endif /* DEBUG */ + + if (flag & _KEY) + key = 0; + else { + key = cur_term->_first_macro; + blockpeek = TRUE; + } + first = key; + + for (; key < num_keys; key++) { + if (kp[key]->_sends[0] == *inp) { + for (i = 1; i < INP_QSIZE; i++) { + /* found it? */ + if (kp[key]->_sends[i] == '\0') + break; + /* partial match? peek ahead. */ + if (*chars_onQ == i) { + (*chars_onQ)++; + inputQ[i] = (blockpeek) ? + _pk() : _fpk(); + switch ((int)inputQ[i]) { + case -2: + /* + * Since -2 signifies a timeout we don't really + * want to put it on the queue so we decrement + * our counter. + */ + (*chars_onQ)--; +#ifdef DEBUG + if (outf) + fprintf(outf, "Timed out\n"); +#endif /* DEBUG */ + if (flag & _MACRO) { +#ifdef DEBUG + if (outf) + fprintf(outf, + "Found macro\n"); +#endif /* DEBUG */ + /* + * We have to decrement one because key will be + * incremented at the bottom of the out loop. + */ + key = (first = blockpeek = + cur_term->_first_macro) - + 1; + goto outerloop; + } + + /*FALLTHROUGH*/ + + case -1: + goto ret; + } + } + + /* not this one? */ + if (kp[key]->_sends[i] != inputQ[i]) + goto outerloop; + } + + /* SS-mouse */ + if (kp[key]->_keyval == KEY_MOUSE) { + MOUSE_STATUS old_mouse; + int rc; + static int get_xterm_mouse(int, int *); + + old_mouse = Mouse_status; + + /* read the mouse status information */ + + if (mouse_info) + rc = -3; /* NOT IMPLEMENTED */ + else + rc = get_xterm_mouse(blockpeek, &i); + + if (rc == -1) /* read error */ + goto ret; + else if (rc == -2 || rc == -3) /* timeout */ + /* or not mouse */ + goto outerloop; + else if (rc == 0) /* report mouse pos */ + Mouse_status.changes |= 020; + else if (rc >= 1 && rc <= 3) + /* mouse button event */ + Mouse_status.changes = + (((MOUSE_X_POS != old_mouse.x || + MOUSE_Y_POS != old_mouse.y) << 3) | + ((Mouse_status.button[2] != + old_mouse.button[2]) << 2) | + ((Mouse_status.button[1] != + old_mouse.button[1]) << 1) | + (Mouse_status.button[0] != + old_mouse.button[0])); + } + + /* We found it! Read in any chars left in _sends */ + + if ((collapse = i) == INP_QSIZE) + for (; kp[key]->_sends[i]; i++) + (void) _fpk(); + + /* move key to top of ordered list */ + if (key != first) { + _KEY_MAP *savekey = kp[key]; + short *lorder; + int j; + + if (key > cur_term->_first_macro) + lorder = &(cur_term->_lastmacro_ordered); + else + lorder = &(cur_term->_lastkey_ordered); + /* + * If we're below the last ordered key, swap next unordered + * key with this one and ripple from there. + */ + if (key > *lorder) + kp[key] = kp[(i = ++(*lorder))]; + else + i = key; + /* ripple the ordered keys down */ + for (j = i--; j > first; ) + kp[j--] = kp[i--]; + kp[first] = savekey; + } + *inp = kp[first]->_keyval; + + /* + * SS-mouse support: if mouse button event + * occured on top of the soft label, we may + * have to return the function key corresponding + * to that soft label + */ + + if (*inp == KEY_MOUSE && A_BUTTON_CHANGED && + (MOUSE_Y_POS == LINES) && + (SP->slk != (SLK_MAP *) NULL) && + (SP->_map_mbe_to_key != 0)) { + static void _map_button(chtype *); + _map_button(inp); + } + + goto ret; + } +outerloop: + ; + } + +ret: + /* key not found */ +#ifdef DEBUG + if (outf) + if (key == num_keys) + fprintf(outf, "Did not match anything.\n"); +#endif /* DEBUG */ + return (collapse); +} + + +/* SS-mouse */ +/* this function tries to read in information that follows KEY_MOUSE: */ +/* the first character identifies what button is involved (1,2,or 3) */ +/* if the first character is 0, we are dealing with report_mouse_pos */ +/* + * The routine returns the following: + * -3: not a mouse button event + * -2: read timed out + * -1: the read failed + * [0, 1, 2, 3] - the first character in the mouse event + */ +static int +get_xterm_mouse(int blockpeek, int *i) +{ + chtype *inputQ = cur_term->_input_queue; /* ??? */ + /* LINTED */ + chtype *chars_onQ = (chtype *) &(cur_term->_chars_on_queue); + int j, mx, my; + int char1, char2, c1, c2; + + /* the first character should be 0, 1, 2, or 4 */ + + char1 = (inputQ[(*i)++] = (blockpeek) ? _pk() : _fpk()); + + /* read error or timeout */ + + if (char1 < 0) + return (char1); + (*chars_onQ)++; + + if (char1 < '0' || char1 > '3') + return (-3); + + /* if the character is 1, 2, or 3 it must be followed by */ + /* P, R, C, D, or T */ + + if (char1 != '0') { + char2 = (inputQ[(*i)++] = (blockpeek) ? _pk() : _fpk()); + + if (char2 < 0) + return (char2); + + (*chars_onQ)++; + if (char2 != 'P' && char2 != 'R' && char2 != 'C' && + char2 != 'D' && char2 != 'T') + return (-3); + } + + /* read X and Y coordinates of the mouse */ + + for (j = 0; j < 2; j++) { + c1 = (inputQ[(*i)++] = (blockpeek) ? _pk() : _fpk()); + if (c1 < 0) + return (c1); + (*chars_onQ)++; + if (c1 >= ' ' && c1 <= '~') { /* ascii char */ + if (j == 0) + mx = c1 - ' '; + else + my = c1 - ' '; + } else if (char1 == 01 || char1 == 02) { /* ^A || ^B */ + c2 = (inputQ[(*i)++] = (blockpeek) ? _pk() : _fpk()); + if (c2 < 0) + return (c2); + (*chars_onQ)++; + if (c2 >= ' ' && c2 <= '~') { + if (j == 0) + mx = c1 * (c2 - ' '); + else + my = c1 * (c2 - ' '); + } else + return (-3); + } else + return (-3); + } + + /* read complete mouse event: update the Mouse_status structure */ + + MOUSE_X_POS = mx; + MOUSE_Y_POS = my; + j = char1 - '0'; + if (j != 0) { + switch (char2) { + case 'P': + BUTTON_STATUS(j) = BUTTON_PRESSED; + break; + case 'R': + BUTTON_STATUS(j) = BUTTON_RELEASED; + break; + case 'C': + BUTTON_STATUS(j) = BUTTON_CLICKED; + break; + case 'D': + BUTTON_STATUS(j) = BUTTON_DOUBLE_CLICKED; + break; + case 'T': + BUTTON_STATUS(j) = BUTTON_TRIPLE_CLICKED; + break; + } + } + return (j); +} +/* SS-mouse-end */ + + +/* + * Fast peek key. Like getchar but if the right flags are set, times out + * quickly if there is nothing waiting, returning -1. + * f is an output stdio descriptor, we read from the fileno. + * We wait for long enough for a terminal to send another character + * (at 15cps repeat rate, this is 67 ms, I'm using 100ms to allow + * a bit of a fudge factor) and time out more quickly. + * -2 is returned if we time out, -1 is returned if interrupted, and the + * character is returned otherwise. + */ + +#ifndef FIONREAD + +/* + * Traditional implementation. The best resolution we have is 1 second, + * so we set a 1 second alarm and try to read. If we fail for 1 second, + * we assume there is no key waiting. Problem here is that 1 second is + * too long; people can type faster than this. + * + * Another possible implementation of changing VMIN/VTIME before and + * after each read does not work because the tty driver's timeout + * mechanism is too unreliable when the timeouts are changed too quickly. + */ + +static char sig_caught; + +static +#ifdef SIGPOLL /* Vr3 and beyond */ +void +#endif /* SIGPOLL */ +/* The following line causes a lint warning for "dummy" which is not used. */ +_catch_alarm(int dummy) +{ + sig_caught = 1; +} + +static int +_fpk(void) +{ + unsigned char c; + int infd = cur_term->_inputfd; + ssize_t rc; +#ifdef SIGPOLL /* Vr3 and beyond */ + void (*oldsig)(int); +#else /* SIGPOLL */ + int (*oldsig)(int); +#endif /* SIGPOLL */ + unsigned int oldalarm, alarm(unsigned); + + /* turn off any user alarms and set our own */ + oldalarm = alarm(0); + sig_caught = 0; + oldsig = signal(SIGALRM, _catch_alarm); + (void) alarm(1); + rc = read(cur_term->_inputfd, (char *)&c, 1); + (void) alarm(0); + + /* + * This code is to take care of the possibility of + * the process getting swapped out in the middle of + * read() call above. The interrupt will cause the + * read() call to retur, even if a character is really + * on the clist. So we do a non-blocking read() to make + * sure that there really isn't a character there. + */ + + if (sig_caught && rc != 1) + if (cur_term->_check_fd != -1) + rc = read(cur_term->_check_fd, (char *)&c, 1); + else { +#include <fcntl.h> + int fcflags = fcntl(infd, F_GETFL, 0); + + (void) fcntl(infd, F_SETFL, fcflags | O_NDELAY); + rc = read(infd, (char *)&c, 1); + (void) fcntl(infd, F_SETFL, fcflags); + } + + /* restore the user alarms */ + (void) signal(SIGALRM, oldsig); + if (sig_caught && oldalarm > 1) + oldalarm--; + (void) alarm(oldalarm); + if (rc == 1) /* got a character */ + return (c); + else + if (sig_caught) /* timed out */ + return (-2); + else /* EOF or got interrupted */ + return (-1); +} +#else /* FIONREAD */ +/* + * If we have the select system call, we can do much better than the + * traditional method. Even if we don't have the real 4.2BSD select, we + * can emulate it with napms and FIONREAD. napms might be done with only + * 1 second resolution, but this is no worse than what we have in the + * traditional implementation. + */ +static +_fpk() +{ + int infd, rc; + int *outfd, *exfd; + unsigned char c; + struct timeval t; + + infd = 1 << cur_term->_inputfd; + outfd = exfd = (int *)NULL; + t.tv_sec = 0; + t.tv_usec = 100000; /* 100 milliseconds */ + rc = select(20, &infd, outfd, exfd, &t); + if (rc < 0) + return (-2); + rc = read(fileno(f), &c, 1); + return (rc == 1 ? c : -1); +} +#endif /* FIONREAD */ + +/* + * Plain peekchar function. Nothing fancy. This is just like _fpk + * but will wait forever rather than time out. + */ + +static int +_pk(void) +{ + unsigned char c; + + return ((read(cur_term->_inputfd, (char *)&c, 1) == 1) ? c : ERR); +} + + +/* + * SS-mouse: check if this mouse button event should map into + * function key + */ + + +static void +_map_button(chtype *inp) +{ + SLK_MAP *slk = SP->slk; + int num = slk->_num; + int len = slk->_len; + int i; + + /* first determine if this mouse button event should be */ + /* mapped into function key */ + + if (!(SP->_map_mbe_to_key & + ((BUTTON_CHANGED(3) << (10 + BUTTON_STATUS(3))) | + (BUTTON_CHANGED(2) << (5 + BUTTON_STATUS(2))) | + (BUTTON_CHANGED(1) << BUTTON_STATUS(1))))) + return; + + for (i = 0; i < num; i++) { + if (MOUSE_X_POS < slk->_labx[i]) + break; + if (MOUSE_X_POS > slk->_labx[i] + len) + continue; + *inp = KEY_F(1) + i; + break; + } +} diff --git a/usr/src/lib/libcurses/screen/tgetwch.c b/usr/src/lib/libcurses/screen/tgetwch.c new file mode 100644 index 0000000000..cb0a315c8c --- /dev/null +++ b/usr/src/lib/libcurses/screen/tgetwch.c @@ -0,0 +1,74 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Read a process code from the terminal + * cntl: = 0 for single-char key only + * = 1 for matching function key and macro patterns. + * = 2 same as 1 but no time-out for funckey matching. + */ + +wchar_t +tgetwch(int cntl) +{ + int c, n, type, width; + char buf[CSMAX]; + wchar_t wchar; + + /* get the first byte */ + /* LINTED */ + if ((c = (int)tgetch(cntl)) == ERR) + return (ERR); + + type = TYPE(c); + width = cswidth[type] - ((type == 1 || type == 2) ? 0 : 1); + /* LINTED */ + buf[0] = (char)c; + for (n = 1; n < width; ++n) { + /* LINTED */ + if ((c = (int)tgetch(cntl)) == ERR) + return (ERR); + if (TYPE(c) != 0) + return (ERR); + /* LINTED */ + buf[n] = (char)c; + } + + /* translate it to process code */ + (void) _curs_mbtowc(&wchar, buf, n); + return (wchar); +} diff --git a/usr/src/lib/libcurses/screen/tgoto.c b/usr/src/lib/libcurses/screen/tgoto.c new file mode 100644 index 0000000000..d0bf7f3298 --- /dev/null +++ b/usr/src/lib/libcurses/screen/tgoto.c @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +/* + * tgoto: function included only for upward compatibility with old termcap + * library. Assumes exactly two parameters in the wrong order. + */ + +char * +tgoto(char *cap, int col, int row) +{ + char *cp; + + cp = tparm_p2(cap, row, col); + return (cp); +} diff --git a/usr/src/lib/libcurses/screen/tifget.ed b/usr/src/lib/libcurses/screen/tifget.ed new file mode 100644 index 0000000000..36a65f387b --- /dev/null +++ b/usr/src/lib/libcurses/screen/tifget.ed @@ -0,0 +1,91 @@ +H +!rm -f tifget.c +0a +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Routines to retrieve a value based on the short terminfo name. + * This file is created from tifget.ed. DO NOT EDIT ME! + */ + +#include <sys/types.h> +#include "curses_inc.h" + +/* generated by sort on caps */ +static short booloffsets[] = + { +. +!sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $1, i++}' | sort > ./tmp/tifget.tmp +.r !cat ./tmp/tifget.tmp +.a + }; + +/* generated by sort on caps */ +static short numoffsets[] = + { +. +!sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $1, i++}' | sort > ./tmp/tifget.tmp +.r !cat ./tmp/tifget.tmp +.a + }; + +/* generated by sort on caps */ +static short stroffsets[] = + { +. +!sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $1, i++}' | sort > ./tmp/tifget.tmp +.r !cat ./tmp/tifget.tmp +!rm ./tmp/tifget.tmp +.a + }; + +/* + * Return the value of the long-named boolean capability tistr. + * Return -1 if the name is not a boolean capability. + */ + +int +tifgetflag(char *tistr) +{ + int offset; + char *bool_array = (char *) cur_bools; + + return (((offset = _tcsearch(tistr, booloffsets, boolfnames, + _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]); +} + +/* + * Return the value of the long-named numeric capability tistr. + * Return -2 if the name is not a numeric capability. + */ + +int +tifgetnum(char *tistr) +{ + int offset; + short *num_array = (short *) cur_nums; + + return (((offset = _tcsearch(tistr, numoffsets, numfnames, + _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]); +} + +/* + * Return the value of the long-named string capability tistr. + * Return (char *) -1 if the name is not a string capability. + */ + +char * +tifgetstr(char *tistr) +{ + int offset; + char **str_array = (char **) cur_strs; + + return (((offset = _tcsearch(tistr, stroffsets, strfnames, + _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 : + str_array[offset]); +} +. +0r copyright.h +/copyright\.h/d +w tifget.c +q diff --git a/usr/src/lib/libcurses/screen/tiget.ed b/usr/src/lib/libcurses/screen/tiget.ed new file mode 100644 index 0000000000..2fd1bc1ee4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/tiget.ed @@ -0,0 +1,91 @@ +H +!rm -f tiget.c +0a +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Routines to retrieve a value based on the short terminfo name. + * This file is created from tiget.ed. DO NOT EDIT ME! + */ + +#include <sys/types.h> +#include "curses_inc.h" + +/* generated by sort on caps */ +static short booloffsets[] = + { +. +!sed -e '1,/^--- begin bool/d' -e '/^--- end bool/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp +.r !cat ./tmp/tiget.tmp +.a + }; + +/* generated by sort on caps */ +static short numoffsets[] = + { +. +!sed -e '1,/^--- begin num/d' -e '/^--- end num/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp +.r !cat ./tmp/tiget.tmp +.a + }; + +/* generated by sort on caps */ +static short stroffsets[] = + { +. +!sed -e '1,/^--- begin str/d' -e '/^--- end str/,$d' -e '/^#/d' < caps | awk '{printf "\t/* \%s */\t\%d,\n", $2, i++}' | sort > ./tmp/tiget.tmp +.r !cat ./tmp/tiget.tmp +!rm ./tmp/tiget.tmp +.a + }; + +/* + * Return the value of the boolean capability tistr. + * Return -1 if the name is not a boolean capability. + */ + +int +tigetflag(char *tistr) +{ + int offset; + char *bool_array = (char *) cur_bools; + + return (((offset = _tcsearch(tistr, booloffsets, boolnames, + _NUMELEMENTS(booloffsets), 0)) == -1) ? -1 : bool_array[offset]); +} + +/* + * Return the value of the numeric capability tistr. + * Return -2 if the name is not a numeric capability. + */ + +int +tigetnum(char *tistr) +{ + int offset; + short *num_array = (short *) cur_nums; + + return (((offset = _tcsearch(tistr, numoffsets, numnames, + _NUMELEMENTS(numoffsets), 0)) == -1) ? -2 : num_array[offset]); +} + +/* + * Return the value of the string capability tistr. + * Return (char *) -1 if the name is not a string capability. + */ + +char * +tigetstr(char *tistr) +{ + int offset; + char **str_array = (char **) cur_strs; + + return (((offset = _tcsearch(tistr, stroffsets, strnames, + _NUMELEMENTS(stroffsets), 0)) == -1) ? (char *) -1 : + str_array[offset]); +} +. +0r copyright.h +/copyright\.h/d +w tiget.c +q diff --git a/usr/src/lib/libcurses/screen/tinputfd.c b/usr/src/lib/libcurses/screen/tinputfd.c new file mode 100644 index 0000000000..a9f541c07b --- /dev/null +++ b/usr/src/lib/libcurses/screen/tinputfd.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Set the input channel for the current terminal. */ + +void +tinputfd(int fd) +{ + cur_term->_inputfd = fd; + cur_term->_delay = -1; + + /* so that tgetch will reset it to be _inputd */ + /* cur_term->_check_fd = -2; */ +} diff --git a/usr/src/lib/libcurses/screen/touchwin.c b/usr/src/lib/libcurses/screen/touchwin.c new file mode 100644 index 0000000000..f96583d4cd --- /dev/null +++ b/usr/src/lib/libcurses/screen/touchwin.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +touchwin(WINDOW *win) +{ + return (wtouchln(win, 0, win->_maxy, TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/tparm.c b/usr/src/lib/libcurses/screen/tparm.c new file mode 100644 index 0000000000..70e7d6077a --- /dev/null +++ b/usr/src/lib/libcurses/screen/tparm.c @@ -0,0 +1,755 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1996-1997 by Sun Microsystems, Inc. + * All rights reserved. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* Copyright (c) 1979 Regents of the University of California */ + +/*LINTLIBRARY*/ + +#include "curses_inc.h" +#include "curshdr.h" +#include "term.h" +#include <string.h> +#include <setjmp.h> +#include <stdlib.h> +#include <stdio.h> + +#ifndef _CHCTRL +#define _CHCTRL(c) ((c) & 037) +#endif /* _CHCTRL */ + +char *_branchto(char *, char); + +/* + * Routine to perform parameter substitution. + * instring is a string containing printf type escapes. + * The whole thing uses a stack, much like an HP 35. + * The following escapes are defined for substituting row/column: + * + * %[:[-+ #0]][0-9][.][0-9][dsoxX] + * print pop() as in printf(3), as defined in the local + * sprintf(3), except that a leading + or - must be preceded + * with a colon (:) to distinguish from the plus/minus operators. + * + * %c print pop() like %c in printf(3) + * %l pop() a string address and push its length. + * %P[a-z] set dynamic variable a-z + * %g[a-z] get dynamic variable a-z + * %P[A-Z] set static variable A-Z + * %g[A-Z] get static variable A-Z + * + * %p[1-0] push ith parm + * %'c' char constant c + * %{nn} integer constant nn + * + * %+ %- %* %/ %m arithmetic (%m is mod): push(pop() op pop()) + * %& %| %^ bit operations: push(pop() op pop()) + * %= %> %< logical operations: push(pop() op pop()) + * %A %O logical AND, OR push(pop() op pop()) + * %! %~ unary operations push(op pop()) + * %% output % + * %? expr %t thenpart %e elsepart %; + * if-then-else, %e elsepart is optional. + * else-if's are possible ala Algol 68: + * %? c1 %t %e c2 %t %e c3 %t %e c4 %t %e %; + * % followed by anything else + * is not defined, it may output the character, + * and it may not. This is done so that further + * enhancements to the format capabilities may + * be made without worrying about being upwardly + * compatible from buggy code. + * + * all other characters are ``self-inserting''. %% gets % output. + * + * The stack structure used here is based on an idea by Joseph Yao. + */ + +#define MAX 10 +#define MEM_ALLOC_FAIL 1 +#define STACK_UNDERFLOW 2 + +typedef struct { + long top; + int stacksize; + long *stack; + +}STACK; + +static jmp_buf env; + +static long +tops(STACK *st) +{ + + if (st->top < 0) { + longjmp(env, STACK_UNDERFLOW); + } + return (st->stack[st->top]); +} + +static void +push(STACK *st, long i) +{ + if (st->top >= (st->stacksize - 1)) { + st->stacksize += MAX; + if ((st->stack = (void *)realloc(st->stack, + (st->stacksize * sizeof (long)))) == NULL) { + longjmp(env, MEM_ALLOC_FAIL); + } + } + st->stack[++st->top] = (i); +} + +static long +pop(STACK *st) +{ + if (st->top < 0) { + longjmp(env, STACK_UNDERFLOW); + } + return (st->stack[st->top--]); +} + +/* The following routine was added to make lint shut up about converting from + * a long to a char *. It is identical to the pop routine, except for the + * cast on the return statement. + */ +static char * +pop_char_p(STACK *st) +{ + if (st->top < 0) { + longjmp(env, STACK_UNDERFLOW); + } + return ((char *)(st->stack[st->top--])); +} + +static void +init_stack(STACK *st) +{ + st->top = -1; + st->stacksize = MAX; + if ((st->stack = (void *)malloc(MAX * sizeof (long))) == NULL) { + longjmp(env, MEM_ALLOC_FAIL); + } +} + +static void +free_stack(STACK *st) +{ + free(st->stack); +} + + +char * +tparm_p0(char *instring) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +char * +tparm_p1(char *instring, long l1) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + p[0] = l1; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +char * +tparm_p2(char *instring, long l1, long l2) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + p[0] = l1; + p[1] = l2; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +char * +tparm_p3(char *instring, long l1, long l2, long l3) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + p[0] = l1; + p[1] = l2; + p[2] = l3; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +char * +tparm_p4(char *instring, long l1, long l2, long l3, long l4) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + p[0] = l1; + p[1] = l2; + p[2] = l3; + p[3] = l4; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +char * +tparm_p7(char *instring, long l1, long l2, long l3, long l4, long l5, long l6, + long l7) +{ + long p[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + p[0] = l1; + p[1] = l2; + p[2] = l3; + p[3] = l4; + p[4] = l5; + p[5] = l6; + p[6] = l7; + + return (tparm(instring, p[0], p[1], p[2], p[3], p[4], p[5], p[6], + p[7], p[8])); +} + +/* VARARGS */ +char * +tparm(char *instring, long fp1, long fp2, long p3, long p4, + long p5, long p6, long p7, long p8, long p9) +{ + static char result[512]; + static char added[100]; + long vars[26]; + STACK stk; + char *cp = instring; + char *outp = result; + char c; + long op; + long op2; + int sign; + int onrow = 0; + long p1 = fp1, p2 = fp2; /* copy in case < 2 actual parms */ + char *xp; + char formatbuffer[100]; + char *format; + int looping; + short *regs = cur_term->_regs; + int val; + + + if ((val = setjmp(env)) != 0) { +#ifdef DEBUG + switch (val) { + case MEM_ALLOC_FAIL: + fprintf(outf, "TPARM: Memory allocation" + " failure."); + break; + case STACK_UNDERFLOW: + fprintf(outf, "TPARM: Stack underflow."); + break; + } +#endif /* DEBUG */ + + if (val == STACK_UNDERFLOW) + free_stack(&stk); + return (NULL); + } + + init_stack(&stk); + push(&stk, 0); + + if (instring == 0) { +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: null arg\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + + added[0] = 0; + + while ((c = *cp++) != 0) { + if (c != '%') { + *outp++ = c; + continue; + } + op = tops(&stk); + switch (c = *cp++) { + /* PRINTING CASES */ + case ':': + case ' ': + case '#': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + case 'd': + case 's': + case 'o': + case 'x': + case 'X': + format = formatbuffer; + *format++ = '%'; + + /* leading ':' to allow +/- in format */ + if (c == ':') + c = *cp++; + + /* take care of flags, width and precision */ + looping = 1; + while (c && looping) + switch (c) { + case '-': + case '+': + case ' ': + case '#': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + *format++ = c; + c = *cp++; + break; + default: + looping = 0; + } + + /* add in the conversion type */ + switch (c) { + case 'd': + case 's': + case 'o': + case 'x': + case 'X': + *format++ = c; + break; + default: +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: invalid " + "conversion type\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + *format = '\0'; + + /* + * Pass off the dirty work to sprintf. + * It's debatable whether we should just pull in + * the appropriate code here. I decided not to for + * now. + */ + if (c == 's') + (void) sprintf(outp, formatbuffer, + (char *) op); + else + (void) sprintf(outp, formatbuffer, op); + /* + * Advance outp past what sprintf just did. + * sprintf returns an indication of its length on some + * systems, others the first char, and there's + * no easy way to tell which. The Sys V on + * BSD emulations are particularly confusing. + */ + while (*outp) + outp++; + (void) pop(&stk); + + continue; + + case 'c': + /* + * This code is worth scratching your head at for a + * while. The idea is that various weird things can + * happen to nulls, EOT's, tabs, and newlines by the + * tty driver, arpanet, and so on, so we don't send + * them if we can help it. So we instead alter the + * place being addessed and then move the cursor + * locally using UP or RIGHT. + * + * This is a kludge, clearly. It loses if the + * parameterized string isn't addressing the cursor + * (but hopefully that is all that %c terminals do + * with parms). Also, since tab and newline happen + * to be next to each other in ASCII, if tab were + * included a loop would be needed. Finally, note + * that lots of other processing is done here, so + * this hack won't always work (e.g. the Ann Arbor + * 4080, which uses %B and then %c.) + */ + switch (op) { + /* + * Null. Problem is that our + * output is, by convention, null terminated. + */ + case 0: + op = 0200; /* Parity should */ + /* be ignored. */ + break; + /* + * Control D. Problem is that certain very + * ancient hardware hangs up on this, so the + * current(!) UNIX tty driver doesn't xmit + * control D's. + */ + case _CHCTRL('d'): + /* + * Newline. Problem is that UNIX will expand + * this to CRLF. + */ + case '\n': + xp = (onrow ? cursor_down : + cursor_right); + if (onrow && xp && op < lines-1 && + cursor_up) { + op += 2; + xp = cursor_up; + } + if (xp && instring == + cursor_address) { + (void) strcat(added, xp); + op--; + } + break; + /* + * Tab used to be in this group too, + * because UNIX might expand it to blanks. + * We now require that this tab mode be turned + * off by any program using this routine, + * or using termcap in general, since some + * terminals use tab for other stuff, like + * nondestructive space. (Filters like ul + * or vcrt will lose, since they can't stty.) + * Tab was taken out to get the Ann Arbor + * 4080 to work. + */ + } + + /* LINTED */ + *outp++ = (char)op; + (void) pop(&stk); + break; + + case 'l': + xp = pop_char_p(&stk); + push(&stk, strlen(xp)); + break; + + case '%': + *outp++ = c; + break; + + /* + * %i: shorthand for increment first two parms. + * Useful for terminals that start numbering from + * one instead of zero(like ANSI terminals). + */ + case 'i': + p1++; + p2++; + break; + + /* %pi: push the ith parameter */ + case 'p': + switch (c = *cp++) { + case '1': + push(&stk, p1); + break; + case '2': + push(&stk, p2); + break; + case '3': + push(&stk, p3); + break; + case '4': + push(&stk, p4); + break; + case '5': + push(&stk, p5); + break; + case '6': + push(&stk, p6); + break; + case '7': + push(&stk, p7); + break; + case '8': + push(&stk, p8); + break; + case '9': + push(&stk, p9); + break; + default: +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM:" + " bad parm" + " number\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + onrow = (c == '1'); + break; + + /* %Pi: pop from stack into variable i (a-z) */ + case 'P': + if (*cp >= 'a' && *cp <= 'z') { + vars[*cp++ - 'a'] = pop(&stk); + } else { + if (*cp >= 'A' && *cp <= 'Z') { + regs[*cp++ - 'A'] = + /* LINTED */ + (short) pop(&stk); + } +#ifdef DEBUG + else if (outf) { + fprintf(outf, "TPARM: bad" + " register name\n"); + } +#endif /* DEBUG */ + } + break; + + /* %gi: push variable i (a-z) */ + case 'g': + if (*cp >= 'a' && *cp <= 'z') { + push(&stk, vars[*cp++ - 'a']); + } else { + if (*cp >= 'A' && *cp <= 'Z') { + push(&stk, regs[*cp++ - 'A']); + } +#ifdef DEBUG + else if (outf) { + fprintf(outf, "TPARM: bad" + " register name\n"); + + } +#endif /* DEBUG */ + } + break; + + /* %'c' : character constant */ + case '\'': + push(&stk, *cp++); + if (*cp++ != '\'') { +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: missing" + " closing quote\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + break; + + /* %{nn} : integer constant. */ + case '{': + op = 0; + sign = 1; + if (*cp == '-') { + sign = -1; + cp++; + } else + if (*cp == '+') + cp++; + while ((c = *cp++) >= '0' && c <= '9') { + op = 10 * op + c - '0'; + } + if (c != '}') { +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: missing " + "closing brace\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + push(&stk, (sign * op)); + break; + + /* binary operators */ + case '+': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op + op2)); + break; + case '-': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op - op2)); + break; + case '*': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op * op2)); + break; + case '/': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op / op2)); + break; + case 'm': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op % op2)); + break; /* %m: mod */ + case '&': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op & op2)); + break; + case '|': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op | op2)); + break; + case '^': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op ^ op2)); + break; + case '=': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op == op2)); + break; + case '>': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op > op2)); + break; + case '<': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op < op2)); + break; + case 'A': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op && op2)); + break; /* AND */ + case 'O': + op2 = pop(&stk); + op = pop(&stk); + push(&stk, (op || op2)); + break; /* OR */ + + /* Unary operators. */ + case '!': + push(&stk, !pop(&stk)); + break; + case '~': + push(&stk, ~pop(&stk)); + break; + + /* Sorry, no unary minus, because minus is binary. */ + + /* + * If-then-else. Implemented by a low level hack of + * skipping forward until the match is found, counting + * nested if-then-elses. + */ + case '?': /* IF - just a marker */ + break; + + case 't': /* THEN - branch if false */ + if (!pop(&stk)) + cp = _branchto(cp, 'e'); + break; + + case 'e': /* ELSE - branch to ENDIF */ + cp = _branchto(cp, ';'); + break; + + case ';': /* ENDIF - just a marker */ + break; + + default: +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: bad % " + "sequence\n"); +#endif /* DEBUG */ + free_stack(&stk); + return (NULL); + } + } + (void) strcpy(outp, added); + free_stack(&stk); + return (result); +} + +char * +_branchto(register char *cp, char to) +{ + register int level = 0; + register char c; + + while (c = *cp++) { + if (c == '%') { + if ((c = *cp++) == to || c == ';') { + if (level == 0) { + return (cp); + } + } + if (c == '?') + level++; + if (c == ';') + level--; + } + } +#ifdef DEBUG + if (outf) + fprintf(outf, "TPARM: no matching ENDIF"); +#endif /* DEBUG */ + return (NULL); +} diff --git a/usr/src/lib/libcurses/screen/tputs.c b/usr/src/lib/libcurses/screen/tputs.c new file mode 100644 index 0000000000..f16ad967a5 --- /dev/null +++ b/usr/src/lib/libcurses/screen/tputs.c @@ -0,0 +1,158 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* Copyright (c) 1979 Regents of the University of California */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <ctype.h> +#include "curses_inc.h" + +/* + * Put the character string cp out, with padding. + * The number of affected lines is affcnt, and the routine + * used to output one character is outc. + */ +static char *ocp; + +static char * +_tpad(char *, int, int (*)(char)); + +static char * +_tpad(char *cp, int affcnt, int (*outc)(char x)) +{ + int delay = 0; + char *icp = cp; + int ignorexon = 0, doaffcnt = 0; + +#ifdef _VR2_COMPAT_CODE + /* + * Why is this here? + * Because mandatory padding must be used for flash_screen + * and bell. We cannot force users to code mandatory padding + * in their terminfo entries, as that would break compatibility. + * We therefore, do it here. + * + * When compatibility is to be broken, his will go away + * and users will be informed that they MUST use mandatory + * padding for flash and bell. + */ + if (ocp == bell || ocp == flash_screen) + ignorexon = TRUE; +#endif /* _VR2_COMPAT_CODE */ + + /* Eat initial $< */ + cp += 2; + + /* Convert the number representing the delay. */ + if (isdigit(*cp)) { + do + delay = delay * 10 + *cp++ - '0'; + while (isdigit(*cp)); + } + delay *= 10; + if (*cp == '.') { + cp++; + if (isdigit(*cp)) + delay += *cp - '0'; + /* Only one digit to the right of the decimal point. */ + while (isdigit(*cp)) + cp++; + } + + /* + * If the delay is followed by a `*', then + * multiply by the affected lines count. + * If the delay is followed by a '/', then + * the delay is done irregardless of xon/xoff. + */ + /*CONSTCOND*/ + while (TRUE) { + if (*cp == '/') + ignorexon = TRUE; + else + if (*cp == '*') + doaffcnt = TRUE; + else + break; + cp++; + } + if (doaffcnt) + delay *= affcnt; + if (*cp == '>') + cp++; /* Eat trailing '>' */ + else { + /* + * We got a "$<" with no ">". This is usually caused by + * a cursor addressing sequence that happened to generate + * $ < . To avoid an infinite loop, we output the $ here + * and pass back the rest. + */ + (*outc)(*icp++); + return (icp); + } + + /* + * If no delay needed, or output speed is + * not comprehensible, then don't try to delay. + */ + if (delay == 0) + return (cp); + /* + * Let handshaking take care of it - no extra cpu load from pads. + * Also, this will be more optimal since the pad info is usually + * worst case. We only use padding info for such terminals to + * estimate the cost of a capability in choosing the cheapest one. + * Some capabilities, such as flash_screen, really want the + * padding irregardless. + */ + if (xon_xoff && !ignorexon) + return (cp); + (void) _delay(delay, outc); + return (cp); +} + +int +tputs(char *cp, int affcnt, int (*outc)(char)) +{ + if (cp != 0) { + ocp = cp; + + /* The guts of the string. */ + while (*cp) + if (*cp == '$' && cp[1] == '<') + cp = _tpad(cp, affcnt, outc); + else + (*outc)(*cp++); + } + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/trace.c b/usr/src/lib/libcurses/screen/trace.c new file mode 100644 index 0000000000..81ddbdb3cc --- /dev/null +++ b/usr/src/lib/libcurses/screen/trace.c @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdio.h> +#include "curses_inc.h" + +int +traceon(void) +{ +#ifdef DEBUG + if (outf == NULL) { + outf = fopen("trace", "a"); + if (outf == NULL) { + perror("trace"); + exit(-1); + } + fprintf(outf, "trace turned on\n"); + } +#endif /* DEBUG */ + return (OK); +} + +int +traceoff(void) +{ +#ifdef DEBUG + if (outf != NULL) { + fprintf(outf, "trace turned off\n"); + fclose(outf); + outf = NULL; + } +#endif /* DEBUG */ + return (OK); +} + +#ifdef DEBUG +#include <ctype.h> + +char * +_asciify(char *str) +{ + static char string[1024]; + char *p1 = string; + char *p2; + char c; + + while (c = *str++) { + p2 = unctrl(c); + while (*p1 = *p2++) + p1++; + } + return (string); +} +#endif /* DEBUG */ diff --git a/usr/src/lib/libcurses/screen/tstp.c b/usr/src/lib/libcurses/screen/tstp.c new file mode 100644 index 0000000000..a4dbf865cd --- /dev/null +++ b/usr/src/lib/libcurses/screen/tstp.c @@ -0,0 +1,92 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include <signal.h> +#include "curses_inc.h" + + +/* handle stop and start signals */ + +#ifdef SIGTSTP +void +_tstp(int dummy) +{ +#ifdef DEBUG + if (outf) + (void) fflush(outf); +#endif /* DEBUG */ + curscr->_attrs = A_ATTRIBUTES; + (void) endwin(); + (void) fflush(stdout); + (void) kill(0, SIGTSTP); + (void) signal(SIGTSTP, _tstp); + (void) fixterm(); + /* changed ehr3 SP->doclear = 1; */ + curscr->_clear = TRUE; + (void) wrefresh(curscr); +} +#endif /* SIGTSTP */ + +void +_ccleanup(int signo) +{ + (void) signal(signo, SIG_IGN); + + /* + * Fake curses into thinking that all attributes are on so that + * endwin will turn them off since the < BREAK > key may have + * interrupted the sequence to turn them off. + */ + + curscr->_attrs = A_ATTRIBUTES; + (void) endwin(); +#ifdef DEBUG + fprintf(stderr, "signal %d caught. quitting.\n", signo); +#endif /* DEBUG */ + if (signo == SIGQUIT) + (void) abort(); + else + exit(1); +} diff --git a/usr/src/lib/libcurses/screen/ttimeout.c b/usr/src/lib/libcurses/screen/ttimeout.c new file mode 100644 index 0000000000..d56bd487d6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/ttimeout.c @@ -0,0 +1,127 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <fcntl.h> + +/* + * Set the current time-out period for getting input. + * + * delay: < 0 for infinite delay (blocking read) + * = 0 for no delay read + * > 0 to specify a period in millisecs to wait + * for input, then return '\0' if none comes + */ + +static void _setblock(int), _settimeout(int); + +int +ttimeout(int delay) +{ + if (cur_term->_inputfd < 0) + return (ERR); + + if (delay < 0) + delay = -1; + + if (cur_term->_delay == delay) + goto good; + +#ifdef SYSV + if (delay > 0) { + if (cur_term->_delay < 0) + _setblock(-delay); + _settimeout(delay); + } else + if ((delay + cur_term->_delay) == -1) + _setblock(delay); + else { + if (delay < 0) + _setblock(delay); + _settimeout(delay); + } +#else /* SYSV */ + cbreak(); +#endif /* SYSV */ + + cur_term->_delay = delay; +good: + return (OK); +} + +#ifdef SYSV +/* set the terminal to nodelay (==0) or block(<0) */ +static void +_setblock(int block) +{ + int flags = fcntl(cur_term->_inputfd, F_GETFL, 0); + + if (block < 0) + flags &= ~O_NDELAY; + else + flags |= O_NDELAY; + + (void) fcntl(cur_term->_inputfd, F_SETFL, flags); +} + +/* + * set the terminal to timeout in t milliseconds, + * rounded up to the nearest 10th of a second. + */ +static void +_settimeout(int num) +{ + PROGTTYS.c_lflag &= ~ICANON; + if (num > 0) { + PROGTTYS.c_cc[VMIN] = 0; + PROGTTYS.c_cc[VTIME] = (num > 25500) ? 255 : (num + 99) / 100; + cur_term->_fl_rawmode = 3; + } else { + PROGTTYS.c_cc[VMIN] = 1; + PROGTTYS.c_cc[VTIME] = 0; + cur_term->_fl_rawmode = 1; + } + (void) reset_prog_mode(); +} +#endif /* SYSV */ diff --git a/usr/src/lib/libcurses/screen/typeahead.c b/usr/src/lib/libcurses/screen/typeahead.c new file mode 100644 index 0000000000..0d343b7539 --- /dev/null +++ b/usr/src/lib/libcurses/screen/typeahead.c @@ -0,0 +1,122 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <unistd.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Set the file descriptor for typeahead checks to fd. fd can be -1 + * to disable the checking. + */ + +int +typeahead(int fd) +{ +#ifdef SYSV + /* + * Doing fcntls before and after each typeahead check + * read is a serious problem on the 3b2. Profiling + * results indicated that a simple program(edit.c from + * "The New Curses and Terminfo Package") was spending + * 9.2% of the time in fcntl(). + */ + +#include <fcntl.h> + int savefd = cur_term->_check_fd; + + /* Close the previous duped file descriptor. */ + if (savefd >= 0) + (void) close(savefd); + + /* + * Duplicate the file descriptor so we have one to play with. + * We cannot use dup(2), unfortunately, so we do typeahead checking + * on terminals only. Besides, if typeahead is done when input is + * coming from a file, nothing would EVER get drawn on the screen! + */ + + /* MODIFIED: DRS 3/26/89 */ + + /* + * a couple of notes by DRS: first, a new file descriptor is + * required, since O_NDELAY must be set. calling fcntl() or dup() + * would provide a new file descriptor, but NOT a new file pointer + * for the open file (by file pointer, i mean a unix kernal file + * ptr). if a new underlying unix file ptr. is not allocated, + * setting O_NDELAY will cause all normal terminal i/o to return + * prematurely without blocking. + * + * second, the call to ttyname is NOT necessary, /dev/tty can be + * used instead. calling ttyname is quite expensive -- especially + * for large /dev directories. + * + * note also that the code for the '#else' clause will not work + * since the new file descriptor MUST have O_NDELAY set for the + * rest of libcurses code to function properly. + * + * 4/24/89: modified to set the close on exec() flag of the newly + * opened file descriptor + */ + + /* + * cur_term->_check_fd = (tty = ttyname(fd)) ? + * open(tty, O_RDONLY | O_NDELAY) : -1; + */ + if (isatty(fd)) { + if ((cur_term->_check_fd = open("/dev/tty", O_RDONLY | + O_NDELAY)) >= 0) + (void) fcntl(cur_term->_check_fd, F_SETFD, 1); + } else + cur_term->_check_fd = -1; + +#else /* SYSV */ + int savefd = cur_term->_check_fd; + /* Only do typeahead checking if the input is a tty. */ + if (isatty(fd)) + cur_term->_check_fd = fd; + else + cur_term->_check_fd = -1; +#endif /* SYSV */ + return (savefd); +} diff --git a/usr/src/lib/libcurses/screen/unctrl.c b/usr/src/lib/libcurses/screen/unctrl.c new file mode 100644 index 0000000000..95a079fcc3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/unctrl.c @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * define unctrl codes for each character + * + */ + +/* LINTLIBRARY */ +char *_unctrl[] = { /* unctrl codes for ttys */ + "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K", + "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", + "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_", + " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", + ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", + "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", + "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", + "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", + "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "^?" +#ifdef DEBUG + , + "M-^@", "M-^A", "M-^B", "M-^C", "M-^D", "M-^E", "M-^F", "M-^G", + "M-^H", "M-^I", "M-^J", "M-^K", "M-^L", "M-^M", "M-^N", "M-^O", + "M-^P", "M-^Q", "M-^R", "M-^S", "M-^T", "M-^U", "M-^V", "M-^W", + "M-^X", "M-^Y", "M-^Z", "M-^[", "M-^\\", "M-^]", "M-^~", "M-^_", + "M- ", "M-!", "M-\"", "M-#", "M-$", "M-%", "M-&", "M-'", + "M-(", "M-)", "M-*", "M-+", "M-,", "M--", "M-.", "M-/", + "M-0", "M-1", "M-2", "M-3", "M-4", "M-5", "M-6", "M-7", + "M-8", "M-9", "M-:", "M-;", "M-<", "M-=", "M->", "M-?", + "M-@", "M-A", "M-B", "M-C", "M-D", "M-E", "M-F", "M-G", + "M-H", "M-I", "M-J", "M-K", "M-L", "M-M", "M-N", "M-O", + "M-P", "M-Q", "M-R", "M-S", "M-T", "M-U", "M-V", "M-W", + "M-X", "M-Y", "M-Z", "M-[", "M-\\", "M-]", "M-^", "M-_", + "M-`", "M-a", "M-b", "M-c", "M-d", "M-e", "M-f", "M-g", + "M-h", "M-i", "M-j", "M-k", "M-l", "M-m", "M-n", "M-o", + "M-p", "M-q", "M-r", "M-s", "M-t", "M-u", "M-v", "M-w", + "M-x", "M-y", "M-z", "M-{", "M-|", "M-}", "M-~", "M-^?" +#endif /* DEBUG */ +}; diff --git a/usr/src/lib/libcurses/screen/unctrl.h b/usr/src/lib/libcurses/screen/unctrl.h new file mode 100644 index 0000000000..53467d0c62 --- /dev/null +++ b/usr/src/lib/libcurses/screen/unctrl.h @@ -0,0 +1,61 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#ifndef _UNCTRL_H +#define _UNCTRL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *_unctrl[]; + +#if !defined(NOMACROS) && !defined(__lint) + +#define unctrl(ch) (_unctrl[(unsigned)ch]) + +#endif /* NOMACROS && __lint */ + +#ifdef __cplusplus +} +#endif + +#endif /* _UNCTRL_H */ diff --git a/usr/src/lib/libcurses/screen/ungetch.c b/usr/src/lib/libcurses/screen/ungetch.c new file mode 100644 index 0000000000..3f0b5626fa --- /dev/null +++ b/usr/src/lib/libcurses/screen/ungetch.c @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Place a char onto the beginning of the input queue. */ + +int +ungetch(int ch) +{ + int i = cur_term->_chars_on_queue, j = i - 1; + chtype *inputQ = cur_term->_input_queue; + + /* Place the character at the beg of the Q */ + /* + * Here is commented out because 'ch' should deal with a single byte + * character only. So ISCBIT(ch) is 0 every time. + * + * register chtype r; + * + * if (ISCBIT(ch)) { + * r = RBYTE(ch); + * ch = LBYTE(ch); + * -* do the right half first to maintain the byte order *- + * if (r != MBIT && ungetch(r) == ERR) + * return (ERR); + * } + */ + + while (i > 0) + inputQ[i--] = inputQ[j--]; + cur_term->_ungotten++; + inputQ[0] = -ch; + cur_term->_chars_on_queue++; + return (0); +} diff --git a/usr/src/lib/libcurses/screen/ungetwch.c b/usr/src/lib/libcurses/screen/ungetwch.c new file mode 100644 index 0000000000..1079ab0cc8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/ungetwch.c @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Push a process code back into the input stream + */ + +int +ungetwch(wchar_t code) +{ + int i, n; + char buf[CSMAX]; + + n = _curs_wctomb(buf, code & TRIM); + for (i = n - 1; i >= 0; --i) + if (ungetch((unsigned char)buf[i]) == ERR) { + /* remove inserted characters */ + for (i = i + 1; i < n; ++i) + (void) tgetch(0); + return (ERR); + } + + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/untouchwin.c b/usr/src/lib/libcurses/screen/untouchwin.c new file mode 100644 index 0000000000..10d405946f --- /dev/null +++ b/usr/src/lib/libcurses/screen/untouchwin.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +untouchwin(WINDOW *win) +{ + return (wtouchln(win, 0, win->_maxy, FALSE)); +} diff --git a/usr/src/lib/libcurses/screen/use_env.c b/usr/src/lib/libcurses/screen/use_env.c new file mode 100644 index 0000000000..9a29bde19d --- /dev/null +++ b/usr/src/lib/libcurses/screen/use_env.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +extern char _use_env; /* in curses.c */ + +void +use_env(int bf) +{ + /* LINTED */ + _use_env = (char)bf; +} diff --git a/usr/src/lib/libcurses/screen/vidputs.c b/usr/src/lib/libcurses/screen/vidputs.c new file mode 100644 index 0000000000..a7513bed31 --- /dev/null +++ b/usr/src/lib/libcurses/screen/vidputs.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +vidputs(chtype a, int (*b)(char)) +{ + vidupdate(a, cur_term->sgr_mode, b); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/vidupdate.c b/usr/src/lib/libcurses/screen/vidupdate.c new file mode 100644 index 0000000000..48177f581d --- /dev/null +++ b/usr/src/lib/libcurses/screen/vidupdate.c @@ -0,0 +1,391 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +#ifdef PC6300PLUS +#include <fcntl.h> +#include <sys/console.h> +#endif + +#define NUM_OF_SPECIFIC_TURN_OFFS 3 +extern chtype bit_attributes[]; + +int Oldcolors[] = { COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, + COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE }; + +void +vidupdate(chtype newmode, chtype oldmode, int (*outc)(char)) +{ + bool color_terminal = (cur_term->_pairs_tbl) ? TRUE : FALSE; + chtype oldvideo = (oldmode & A_ATTRIBUTES) & ~A_COLOR; + chtype newvideo = (newmode & A_ATTRIBUTES) & ~A_COLOR; + int _change_video(chtype, chtype, int (*)(char)); + void _change_color(short, int (*)(char)); + + /* if colors are used, extract the color related information from */ + /* the old and new modes and then erase color-pairs fields in */ + /* both arguments. */ + + if (color_terminal) { + /* LINTED */ + short oldcolor = (short) PAIR_NUMBER(oldmode & A_COLOR); + /* LINTED */ + short newcolor = (short) PAIR_NUMBER(newmode & A_COLOR); + chtype turn_off = A_COLOR; + + /* erase information about video attributes that could not */ + /* have been used with colors */ + + if (oldcolor == 0) + oldvideo &= ~turn_off; + + if (no_color_video != -1) + turn_off |= (((chtype) no_color_video) << 16); + + if (oldcolor != 0) + oldvideo &= ~turn_off; + + + /* if the new mode contains color information, then first */ + /* deal with video attributes, and then with colors. This */ + /* way color information will overwrite video information. */ + + if (newcolor != 0) { + /* erase information about video attributes that */ + /* should not be used with colors */ + + newvideo &= ~turn_off; + + /* if the new and the old video modes became */ + /* the same don't bother with them */ + + if (newvideo != oldvideo) { + if ((_change_video(newvideo, oldvideo, + outc)) == -1) { + _Color_pair *cur_pair = + &cur_term->_cur_pair; + oldcolor = -1; + cur_pair->background = + cur_pair->foreground = -1; + } + } + if (newcolor != oldcolor) + _change_color(newcolor, outc); + } + + /* new mode doesn't contain any color information. Deal */ + /* with colors first (possibly turning of the colors that */ + /* were contained in the oldmode, and then deal with video. */ + /* This way video attributes will overwrite colors. */ + + else { + if (newcolor != oldcolor) + _change_color(newcolor, outc); + if (newvideo != oldvideo) + (void) _change_video(newvideo, oldvideo, outc); + } + } else + (void) _change_video(newvideo, oldvideo, outc); +} + + +int +_change_video(chtype newmode, chtype oldmode, int (*outc)(char)) +{ + int rc = 0; + + /* If you have set_attributes let the terminfo writer */ + /* worry about it. */ + + if (!set_attributes) { + /* + * The trick is that we want to pre-process the new and oldmode + * so that we now know what they will really translate to on + * the physical screen. + * In the case where some attributes are being faked + * we get rid of the attributes being asked for and just have + * STANDOUT mode set. Therefore, if STANDOUT and UNDERLINE were + * on the screen but UNDERLINE was being faked to STANDOUT; and + * the new mode is just UNDERLINE, we will get rid of any faked + * modes and be left with and oldmode of STANDOUT and a new mode + * of STANDOUT, in which case the check for newmode and oldmode + * being equal will be true. + * + * + * This test is similar to the concept explained above. + * counter is the maximum attributes allowed on a terminal. + * For instance, on an hp/tvi950 without set_attributes + * the last video sequence sent will be the one the terminal + * will be in (on that spot). Therefore, in setupterm.c + * if ceol_standout_glitch or magic_cookie_glitch is set + * max_attributes is set to 1. This is because on those terminals + * only one attribute can be on at once. So, we pre-process the + * oldmode and the newmode and only leave the bits that are + * significant. In other words, if on an hp you ask for STANDOUT + * and UNDERLINE it will become only STANDOUT since that is the + * first bit that is looked at. If then the user goes from + * STANDOUT and UNDERLINE to STANDOUT and REVERSE the oldmode will + * become STANDOUT and the newmode will become STANDOUT. + * + * This also helps the code below in that on a hp or tvi950 only + * one bit will ever be set so that no code has to be added to + * cut out early in case two attributes were asked for. + */ + + chtype check_faked, modes[2]; + int counter = max_attributes, i, j, tempmode; + int k = (cur_term->sgr_mode == oldmode) ? 1 : 2; + + modes[0] = newmode; + modes[1] = oldmode; + + while (k-- > 0) { + if ((check_faked = (modes[k] & + cur_term->sgr_faked)) != A_NORMAL) { + modes[k] &= ~check_faked; + modes[k] |= A_STANDOUT; + } + + if ((j = counter) >= 0) { + tempmode = A_NORMAL; + if (j > 0) { + for (i = 0; i < NUM_ATTRIBUTES; i++) { + if (modes[k] & + bit_attributes[i]) { + tempmode |= + bit_attributes[i]; + if (--j == 0) + break; + } + } + } + modes[k] = tempmode; + } + } + newmode = modes[0]; + oldmode = modes[1]; + } + + if (newmode == oldmode) + return (rc); + +#ifdef DEBUG + if (outf) + fprintf(outf, "vidupdate oldmode=%o, newmode=%o\n", + oldmode, newmode); +#endif + + if (set_attributes) { + (void) tputs(tparm(set_attributes, + newmode & A_STANDOUT, + newmode & A_UNDERLINE, + newmode & A_REVERSE, + newmode & A_BLINK, + newmode & A_DIM, + newmode & A_BOLD, + newmode & A_INVIS, + newmode & A_PROTECT, + newmode & A_ALTCHARSET), + 1, outc); + rc = -1; + } else { + chtype turn_on, turn_off; + int i; + + /* + * If we are going to turn something on anyway and we are + * on a glitchy terminal, don't bother turning it off + * since by turning something on you turn everything else off. + */ + + if ((ceol_standout_glitch || magic_cookie_glitch >= 0) && + ((turn_on = ((oldmode ^ newmode) & newmode)) != + A_NORMAL)) { + goto turn_on_code; + } + + if ((turn_off = (oldmode & newmode) ^ oldmode) != A_NORMAL) { + /* + * Check for things to turn off. + * First see if we are going to turn off something + * that doesn't have a specific turn off capability. + * + * Then check to see if, even though there may be a specific + * turn off sequence, this terminal doesn't have one or + * the turn off sequence also turns off something else. + */ + if ((turn_off & ~(A_ALTCHARSET | A_STANDOUT | A_UNDERLINE)) || + (turn_off != (turn_off & cur_term->check_turn_off))) { + (void) tputs(tparm_p0(exit_attribute_mode), 1, outc); + rc = -1; + oldmode = A_NORMAL; + } else { + for (i = 0; i < NUM_OF_SPECIFIC_TURN_OFFS; i++) { + if (turn_off & bit_attributes[i]) { + (void) tputs(tparm_p0 + (cur_term->turn_off_seq[i]), + 1, outc); + oldmode &= ~bit_attributes[i]; + rc = -1; + } + } + } + } + + if ((turn_on = ((oldmode ^ newmode) & newmode)) != A_NORMAL) { +turn_on_code: + + /* Check for modes to turn on. */ + + for (i = 0; i < NUM_ATTRIBUTES; i++) + if (turn_on & bit_attributes[i]) { + (void) tputs(tparm_p0(cur_term->turn_on_seq[i]), + 1, outc); + rc = -1; + /* + * Keep turning off the bit(s) that we just + * sent to the screen. As soon as turn_on + * reaches A_NORMAL we don't have to turn + * anything else on and we can + * break out of the loop. + */ + if ((turn_on &= ~bit_attributes[i]) == + A_NORMAL) + break; + } + } + + if (magic_cookie_glitch > 0) + (void) tputs(cursor_left, 1, outc); + } + cur_term->sgr_mode = newmode; + return (rc); +} + + +void +_change_color(short newcolor, int (*outc)(char)) +{ +#ifndef PC6300PLUS + { + _Color_pair *ptp = cur_term->_pairs_tbl; + /* pairs table pointer */ + _Color_pair *cur_pair = &cur_term->_cur_pair; + + /* MORE: we may have to change some stuff, depending on whether */ + /* HP terminals will be changing the background, or not */ + + if (newcolor == 0) { + if (orig_pair) + (void) tputs(tparm_p0(orig_pair), 1, outc); + if (set_a_background || set_a_foreground || + set_background || set_foreground) { + cur_pair->background = -1; + cur_pair->foreground = -1; + } + return; + } + + /* if we are on HP type terminal, just send an escape sequence */ + /* to use desired color pair (we could have done some optimization: */ + /* check if both the foreground and background of newcolor match */ + /* the ones of cur_term->_cur_pair. but that will happen only when */ + /* two color pairs are defined exacly the same, and probably not */ + /* worth the effort). */ + + if (set_color_pair) + (void) tputs(tparm_p1(set_color_pair, newcolor), 1, outc); + + /* on Tek model we can do some optimization. */ + + else { + if (ptp[newcolor].background != cur_pair->background) { + if (set_a_background) + (void) tputs(tparm_p1(set_a_background, + ptp[newcolor].background), 1, outc); + else if (set_background) + (void) tputs(tparm_p1(set_background, + Oldcolors[ptp[newcolor].background]), + 1, outc); + cur_pair->background = ptp[newcolor].background; + } + if (ptp[newcolor].foreground != cur_pair->foreground) { + if (set_a_foreground) + (void) tputs(tparm_p1(set_a_foreground, + ptp[newcolor].foreground), 1, outc); + else if (set_foreground) + (void) tputs(tparm_p1(set_foreground, + Oldcolors[ptp[newcolor].foreground]), + 1, outc); + cur_pair->foreground = ptp[newcolor].foreground; + } + } + } +#else + { + /* the following code is for PC6300 PLUS: it uses BOLD terminfo */ + /* entry for turning on colors, and SGR0 for turning them off. */ + /* Every time a new color-pair is used, we are forced to do an */ + /* ioctl read, and the send 'enter_bold_mode' escape sequence. */ + /* This could be improved by using */ + /* DIM, UNDERLINE, and REVERSE in addition to BOLD */ + + struct console con; + _Color_pair *ptp = cur_term->_pairs_tbl; + /* pairs table pointer */ + back = ptp[newcolor].background; + fore = ptp[newcolor].foreground; + + (void) fflush(SP->term_file); + ioctl(cur_term->Filedes, CONIOGETDATA, &con); +#define BOLD 4 + con.l[con.page].colors[BOLD] = + ((back + back + (fore > 5)) * 8 + fore) & 0177; + ioctl(cur_term->Filedes, CONIOSETDATA, &con); + (void) tputs(enter_bold_mode, 1, outc); + } +#endif +} diff --git a/usr/src/lib/libcurses/screen/vwprintw.c b/usr/src/lib/libcurses/screen/vwprintw.c new file mode 100644 index 0000000000..c601ac5d4f --- /dev/null +++ b/usr/src/lib/libcurses/screen/vwprintw.c @@ -0,0 +1,87 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * printw and friends + * + */ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine actually executes the printf and adds it to the window + * + * This code now uses the vsprintf routine, which portably digs + * into stdio. We provide a vsprintf for older systems that don't + * have one. + */ + +/*VARARGS2*/ +int +vwprintw(WINDOW *win, char *fmt, va_list ap) +{ + int size = BUFSIZ; + char *buffer; + int n, rv; + + buffer = (char *) malloc(size); + if (buffer == NULL) + return (ERR); + /*CONSTCOND*/ + while (1) { + n = vsnprintf(buffer, size, fmt, ap); + if (n < size) + break; + size *= 2; + buffer = (char *) realloc(buffer, size); + if (buffer == NULL) + return (ERR); + } + va_end(ap); + rv = waddstr(win, buffer); + free(buffer); + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/vwscanw.c b/usr/src/lib/libcurses/screen/vwscanw.c new file mode 100644 index 0000000000..6bc53b289e --- /dev/null +++ b/usr/src/lib/libcurses/screen/vwscanw.c @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * scanw and friends + * + */ +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine actually executes the scanf from the window. + * + * This code calls _vsscanf, which is like sscanf except + * that it takes a va_list as an argument pointer instead + * of the argument list itself. We provide one until + * such a routine becomes available. + */ + +/*VARARGS2*/ +int +vwscanw(WINDOW *win, char *fmt, va_list ap) +{ + wchar_t code[256]; + char *buf; + int n; + + if (wgetwstr(win, code) == ERR) + n = ERR; + else { + buf = _strcode2byte(code, NULL, -1); + n = _vsscanf(buf, fmt, ap); + } + + va_end(ap); + return (n); +} diff --git a/usr/src/lib/libcurses/screen/waddch.c b/usr/src/lib/libcurses/screen/waddch.c new file mode 100644 index 0000000000..31c7627981 --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddch.c @@ -0,0 +1,207 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * This routine prints the character in the current position. + * Think of it as putc. + */ + +int +waddch(WINDOW *win, chtype c) +{ + short x = win->_curx; + short y = win->_cury; + chtype rawc = _CHAR(c); + chtype rawattrs = _ATTR(c); + int rv = OK; + bool savimmed = win->_immed; + bool savsync = win->_sync; + + win->_immed = win->_sync = FALSE; + +#ifdef DEBUG + if (outf) + if (c == rawc) + fprintf(outf, "'%c'", rawc); + else + fprintf(outf, "'%c' %o, raw %o", c, c, rawc); +#endif /* DEBUG */ + + win->_insmode = FALSE; + if (_scrmax > 1 && _mbvalid(win) == ERR) + goto next; + if (_mbtrue && ISMBIT(rawc)) { + rv = _mbaddch(win, rawattrs, RBYTE(rawc)); + win->_immed = savimmed; + win->_sync = savsync; + goto nextw; + } + + switch (rawc) { + case '\n': + (void) wclrtoeol(win); + goto new_line; + case '\r': + goto move_to_begin_line; + case '\b': + if (--x < 0) +move_to_begin_line: + x = 0; + win->_curx = x; + win->_flags |= _WINMOVED; + goto out_move_only; + default: + if (rawc < ' ' || rawc == _CTRL('?')) { + if (rawc == '\t') { + int newx; + chtype space = ' ' | rawattrs; + + if ((newx = x + (TABSIZE - + (x % TABSIZE))) > win->_maxx) + newx = win->_maxx; + for (; x < newx; x++) + if (waddch(win, + space) == ERR) + goto next; + } else { + if ((waddch(win, (chtype) + '^'|rawattrs) == ERR) || + (waddch(win, (chtype) + _UNCTRL(rawc)|rawattrs) == ERR)) { +next : + rv = ERR; + } + } + x = win->_curx; + y = win->_cury; + win->_immed = savimmed; + win->_sync = savsync; + break; + } +#ifdef DEBUG + if ((win->_attrs) && outf) + fprintf(outf, "(attrs %o, %o=>%o)", win->_attrs, + c, c | win->_attrs); +#endif /* DEBUG */ + + /* clear any partial multi-column character */ + if (_scrmax > 1 && ISMBIT(win->_y[y][x]) && + (rv = _mbclrch(win, y, x)) == ERR) { + x = win->_curx; + y = win->_cury; + win->_immed = savimmed; + win->_sync = savsync; + break; + } + + if ((c = _WCHAR(win, c)|rawattrs) != win->_y[y][x]) { + if (x < win->_firstch[y]) + win->_firstch[y] = x; + if (x > win->_lastch[y]) + win->_lastch[y] = x; + win->_y[y][x] = c; +#ifdef _VR3_COMPAT_CODE + if (_y16update) + /* LINTED */ + win->_y16[y][x] = _TO_OCHTYPE(c); +#endif /* _VR3_COMPAT_CODE */ + } + if (++x == win->_maxx) { +new_line: + if (y == win->_bmarg) { + if (wscrl(win, 1) == ERR) { + rv = ERR; + if (x == win->_maxx) + --x; +#ifdef DEBUG + if (outf) { + int i; + + fprintf(outf, "ERR because " + "(%d, %d) > (%d, %d)\n", + x, y, win->_maxx, + win->_maxy); + fprintf(outf, "line: '"); + for (i = 0; i < win->_maxy; + i++) + fprintf(outf, "%c", + win->_y[y-1][i]); + fprintf(outf, "'\n"); + } +#endif /* DEBUG */ + break; + } else + savimmed = 1; + } else + y++; + x = 0; + } else + savimmed += 2; +#ifdef FULLDEBUG + if (outf) + fprintf(outf, "ADDCH: 2: y = %d, x = %d, " + "firstch = %d, lastch = %d\n", y, x, + win->_firstch[y], win->_lastch[y]); +#endif /* FULLDEBUG */ + break; + } + win->_cury = y; + win->_curx = x; + +nextw: + /* sync with ancestor structures */ + if (win->_sync) + wsyncup(win); + + if (savimmed == 3) + return ((*_quick_ptr)(win, c)); + + win->_flags |= _WINCHANGED; + +out_move_only: + + return ((savimmed == 1) ? wrefresh(win) : rv); +} diff --git a/usr/src/lib/libcurses/screen/waddchnstr.c b/usr/src/lib/libcurses/screen/waddchnstr.c new file mode 100644 index 0000000000..8425b8b7e9 --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddchnstr.c @@ -0,0 +1,101 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Add ncols worth of data to win, using string as input. + * Return the number of chtypes copied. + */ +int +waddchnstr(WINDOW *win, chtype *string, int ncols) +{ + short my_x = win->_curx; + short my_y = win->_cury; + int remcols; + int b; + int sw; + int ew; + + if (ncols < 0) { + remcols = win->_maxx - my_x; + while (*string && remcols) { + sw = mbscrw((int)(_CHAR(*string))); + ew = mbeucw((int)(_CHAR(*string))); + if (remcols < sw) + break; + for (b = 0; b < ew; b++) { + if (waddch(win, *string++) == ERR) + goto out; + } + remcols -= sw; + } + } else { + remcols = win->_maxx - my_x; + while ((*string) && (remcols > 0) && (ncols > 0)) { + sw = mbscrw((int)(_CHAR(*string))); + ew = mbeucw((int)(_CHAR(*string))); + if ((remcols < sw) || (ncols < ew)) + break; + for (b = 0; b < ew; b++) { + if (waddch(win, *string++) == ERR) + goto out; + } + remcols -= sw; + ncols -= ew; + } + } +out: + /* restore cursor position */ + win->_curx = my_x; + win->_cury = my_y; + + win->_flags |= _WINCHANGED; + + /* sync with ancestor structures */ + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/waddnstr.c b/usr/src/lib/libcurses/screen/waddnstr.c new file mode 100644 index 0000000000..70f47e08e7 --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddnstr.c @@ -0,0 +1,157 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* This routine adds a string starting at (_cury, _curx) */ + +int +waddnstr(WINDOW *win, char *tstr, int i) +{ + chtype ch; + short maxx_1 = win->_maxx - 1, cury = win->_cury, + curx = win->_curx; + chtype **_y = win->_y; + bool savimmed = win->_immed, + savsync = win->_sync; + int rv = OK; + int pflag; + unsigned char *str = (unsigned char *)tstr; + +#ifdef DEBUG + if (outf) { + if (win == stdscr) + fprintf(outf, "waddnstr(stdscr, "); + else + fprintf(outf, "waddnstr(%o, ", win); + fprintf(outf, "\"%s\")\n", str); + } +#endif /* DEBUG */ + + /* throw away any current partial character */ + win->_nbyte = -1; + win->_insmode = FALSE; + pflag = 1; + + win->_immed = win->_sync = FALSE; + + if (i < 0) + i = MAXINT; + + while (((ch = *str) != 0) && (i-- > 0)) { + if (pflag == 1) { + if (_scrmax > 1 && (rv = _mbvalid(win)) == ERR) + break; + curx = win->_curx; + cury = win->_cury; + } + if (_mbtrue && ISMBIT(ch)) { + int m, k, ty; + chtype c; + /* make sure we have the whole character */ + c = RBYTE(ch); + ty = TYPE(c); + m = cswidth[ty] - (ty == 0 ? 1 : 0); + for (k = 1; str[k] != '\0' && k <= m; ++k) + if (!ISMBIT(str[k])) + break; + if (k <= m) + break; + if (m > i) + break; + for (k = 0; k <= m; ++k, ++str) { + if ((rv = _mbaddch(win, A_NORMAL, + RBYTE(*str))) == ERR) + goto done; + if (k > 0) + i--; + } + pflag = 1; + cury = win->_cury; + curx = win->_curx; + continue; + } + + /* do normal characters while not next to edge */ + if ((ch >= ' ') && (ch != _CTRL('?')) && (curx < maxx_1)) { + if (_scrmax > 1 && ISMBIT(_y[cury][curx]) && + (rv = _mbclrch(win, cury, curx)) == ERR) + break; + if (curx < win->_firstch[cury]) + win->_firstch[cury] = curx; + if (curx > win->_lastch[cury]) + win->_lastch[cury] = curx; + ch = _WCHAR(win, ch); + _y[cury][curx] = ch; +#ifdef _VR3_COMPAT_CODE + if (_y16update) + /* LINTED */ + win->_y16[cury][curx] = _TO_OCHTYPE(ch); +#endif /* _VR3_COMPAT_CODE */ + curx++; + pflag = 0; + } else { + win->_curx = curx; + /* found a char that is too tough to handle above */ + if (waddch(win, ch) == ERR) { + rv = ERR; + break; + } + cury = win->_cury; + curx = win->_curx; + pflag = 1; + } + str++; + win->_curx = curx; + } + +done : + win->_curx = curx; + win->_flags |= _WINCHANGED; + win->_sync = savsync; + if (win->_sync) + wsyncup(win); + + return ((win->_immed = savimmed) ? wrefresh(win) : rv); +} diff --git a/usr/src/lib/libcurses/screen/waddnwstr.c b/usr/src/lib/libcurses/screen/waddnwstr.c new file mode 100644 index 0000000000..f9ac7e7fae --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddnwstr.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Add to 'win' at most n 'characters' of code starting at(cury, curx) + */ +int +waddnwstr(WINDOW *win, wchar_t *code, int n) +{ + char *sp; + + /* translate the process code to character code */ + if ((sp = _strcode2byte(code, NULL, n)) == NULL) + return (ERR); + + /* now call waddnstr to do the real work */ + return (waddnstr(win, sp, -1)); +} diff --git a/usr/src/lib/libcurses/screen/waddwch.c b/usr/src/lib/libcurses/screen/waddwch.c new file mode 100644 index 0000000000..0b84f81615 --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddwch.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + + +/* + * Add to 'win' a character at(curx, cury). + */ +int +waddwch(WINDOW *win, chtype c) +{ + int width; + char buf[CSMAX]; + chtype a; + wchar_t code; + char *p; + + a = c & A_WATTRIBUTES; + code = c & A_WCHARTEXT; + + /* translate the process code to character code */ + if ((width = _curs_wctomb(buf, code & TRIM)) < 0) + return (ERR); + + /* now call waddch to do the real work */ + p = buf; + while (width--) + if (waddch(win, a|(0xFF & *p++)) == ERR) + return (ERR); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/waddwchnstr.c b/usr/src/lib/libcurses/screen/waddwchnstr.c new file mode 100644 index 0000000000..e7c084466d --- /dev/null +++ b/usr/src/lib/libcurses/screen/waddwchnstr.c @@ -0,0 +1,129 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Add ncols worth of data to win, using string as input. + * Return the number of chtypes copied. + * Note: chtype contains 32/16 bit process code. + */ +int +waddwchnstr(WINDOW *win, chtype *string, int ncols) +{ + int my_x = win->_curx; + int my_y = win->_cury; + short my_maxx; + int counter; + chtype *ptr = &(win->_y[my_y][my_x]); + chtype *sptr = ptr; + char mbbuf[CSMAX+1]; + int mp, s, scrw; + chtype rawc; + chtype attr; + short my_x1 = win->_curx; + + + while (ISCBIT(*ptr)) { + ptr--; + my_x1--; + } + while (ptr < sptr) + *ptr++ = win->_bkgd; + + if (ncols == -1) + ncols = MAXINT; + + counter = win->_maxx - my_x; + while ((ncols > 0) && (*string) && (counter > 0)) { + attr = *string & A_WATTRIBUTES; + rawc = *string & A_WCHARTEXT; + + /* conver wchar_t to mbuti byte string */ + for (mp = 0; mp < sizeof (mbbuf); mp++) + mbbuf[mp] = '\0'; + if (_curs_wctomb(mbbuf, rawc) <= 0) + goto out; + + /* if there are no cols on screen, end */ + if ((scrw = wcscrw(rawc)) > counter) + goto out; + + if (rawc & WCHAR_CSMASK) { + /* store multi-byte string into chtype */ + for (s = 0, mp = 0; s < scrw; s++, mp += 2) { + *ptr = _CHAR(RBYTE(mbbuf[mp]) | + RBYTE(mbbuf[mp + 1]) << 8) | CBIT; + SETMBIT(*ptr); + if (mp > 0) + SETCBIT(*ptr); + else + CLRCBIT(*ptr); + *ptr |= attr; + ptr++; + } + } else { + /* store single-byte string into chtype */ + *ptr = mbbuf[0]; + *ptr |= attr; + ptr++; + } + + ncols--; + string++; + counter -= scrw; + } +out : + + while (ISCBIT(*ptr)) + *ptr++ = win->_bkgd; + + /* LINTED */ + my_maxx = (short) (ptr - sptr + my_x); + + if (my_x1 < win->_firstch[my_y]) + win->_firstch[my_y] = my_x1; + + if (my_maxx > win->_lastch[my_y]) + win->_lastch[my_y] = my_maxx; + + win->_flags |= _WINCHANGED; + + /* sync with ancestor structures */ + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wadjcurspos.c b/usr/src/lib/libcurses/screen/wadjcurspos.c new file mode 100644 index 0000000000..236aae7f63 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wadjcurspos.c @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1988 by Sun Microsystems, Inc. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include "curses_inc.h" + +int +wadjcurspos(WINDOW *win) + /* + * wmadjcurspos --- moves the cursor to the first column within the + * multi-column character somewhere on which the cursor curently is on. + */ +{ + short x; + chtype *_yy; + + x = win->_curx; + _yy = win->_y[win->_cury]; + while ((x > 0) && (ISCBIT(_yy[x]))) --x; + if (win->_curx != x) { + win->_curx = x; + return (win->_immed ? wrefresh(win): OK); + } else { + return (OK); + } +} diff --git a/usr/src/lib/libcurses/screen/wattroff.c b/usr/src/lib/libcurses/screen/wattroff.c new file mode 100644 index 0000000000..752081812f --- /dev/null +++ b/usr/src/lib/libcurses/screen/wattroff.c @@ -0,0 +1,75 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wattroff(WINDOW *win, chtype a) +{ + /* if attribute contains color information, but this is not a color */ + /* terminal, or that color information doesn't match the one stored */ + /* inside _attrs, ignore that information. */ + + if (((a & A_COLOR) && (cur_term->_pairs_tbl == NULL)) || + ((a & A_COLOR) != (win->_attrs & A_COLOR))) + a &= ~A_COLOR; + + if ((a & A_ATTRIBUTES) == A_NORMAL) + return (1); + + /* turn off the attributes */ + + win->_attrs &= ~a & A_ATTRIBUTES; + + /* if background contains color information different from the one */ + /* we have just turned off, turn that color on. (Reason: the */ + /* color we have just turned off was set by wattron(), so the */ + /* back-ground color was blocked. However, now the background */ + /* color can be seen. */ + + if ((a & A_COLOR) && ((a & A_COLOR) != (win->_bkgd & A_COLOR))) + win->_attrs |= (win->_bkgd & A_COLOR); + + return (1); +} diff --git a/usr/src/lib/libcurses/screen/wattron.c b/usr/src/lib/libcurses/screen/wattron.c new file mode 100644 index 0000000000..890894f83d --- /dev/null +++ b/usr/src/lib/libcurses/screen/wattron.c @@ -0,0 +1,62 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wattron(WINDOW *win, chtype a) +{ + /* if 'a' contains color information, then if we are on color */ + /* terminal erase color information from window attribute, */ + /* otherwise erase color information from 'a' */ + + if (a & A_COLOR) + if (cur_term->_pairs_tbl) + win->_attrs &= ~A_COLOR; + else + a &= ~A_COLOR; + + win->_attrs |= (a & A_ATTRIBUTES); + return (1); +} diff --git a/usr/src/lib/libcurses/screen/wattrset.c b/usr/src/lib/libcurses/screen/wattrset.c new file mode 100644 index 0000000000..d6881fa98b --- /dev/null +++ b/usr/src/lib/libcurses/screen/wattrset.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wattrset(WINDOW *win, chtype a) +{ + chtype temp_bkgd; + + /* if 'a' contains color information, then if we are not on */ + /* color terminal erase color information from 'a' */ + + if ((a & A_COLOR) && (cur_term->_pairs_tbl == NULL)) + a &= ~A_COLOR; + + /* combine 'a' with the background. if 'a' contains color */ + /* information delete color information from the background */ + + temp_bkgd = (a & A_COLOR) ? (win->_bkgd & ~A_COLOR) : win->_bkgd; + win->_attrs = (a | temp_bkgd) & A_ATTRIBUTES; + return (1); +} diff --git a/usr/src/lib/libcurses/screen/wbkgd.c b/usr/src/lib/libcurses/screen/wbkgd.c new file mode 100644 index 0000000000..aef5fc1e8f --- /dev/null +++ b/usr/src/lib/libcurses/screen/wbkgd.c @@ -0,0 +1,127 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Change the background of a window. nbkgd : new background. */ + +int +wbkgd(WINDOW *win, chtype nbkgd) +{ + short maxx; + int x, y; + chtype *wcp, obkgda, obkgdc, nbkgda, + nbkgdc, acolor, c; + short *begch, *endch; + + /* if 'nbkgd' contains color information, but this is not a color */ + /* terminal, erase that information. */ + + if ((nbkgd & A_COLOR) && (cur_term->_pairs_tbl == NULL)) + nbkgd &= ~A_COLOR; + + if (nbkgd == win->_bkgd) + return (OK); + + obkgdc = _CHAR(win->_bkgd); + obkgda = _ATTR(win->_bkgd); + + nbkgdc = _CHAR(nbkgd); + nbkgda = _ATTR(nbkgd); + + /* switch byte order if necessary */ + if (ISCBIT(nbkgdc)) + nbkgdc = _CHAR((RBYTE(nbkgdc) << 8) | (LBYTE(nbkgdc)|MBIT)) | + CBIT; + c = RBYTE(nbkgdc); + if ((nbkgdc < ' ' || nbkgdc == _CTRL('?')) || + _curs_scrwidth[TYPE(c)] > 1) + nbkgdc = obkgdc; + nbkgd = (nbkgdc & ~CBIT) | nbkgda; + + win->_bkgd = nbkgd; + + /* delete the old background from the attribute field and replace */ + /* it with the new background. Note: if the same attribute was */ + /* first set by wbkgd() and then by wattron(), or vice versa, it */ + /* will be deleted, so the effect of wattron() will be lost. */ + /* This applies to both video and color attributes. */ + + if ((acolor = (win->_attrs & A_COLOR)) != 0) { + if (acolor == (obkgda & A_COLOR)) { + win->_attrs = _ATTR((win->_attrs & ~obkgda) | nbkgda); + } else { + win->_attrs = _ATTR((win->_attrs & + (~obkgda | A_COLOR)) | (nbkgda & ~A_COLOR)); + } + } else + win->_attrs = _ATTR((win->_attrs & ~obkgda) | nbkgda); + + maxx = win->_maxx - 1; + begch = win->_firstch; + endch = win->_lastch; + for (y = win->_maxy-1; y >= 0; --y, ++begch, ++endch) { + for (x = maxx, wcp = win->_y[y]; x-- >= 0; ++wcp) { + if ((c = _CHAR(*wcp)) == obkgdc) + c = nbkgdc; + if ((acolor = (*wcp & A_COLOR)) != 0) { + if (acolor == (obkgda & A_COLOR)) + *wcp = c | _ATTR((*wcp & ~obkgda) | + nbkgda); + else + *wcp = c | _ATTR((*wcp & (~obkgda | + A_COLOR)) | (nbkgda & ~A_COLOR)); + } else + *wcp = c | _ATTR((*wcp & ~obkgda) | nbkgda); + } + *begch = 0; + *endch = maxx; + } + + win->_flags |= _WINCHANGED; + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wbkgdset.c b/usr/src/lib/libcurses/screen/wbkgdset.c new file mode 100644 index 0000000000..ddad22c752 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wbkgdset.c @@ -0,0 +1,44 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +void +wbkgdset(WINDOW *win, chtype c) +{ + win->_attrs = (win->_attrs & ~(win->_bkgd & A_ATTRIBUTES)) | + (c & A_ATTRIBUTES); + win->_bkgd = c; +} diff --git a/usr/src/lib/libcurses/screen/wborder.c b/usr/src/lib/libcurses/screen/wborder.c new file mode 100644 index 0000000000..eb56705f29 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wborder.c @@ -0,0 +1,181 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +/* + * Draw a box around a window. + * + * ls : the character and attributes used for the left side. + * rs : right side. + * ts : top side. + * bs : bottom side. + */ + +#define _LEFTSIDE variables[0] +#define _RIGHTSIDE variables[1] +#define _TOPSIDE variables[2] +#define _BOTTOMSIDE variables[3] +#define _TOPLEFT variables[4] +#define _TOPRIGHT variables[5] +#define _BOTTOMLEFT variables[6] +#define _BOTTOMRIGHT variables[7] + +static char acs_values[] = { + 'x', /* ACS_VLINE */ + 'x', /* ACS_VLINE */ + 'q', /* ACS_HLINE */ + 'q', /* ACS_HLINE */ + 'l', /* ACS_ULCORNER */ + 'k', /* ACS_URCORNER */ + 'm', /* ACS_LLCORNER */ + 'j' /* ACS_LRCORNER */ + }; + +int +wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, + chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +{ + int i, endy = win->_maxy - 1, endx = win->_maxx - 2; + chtype **_y = win->_y; /* register version */ + chtype *line_ptr, variables[8]; + int x, sx, xend; + chtype wc; + + _LEFTSIDE = ls; + _RIGHTSIDE = rs; + _TOPSIDE = ts; + _BOTTOMSIDE = bs; + _TOPLEFT = tl; + _TOPRIGHT = tr; + _BOTTOMLEFT = bl; + _BOTTOMRIGHT = br; + + for (i = 0; i < 8; i++) { + if (_CHAR(variables[i]) == 0 || + variables[i] & 0xFF00) + variables[i] = acs_map[acs_values[i]]; + if (ISCBIT(variables[i])) + variables[i] = _CHAR((RBYTE(variables[i])<<8) | \ + (LBYTE(variables[i])|MBIT)) | CBIT; + variables[i] &= ~CBIT; + variables[i] = _WCHAR(win, variables[i]) | _ATTR(variables[i]); + } + + /* do top and bottom edges and corners */ + xend = win->_maxx-1; + x = 0; + for (; x <= xend; ++x) + if (!ISCBIT(_y[0][x])) + break; + for (; xend >= x; --xend) + if (!ISCBIT(_y[0][endx])) { + int m; + wc = RBYTE(_y[0][xend]); + if ((m = xend + _curs_scrwidth[TYPE(wc)]) > win->_maxx) + xend -= 1; + else + xend = m - 1; + endx = xend - 1; + break; + } + sx = x == 0 ? 1 : x; + memSset((line_ptr = &_y[0][sx]), _TOPSIDE, endx); + if (x == 0) + *(--line_ptr) = _TOPLEFT; + if (endx == win->_maxx-2) + line_ptr[++endx] = _TOPRIGHT; + + xend = win->_maxx-1; + x = 0; + for (; x <= xend; ++x) + if (!ISCBIT(_y[endy][x])) + break; + for (; xend >= x; --xend) + if (!ISCBIT(_y[endy][xend])) { + int m; + wc = RBYTE(_y[endy][xend]); + if ((m = xend + _curs_scrwidth[TYPE(wc)]) > win->_maxx) + xend -= 1; + else + xend = m - 1; + endx = xend - 1; + break; + } + sx = x == 0 ? 1 : x; + + memSset((line_ptr = &_y[endy][sx]), _BOTTOMSIDE, endx); + if (x == 0) + *--line_ptr = _BOTTOMLEFT; + if (endx == win->_maxx-2) + line_ptr[++endx] = _BOTTOMRIGHT; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + (*_y16update)(win, 1, ++endx, 0, 0); + (*_y16update)(win, 1, endx--, endy, 0); + } +#endif /* _VR3_COMPAT_CODE */ + + /* left and right edges */ + while (--endy > 0) { + wc = _y[endy][0]; + if (!ISCBIT(wc) && _curs_scrwidth[TYPE(RBYTE(wc))] == 1) + _y[endy][0] = _LEFTSIDE; + wc = _y[endy][endx]; + if (!ISCBIT(wc) && _curs_scrwidth[TYPE(RBYTE(wc))] == 1) + _y[endy][endx] = _RIGHTSIDE; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) { + /* LINTED */ + win->_y16[endy][0] = _TO_OCHTYPE(_LEFTSIDE); + /* LINTED */ + win->_y16[endy][endx] = _TO_OCHTYPE(_RIGHTSIDE); + } +#endif /* _VR3_COMPAT_CODE */ + } + return (wtouchln((win), 0, (win)->_maxy, TRUE)); +} diff --git a/usr/src/lib/libcurses/screen/wclrtobot.c b/usr/src/lib/libcurses/screen/wclrtobot.c new file mode 100644 index 0000000000..8b9b347778 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wclrtobot.c @@ -0,0 +1,84 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* This routine erases everything on the window. */ +int +wclrtobot(WINDOW *win) +{ + bool savimmed, savsync; + int cury = win->_cury; + short curx = win->_curx; + + if (win != curscr) { + savimmed = win->_immed; + savsync = win->_sync; + win->_immed = win->_sync = FALSE; + } + + /* set region to be clear */ + if (cury >= win->_tmarg && cury <= win->_bmarg) + win->_cury = win->_bmarg; + else + win->_cury = win->_maxy - 1; + + win->_curx = 0; + for (; win->_cury > cury; win->_cury--) + (void) wclrtoeol(win); + win->_curx = curx; + (void) wclrtoeol(win); + + if (win == curscr) + return (OK); + + /* not curscr */ + win->_sync = savsync; + + if (win->_sync) + wsyncup(win); + + win->_flags |= _WINCHANGED; + return ((win->_immed = savimmed) ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wclrtoeol.c b/usr/src/lib/libcurses/screen/wclrtoeol.c new file mode 100644 index 0000000000..d24d5736fa --- /dev/null +++ b/usr/src/lib/libcurses/screen/wclrtoeol.c @@ -0,0 +1,149 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +/* This routine clears up to the end of line. */ + +int +wclrtoeol(WINDOW *win) +{ + int y = win->_cury; + int x = win->_curx; + int maxx = win->_maxx; + int cx; + chtype wc; + + if (win != curscr) { + win->_nbyte = -1; + if (_scrmax > 1) { + if (ISMBIT(win->_y[y][x])) { + win->_insmode = TRUE; + if (_mbvalid(win) == ERR) + return (ERR); + x = win->_curx; + } + if (ISMBIT(win->_y[y][maxx - 1])) { + for (cx = maxx - 1; cx >= x; --cx) + if (!ISCBIT(win->_y[y][cx])) + break; + wc = RBYTE(win->_y[y][cx]); + if (cx + _curs_scrwidth[TYPE(wc)] > maxx) + maxx = cx - 1; + } + } + } + + memSset(&win->_y[y][x], win->_bkgd, maxx - x); + maxx = win->_maxx; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) + (*_y16update)(win, 1, maxx - x, y, x); +#endif /* _VR3_COMPAT_CODE */ + + /* if curscr, reset blank structure */ + if (win == curscr) { + if (_BEGNS[y] >= x) + /* LINTED */ + _BEGNS[y] = (short) maxx; + if (_ENDNS[y] >= x) + _ENDNS[y] = _BEGNS[y] > x ? -1 : x-1; + + _CURHASH[y] = x == 0 ? 0 : _NOHASH; + + if (_MARKS != NULL) { + char *mkp = _MARKS[y]; + int endx = COLS / + BITSPERBYTE + (COLS %BITSPERBYTE ? 1 : 0); + int m = x / BITSPERBYTE + 1; + + for (; m < endx; ++m) + mkp[m] = 0; + mkp += x / BITSPERBYTE; + if ((m = x % BITSPERBYTE) == 0) + *mkp = 0; + else + for (; m < BITSPERBYTE; ++m) + *mkp &= ~(1 << m); + + /* if color terminal, do the same for color marks */ + + if (_COLOR_MARKS != NULL) { + mkp = _COLOR_MARKS[y]; + + m = x / BITSPERBYTE + 1; + for (; m < endx; ++m) + mkp[m] = 0; + mkp += x / BITSPERBYTE; + if ((m = x % BITSPERBYTE) == 0) + *mkp = 0; + else + for (; m < BITSPERBYTE; ++m) + *mkp &= ~(1 << m); + } + } + return (OK); + } else { + /* update firstch and lastch for the line. */ +#ifdef DEBUG + if (outf) + fprintf(outf, "CLRTOEOL: line %d begx = %d, maxx = %d, " + "lastch = %d, next firstch %d\n", y, win->_begx, + win->_firstch[y], win->_lastch[y], win->_firstch[y+1]); +#endif /* DEBUG */ + + if (win->_firstch[y] > x) + /* LINTED */ + win->_firstch[y] = (short) x; + win->_lastch[y] = maxx - 1; + win->_flags |= _WINCHANGED; + /* sync with ancestors structures */ + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); + } +} diff --git a/usr/src/lib/libcurses/screen/wcstombs.c b/usr/src/lib/libcurses/screen/wcstombs.c new file mode 100644 index 0000000000..c2fdeb2d05 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wcstombs.c @@ -0,0 +1,63 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <widec.h> +#include <limits.h> +#include <sys/types.h> +#include "curses_inc.h" + +size_t +_curs_wcstombs(char *s, const wchar_t *pwcs, size_t n) +{ + int val; + int total = 0; + char temp[MB_LEN_MAX]; + int i; + + for (; ; ) { + if (*pwcs == 0) { + *s = '\0'; + break; + } + if ((val = _curs_wctomb(temp, *pwcs++)) == -1) + return (val); + if ((total += val) > n) { + total -= val; + break; + } + for (i = 0; i < val; i++) + *s++ = temp[i]; + } + return (total); +} diff --git a/usr/src/lib/libcurses/screen/wctomb.c b/usr/src/lib/libcurses/screen/wctomb.c new file mode 100644 index 0000000000..42c0668d5c --- /dev/null +++ b/usr/src/lib/libcurses/screen/wctomb.c @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <widec.h> +#include <ctype.h> +#include "curses_wchar.h" + +int +_curs_wctomb(char *s, wchar_t wchar) +{ + char *olds = s; + int size, index; + unsigned char d; + if (!s) + return (0); + if (wchar <= 0177 || (wchar <= 0377 && (iscntrl((int)wchar) != 0))) { + /* LINTED */ + *s++ = (char)wchar; + return (1); + } + switch (wchar & EUCMASK) { + + case P11: + size = eucw1; + break; + + case P01: + /* LINTED */ + *s++ = (char)SS2; + size = eucw2; + break; + + case P10: + /* LINTED */ + *s++ = (char)SS3; + size = eucw3; + break; + + default: + return (-1); + } + if ((index = size) <= 0) + return (-1); + while (index--) { + /* LINTED */ + d = wchar | 0200; + wchar >>= 7; + if (iscntrl(d)) + return (-1); + s[index] = d; + } + /* LINTED */ + return ((int)(s - olds) + size); +} diff --git a/usr/src/lib/libcurses/screen/wdelch.c b/usr/src/lib/libcurses/screen/wdelch.c new file mode 100644 index 0000000000..7458ffe998 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wdelch.c @@ -0,0 +1,110 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * This routine performs a delete-char on the line, + * leaving (_cury, _curx) unchanged. + */ + +int +wdelch(WINDOW *win) +{ + chtype *temp1, *temp2; + chtype *end; + int cury = win->_cury; + short curx = win->_curx; + chtype *cp; + int s; + + end = &win->_y[cury][win->_maxx - 1]; + temp2 = &win->_y[cury][curx + 1]; + temp1 = temp2 - 1; + + s = 1; + win->_nbyte = -1; + if (_scrmax > 1) { + if (ISMBIT(*temp1)) { + win->_insmode = TRUE; + if (_mbvalid(win) == ERR) + return (ERR); + curx = win->_curx; + temp1 = &win->_y[cury][curx]; + } + if (ISMBIT(*end)) { + for (cp = end; cp >= temp1; --cp) + if (!ISCBIT(*cp)) + break; + if (cp + _curs_scrwidth[TYPE(*cp)] > end+1) + end = cp - 1; + } + if (ISMBIT(*temp1)) + s = _curs_scrwidth[TYPE(RBYTE(*temp1))]; + end -= s - 1; + temp2 = &win->_y[cury][curx+s]; + } + + while (temp1 < end) + *temp1++ = *temp2++; + + while (s--) + *temp1++ = win->_bkgd; + +#ifdef _VR3_COMPAT_CODE + if (_y16update) + (*_y16update)(win, 1, win->_maxx - curx, cury, curx); +#endif /* _VR3_COMPAT_CODE */ + + win->_lastch[cury] = win->_maxx - 1; + if (win->_firstch[cury] > curx) + win->_firstch[cury] = curx; + + win->_flags |= _WINCHANGED; + + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wechochar.c b/usr/src/lib/libcurses/screen/wechochar.c new file mode 100644 index 0000000000..37e1c26547 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wechochar.c @@ -0,0 +1,66 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * These routines short-circuit much of the innards of curses in order to get + * a single character output to the screen quickly! It is used by getch() + * and getstr(). + * + * wechochar(WINDOW *win, chtype ch) is functionally equivalent to + * waddch(WINDOW *win, chtype ch), wrefresh(WINDOW *win) + */ + +int +wechochar(WINDOW *win, chtype ch) +{ + bool saveimm = win->_immed; + int rv; + + immedok(win, TRUE); + rv = waddch(win, ch); + win->_immed = saveimm; + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/wechowchar.c b/usr/src/lib/libcurses/screen/wechowchar.c new file mode 100644 index 0000000000..957bc8a0e5 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wechowchar.c @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * These routines short-circuit much of the innards of curses in order to get + * a single character output to the screen quickly! It is used by getch() + * and getstr(). + * + * wechowchar(WINDOW *win, chtype ch) is functionally equivalent to + * waddch(WINDOW *win, chtype ch), wrefresh(WINDOW *win) + */ + +int +wechowchar(WINDOW *win, chtype ch) +{ + bool saveimm = win->_immed; + int rv; + + immedok(win, TRUE); + rv = waddwch(win, ch); + win->_immed = saveimm; + return (rv); +} diff --git a/usr/src/lib/libcurses/screen/wgetch.c b/usr/src/lib/libcurses/screen/wgetch.c new file mode 100644 index 0000000000..25a569522a --- /dev/null +++ b/usr/src/lib/libcurses/screen/wgetch.c @@ -0,0 +1,111 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#ifdef DEBUG +#include <ctype.h> +#endif /* DEBUG */ + +/* + * This routine reads in a character from the window. + * + * wgetch MUST return an int, not a char, because it can return + * things like ERR, meta characters, and function keys > 256. + */ + +int +wgetch(WINDOW *win) +{ + int inp; + bool weset = FALSE; + +#ifdef DEBUG + if (outf) { + fprintf(outf, "WGETCH: SP->fl_echoit = %c\n", + SP->fl_echoit ? 'T' : 'F'); + fprintf(outf, "_use_keypad %d, kp_state %d\n", + win->_use_keypad, SP->kp_state); + fprintf(outf, "file %x fd %d\n", SP->input_file, + fileno(SP->input_file)); + } +#endif /* DEBUG */ + + if (SP->fl_echoit && cur_term->_fl_rawmode == 0) { + (void) cbreak(); + weset++; + } + + /* Make sure we are in proper nodelay state and not */ + /* in halfdelay state */ + if (cur_term->_delay <= 0 && cur_term->_delay != win->_delay) + (void) ttimeout(win->_delay); + + if ((win->_flags & (_WINCHANGED | _WINMOVED)) && !(win->_flags & + _ISPAD)) + (void) wrefresh(win); + + if ((cur_term->_ungotten == 0) && (req_for_input)) { + (void) tputs(req_for_input, 1, _outch); + (void) fflush(SP->term_file); + } + inp = (int)tgetch((int)(win->_use_keypad ? 1 + win->_notimeout : 0)); + + /* echo the key out to the screen */ + if (SP->fl_echoit && (inp < 0200) && (inp >= 0) && !(win->_flags & + _ISPAD)) + (void) wechochar(win, (chtype) inp); + + /* + * Do nl() mapping. nl() affects both input and output. Since + * we turn off input mapping of CR->NL to not affect input + * virtualization, we do the mapping here in software. + */ + if (inp == '\r' && !SP->fl_nonl) + inp = '\n'; + + if (weset) + (void) nocbreak(); + + return (inp); +} diff --git a/usr/src/lib/libcurses/screen/wgetstr.c b/usr/src/lib/libcurses/screen/wgetstr.c new file mode 100644 index 0000000000..76ec80b707 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wgetstr.c @@ -0,0 +1,209 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#define LENGTH 256 + +/* This routine gets a string starting at (_cury, _curx) */ + +int +wgetstr(WINDOW *win, char *str) +{ + return ((wgetnstr(win, str, LENGTH) == ERR) ? ERR : OK); +} + +int +wgetnstr(WINDOW *win, char *str, int n) +{ + int cpos = 0, ch; + int nbyte = 0; + int tbyte = 0; + int byte[LENGTH]; + int eucw, scrw; + int docont = 0; + char *cp = str; + int i = 0; + int total = 0; + char myerase, mykill; + char rownum[LENGTH], colnum[LENGTH], length[LENGTH]; + int doecho = SP->fl_echoit; + int savecb = cur_term->_fl_rawmode; + bool savsync, savimmed, savleave; + +#ifdef DEBUG + if (outf) + fprintf(outf, "doecho %d, savecb %d\n", doecho, savecb); +#endif /* DEBUG */ + + myerase = erasechar(); + mykill = killchar(); + if (!savecb) + (void) cbreak(); + + if (doecho) { + SP->fl_echoit = FALSE; + savsync = win->_sync; + savimmed = win->_immed; + savleave = win->_leave; + win->_immed = win->_sync = win->_leave = FALSE; + (void) wrefresh(win); + if (n > LENGTH) + n = LENGTH; + } + n--; + + while (nbyte < n) { + if (doecho && !docont) { + rownum[cpos] = win->_cury; + colnum[cpos] = win->_curx; + } + + ch = wgetch(win); + if (docont) + goto cont; + + if ((ch == ERR) || (ch == '\n') || (ch == '\r') || + (ch == KEY_ENTER)) + break; + if ((ch == myerase) || (ch == KEY_LEFT) || + (ch == KEY_BACKSPACE) || (ch == mykill)) { + if (cpos > 0) { + if (ch == mykill) { + i = total; + total = cpos = 0; + nbyte = 0; + cp = str; + } else { + cpos--; + cp -= byte[cpos]; + if (doecho) + total -= (i = length[cpos]); + } + if (doecho) { + (void) wmove(win, rownum[cpos], + colnum[cpos]); + /* Add the correct amount of blanks. */ + for (; i > 0; i--) + (void) waddch(win, ' '); + /* Move back after the blanks are */ + /* put in. */ + (void) wmove(win, rownum[cpos], + colnum[cpos]); + /* Update total. */ + (void) wrefresh(win); + } + } else + if (doecho) + (void) beep(); + } else if ((KEY_MIN <= ch) && (ch <= KEY_MAX)) + (void) beep(); + else { +cont: + /* LINTED */ + *cp++ = (char)ch; + if (docont) { + tbyte++; + } else if (ISMBIT(ch)) { + docont = 1; + tbyte = 1; + scrw = mbscrw(ch); + eucw = mbeucw(ch); + } + + if (docont && (tbyte >= eucw)) { + docont = 0; + tbyte = 0; + if (doecho) { + byte[cpos] = eucw; + /* LINTED */ + length[cpos] = (char)scrw; + (void) wechochar(win, + (chtype) ch); + } + } else if (doecho) { + /* Add the length of the */ + /* character to total. */ + byte[cpos] = 1; + if (ch >= ' ') + length[cpos] = 1; + else + if (ch == '\t') + length[cpos] = TABSIZE- + (colnum[cpos] % + TABSIZE); + else + length[cpos] = 2; + total += length[cpos]; + (void) wechochar(win, (chtype) ch); + } + if (!docont) + cpos++; + nbyte++; + } + } + + *cp = '\0'; + + if (!savecb) + (void) nocbreak(); + /* + * The following code is equivalent to waddch(win, '\n') + * except that it does not do a wclrtoeol. + */ + if (doecho) { + SP->fl_echoit = TRUE; + win->_curx = 0; + if (win->_cury + 1 > win->_bmarg) + (void) wscrl(win, 1); + else + win->_cury++; + + win->_sync = savsync; + win->_immed = savimmed; + win->_leave = savleave; + (void) wrefresh(win); + } + return (ch); +} diff --git a/usr/src/lib/libcurses/screen/wgetwch.c b/usr/src/lib/libcurses/screen/wgetwch.c new file mode 100644 index 0000000000..6e6b0988e6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wgetwch.c @@ -0,0 +1,73 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get a process code + */ + +int +wgetwch(WINDOW *win) +{ + int c, n, type, width; + char buf[CSMAX]; + wchar_t wchar; + + /* get the first byte */ + if ((c = wgetch(win)) == ERR) + return (ERR); + + if (c >= KEY_MIN) + return (c); + + type = TYPE(c); + width = cswidth[type] - ((type == 1 || type == 2) ? 0 : 1); + /* LINTED */ + buf[0] = (char)c; + for (n = 1; n <= width; ++n) { + if ((c = wgetch(win)) == ERR) + return (ERR); + if (TYPE(c) != 0) + return (ERR); + /* LINTED */ + buf[n] = (char)c; + } + + /* translate it to process code */ + if ((_curs_mbtowc(&wchar, buf, n)) < 0) + return (ERR); + return ((int)wchar); + } diff --git a/usr/src/lib/libcurses/screen/wgetwstr.c b/usr/src/lib/libcurses/screen/wgetwstr.c new file mode 100644 index 0000000000..d896579b8e --- /dev/null +++ b/usr/src/lib/libcurses/screen/wgetwstr.c @@ -0,0 +1,167 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +#define LENGTH 256 + +/* This routine gets a string starting at (_cury, _curx) */ +int +wgetwstr(WINDOW *win, wchar_t *str) +{ + return ((wgetnwstr(win, str, LENGTH) == ERR) ? ERR : OK); +} + +int +wgetnwstr(WINDOW *win, wchar_t *str, int n) +{ + int cpos = 0, ch; + wchar_t *cp = str; + int i = 0; + int total = 0; + char myerase, mykill; + char rownum[LENGTH], colnum[LENGTH], length[LENGTH]; + int doecho = SP->fl_echoit; + int savecb = cur_term->_fl_rawmode; + bool savsync, savimmed, savleave; + +#ifdef DEBUG + if (outf) + fprintf(outf, "doecho %d, savecb %d\n", doecho, savecb); +#endif /* DEBUG */ + + myerase = erasechar(); + mykill = killchar(); + if (!savecb) + (void) cbreak(); + + if (doecho) { + SP->fl_echoit = FALSE; + savsync = win->_sync; + savimmed = win->_immed; + savleave = win->_leave; + win->_immed = win->_sync = win->_leave = FALSE; + (void) wrefresh(win); + if (n > LENGTH) + n = LENGTH; + } + n--; + + while (cpos < n) { + if (doecho) { + rownum[cpos] = win->_cury; + colnum[cpos] = win->_curx; + } + + ch = wgetwch(win); + if ((ch == ERR) || (ch == '\n') || (ch == '\r') || + (ch == KEY_ENTER)) + break; + if ((ch == myerase) || (ch == KEY_LEFT) || + (ch == KEY_BACKSPACE) || (ch == mykill)) { + if (cpos > 0) { + if (ch == mykill) { + i = total; + total = cpos = 0; + cp = str; + } else { + cp--; + cpos--; + if (doecho) + total -= (i = length[cpos]); + } + if (doecho) { + (void) wmove(win, rownum[cpos], + colnum[cpos]); + /* Add the correct amount of blanks. */ + for (; i > 0; i--) + (void) waddch(win, ' '); + /* Move back after the blanks */ + /* are put in. */ + (void) wmove(win, rownum[cpos], + colnum[cpos]); + /* Update total. */ + (void) wrefresh(win); + } + } else + if (doecho) + (void) beep(); + } else + if ((KEY_MIN <= ch) && (ch <= KEY_MAX)) + (void) beep(); + else { + *cp++ = ch; + if (doecho) { + /* Add the length of the */ + /* character to total. */ + if ((ch & EUCMASK) != P00) + length[cpos] = wcscrw(ch); + else if (ch >= ' ') + length[cpos] = 1; + else if (ch == '\t') + length[cpos] = TABSIZE - + (colnum[cpos] % TABSIZE); + else + length[cpos] = 2; + total += length[cpos]; + (void) wechowchar(win, (chtype) ch); + } + cpos++; + } + } + + *cp = '\0'; + + if (!savecb) + (void) nocbreak(); + /* + * The following code is equivalent to waddch(win, '\n') + * except that it does not do a wclrtoeol. + */ + if (doecho) { + SP->fl_echoit = TRUE; + win->_curx = 0; + if (win->_cury + 1 > win->_bmarg) + (void) wscrl(win, 1); + else + win->_cury++; + + win->_sync = savsync; + win->_immed = savimmed; + win->_leave = savleave; + (void) wrefresh(win); + } + return (ch); +} diff --git a/usr/src/lib/libcurses/screen/whline.c b/usr/src/lib/libcurses/screen/whline.c new file mode 100644 index 0000000000..0e033d9ae4 --- /dev/null +++ b/usr/src/lib/libcurses/screen/whline.c @@ -0,0 +1,72 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sys/types.h> +#include <stdlib.h> +#include "curses_inc.h" + +int +whline(WINDOW *win, chtype horch, int num_chars) +{ + short cury = win->_cury, curx = win->_curx; + chtype a, *fp = &(win->_y[cury][curx]); + + if (num_chars <= 0) + return (ERR); + + if (num_chars > win->_maxx - curx + 1) + num_chars = win->_maxx - curx + 1; + if (horch == 0) + horch = ACS_HLINE; + a = _ATTR(horch); + horch = _WCHAR(win, horch) | a; + memSset(fp, horch | win->_attrs, num_chars); + if (curx < win->_firstch[cury]) + win->_firstch[cury] = curx; + if ((curx += (num_chars - 1)) > win->_lastch[cury]) + win->_lastch[cury] = curx; + win->_flags |= _WINCHANGED; + + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/winch.c b/usr/src/lib/libcurses/screen/winch.c new file mode 100644 index 0000000000..db880e0c16 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winch.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +chtype +winch(WINDOW *win) +{ + return (win->_y[win->_cury][win->_curx]); +} diff --git a/usr/src/lib/libcurses/screen/winchnstr.c b/usr/src/lib/libcurses/screen/winchnstr.c new file mode 100644 index 0000000000..55c8a6d589 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winchnstr.c @@ -0,0 +1,92 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Read in ncols worth of data from window win and assign the + * chars to string. NULL terminate string upon completion. + * Return the number of chtypes copied. + */ + +int +winchnstr(WINDOW *win, chtype *string, int ncols) +{ + chtype *ptr = &(win->_y[win->_cury][win->_curx]); + int counter = 0; + int maxcols = win->_maxx - win->_curx; + int eucw, scrw, s; + chtype rawc, attr, wc; + + if (ncols < 0) + ncols = MAXINT; + + while (ISCBIT(*ptr)) { + ptr--; + maxcols++; + } + + while ((counter < ncols) && maxcols > 0) { + eucw = mbeucw((int) RBYTE(*ptr)); + scrw = mbscrw((int) RBYTE(*ptr)); + + if (counter + eucw > ncols) + break; + for (s = 0; s < scrw; s++, maxcols--, ptr++) { + attr = _ATTR(*ptr); + rawc = _CHAR(*ptr); + if ((wc = RBYTE(rawc)) == MBIT) + continue; + *string++ = wc | attr; + counter++; + if ((wc = LBYTE(rawc) | MBIT) == MBIT) + continue; + *string++ = wc | attr; + counter++; + } + } + if (counter < ncols) + *string = (chtype) 0; + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/winchstr.c b/usr/src/lib/libcurses/screen/winchstr.c new file mode 100644 index 0000000000..0633672057 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winchstr.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +winchstr(WINDOW *win, chtype *str) +{ + return (winchnstr(win, str, MAXINT)); +} diff --git a/usr/src/lib/libcurses/screen/winnstr.c b/usr/src/lib/libcurses/screen/winnstr.c new file mode 100644 index 0000000000..c12e88f047 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winnstr.c @@ -0,0 +1,100 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Copy n chars in window win from current cursor position to end + * of window into char buffer str. Return the number of chars copied. + */ + +int +winnstr(WINDOW *win, char *str, int ncols) +{ + int counter = 0; + int cy = win->_cury; + chtype *ptr = &(win->_y[cy][win->_curx]), + *pmax = &(win->_y[cy][win->_maxx]); + chtype wc; + int eucw, scrw, s; + + + while (ISCBIT(*ptr)) + ptr--; + + if (ncols < -1) + ncols = MAXINT; + + while (counter < ncols) { + scrw = mbscrw((int) RBYTE(*ptr)); + eucw = mbeucw((int) RBYTE(*ptr)); + if (counter + eucw > ncols) + break; + + for (s = 0; s < scrw; s++, ptr++) { + if ((wc = RBYTE(*ptr)) == MBIT) + continue; + /* LINTED */ + *str++ = (char) wc; + counter++; + if ((wc = LBYTE(*ptr) | MBIT) == MBIT) + continue; + /* LINTED */ + *str++ = (char) wc; + counter++; + } + + if (ptr >= pmax) { + if (++cy == win->_maxy) + break; + + ptr = &(win->_y[cy][0]); + pmax = ptr + win->_maxx; + } + } + if (counter < ncols) + *str = '\0'; + + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/winnwstr.c b/usr/src/lib/libcurses/screen/winnwstr.c new file mode 100644 index 0000000000..fa937d4004 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winnwstr.c @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Copy n chars(wchar_t) in window win from current cursor position to end + * of window into char buffer str. Return the number of chars copied. + */ + +int +winnwstr(WINDOW *win, wchar_t *wstr, int ncols) +{ + int counter = 0; + int cy = win->_cury; + chtype *ptr = &(win->_y[cy][win->_curx]), + *pmax = &(win->_y[cy][win->_maxx]); + wchar_t wc, *cp; + int scrw, s; + char cbuf[CSMAX+1]; + + + while (ISCBIT(*ptr)) + ptr--; + + if (ncols < -1) + ncols = MAXINT; + + while (counter < ncols) { + wc = RBYTE(*ptr); + scrw = mbscrw((int) wc); + (void) mbeucw((int) wc); + /* LINTED */ + cp = (wchar_t *)cbuf; + for (s = 0; s < scrw; s++, ptr++) { + if ((wc = RBYTE(*ptr)) == MBIT) + continue; + *cp++ = wc; + if ((wc = LBYTE(*ptr) | MBIT) == MBIT) + continue; + *cp++ = wc; + } + *cp = (char)0; + + if (_curs_mbtowc(&wc, cbuf, CSMAX) <= 0) + break; + + *wstr++ = wc; + counter++; + + if (ptr >= pmax) { + if (++cy == win->_maxy) + break; + + ptr = &(win->_y[cy][0]); + pmax = ptr + win->_maxx; + } + } + if (counter < ncols) + *wstr = (wchar_t)0; + + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/winsch.c b/usr/src/lib/libcurses/screen/winsch.c new file mode 100644 index 0000000000..aa4ad13a24 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winsch.c @@ -0,0 +1,130 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" +#include <ctype.h> + +/* Insert a character at (curx, cury). */ + +int +winsch(WINDOW *win, chtype c) +{ + short curx = win->_curx; + int n, cury = win->_cury; + chtype *wcp, a; + int rv; + + a = _ATTR(c); + c &= A_CHARTEXT; + + rv = OK; + win->_insmode = TRUE; + if (_scrmax > 1 && (rv = _mbvalid(win)) == ERR) + goto done; + /* take care of multi-byte characters */ + if (_mbtrue && ISMBIT(c)) { + rv = _mbaddch(win, A_NORMAL, RBYTE(c)); + goto done; + } + win->_nbyte = -1; + curx = win->_curx; + + /* let waddch() worry about these */ + if (c == '\r' || c == '\b') + return (waddch(win, c)); + + /* with \n, in contrast to waddch, we don't clear-to-eol */ + if (c == '\n') { + if (cury >= (win->_maxy-1) || cury == win->_bmarg) + return (wscrl(win, 1)); + else { + win->_cury++; + win->_curx = 0; + return (OK); + } + } + + /* with tabs or control characters, we have to do more */ + if (c == '\t') { + n = (TABSIZE - (curx % TABSIZE)); + if ((curx + n) >= win->_maxx) + n = win->_maxx - curx; + c = ' '; + } else { + if (iscntrl((int) c) != 0) { + if (curx >= win->_maxx-1) + return (ERR); + n = 2; + } else + n = 1; + } + + /* shift right */ + wcp = win->_y[cury] + curx; + if ((rv = _mbinsshift(win, n)) == ERR) + goto done; + + /* insert new control character */ + if (c < ' ' || c == _CTRL('?')) { + *wcp++ = '^' | win->_attrs | a; + *wcp = _UNCTRL(c) | win->_attrs | a; + } else { + /* normal characters */ + c = _WCHAR(win, c) | a; + for (; n > 0; --n) + *wcp++ = c; + } + +done: + if (curx < win->_firstch[cury]) + win->_firstch[cury] = curx; + win->_lastch[cury] = win->_maxx-1; + + win->_flags |= _WINCHANGED; + + if (win->_sync) + wsyncup(win); + + return ((rv == OK && win->_immed) ? wrefresh(win) : rv); +} diff --git a/usr/src/lib/libcurses/screen/winsdelln.c b/usr/src/lib/libcurses/screen/winsdelln.c new file mode 100644 index 0000000000..87aa914d32 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winsdelln.c @@ -0,0 +1,212 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <string.h> +#include "curses_inc.h" + +/* + * Insert/delete lines + * id < 0 : number of lines to delete + * id > 0 : number of lines to insert + */ + +int +winsdelln(WINDOW *win, int id) +{ + int endy, endx, to, fr, num_lines, dir; + chtype *sw; + char *mk; + bool savimmed, savesync; + short x, y, quick, *begch, *endch; +#ifdef _VR3_COMPAT_CODE + /* LINTED */ + void (*update_ptr)(); + + /* + * Null out the update pointer so that in wclrtoeol we do not + * update the _y16 area but we wait till the bottom of this + * function to do it in one fell swoop. + */ + + if (_y16update) { + update_ptr = _y16update; + _y16update = NULL; + } else + update_ptr = NULL; +#endif /* _VR3_COMPAT_CODE */ + + if ((win->_cury >= win->_tmarg) && (win->_cury <= win->_bmarg)) + endy = win->_bmarg + 1; + else + endy = win->_maxy; + + if (id < 0) { + /* + * Check that the amount of lines to delete aren't larger + * than the window. We save num_lines only so that we + * don't have to re-compute if the if comes out true. + */ + + if ((num_lines = win->_cury - endy) > id) + id = num_lines; + + /* + * "fr" is the line that we are coming "fr"om and + * moving "to" the new place. This is the offset which + * we have to re-align our pointers by. + * We want to start setting the current line's pointer + * to point to the offset's line. We want to move line "fr" + * to line "to". + */ + + to = win->_cury; + fr = to - id; + num_lines = endy - fr; + dir = 1; + } else { + /* can't insert more lines than are in the region */ + if ((num_lines = endy - win->_cury) < id) + id = num_lines; + + to = endy - 1; + fr = to - id; + num_lines = fr - (win->_cury - 1); + dir = -1; + } + + /* + * If this window has no parents or children, then we can manipulate + * pointers to simulate insert/delete line. Otherwise, + * to propogate the changes to parents and siblings + * we have to memcpy the text around. + * + * Set quick to tell us which we have to do. + */ + quick = ((win->_ndescs <= 0) && (win->_parent == NULL)); + + begch = win->_firstch; + endch = win->_lastch; + endx = win->_maxx; + + for (; num_lines > 0; num_lines--, to += dir, fr += dir) { + /* can be done quickly */ + if (quick) { + sw = win->_y[to]; + win->_y[to] = win->_y[fr]; + win->_y[fr] = sw; + if ((win == curscr) && _MARKS != NULL) { + mk = _MARKS[to]; + _MARKS[to] = _MARKS[fr]; + _MARKS[fr] = mk; + + /* for color terminal do the same for */ + /* color marks */ + + if (_COLOR_MARKS != NULL) { + mk = _COLOR_MARKS[to]; + _COLOR_MARKS[to] = _COLOR_MARKS[fr]; + _COLOR_MARKS[fr] = mk; + } + } + } else + /* slow update */ + (void) memcpy((char *) win->_y[to], (char *) + win->_y[fr], (endx * sizeof (chtype))); + + + /* + * If this is curscr, the firstch[] and lastch[] + * arrays contain blank information. + */ + + if (win == curscr) { + begch[to] = begch[fr]; + endch[to] = endch[fr]; + _CURHASH[to] = _CURHASH[fr]; + } else { + /* regular window, update the change structure */ + begch[to] = 0; + endch[to] = endx - 1; + } + } + + /* clear the insert/delete lines */ + if (id < 0) + num_lines = endy - to; + else + num_lines = to - (win->_cury - 1); + + if (num_lines > 0) { /* Is this if needed ? */ + savimmed = win->_immed; + savesync = win->_sync; + win->_immed = win->_sync = FALSE; + x = win->_curx; + y = win->_cury; + + win->_curx = 0; + for (; num_lines > 0; --num_lines, to += dir) { + /* LINTED */ + win->_cury = (short) to; + (void) wclrtoeol(win); + } + + win->_curx = x; + win->_cury = y; + win->_immed = savimmed; + win->_sync = savesync; + } + win->_flags |= (_WINCHANGED|_WINSDEL); + +#ifdef _VR3_COMPAT_CODE + if (update_ptr) { + _y16update = update_ptr; + (*_y16update)(win, endy - y, endx, y, 0); + } +#endif /* _VR3_COMPAT_CODE */ + + if (win->_sync) + wsyncup(win); + + return ((win != curscr && savimmed) ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/winsnstr.c b/usr/src/lib/libcurses/screen/winsnstr.c new file mode 100644 index 0000000000..e20acd87a0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winsnstr.c @@ -0,0 +1,168 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Insert to 'win' at most n chars of a string + * starting at (cury, curx). However, if n <= 0, + * insert the entire string. + * \n, \t, \r, \b are treated in the same way + * as other control chars. + */ + +int +winsnstr(WINDOW *win, char *tsp, int n) +{ + chtype *wcp; + int x, cury, endx, maxx, len; + bool savscrl, savsync, savimmed; + short savx, savy; + unsigned char *sp = (unsigned char *)tsp; + + /* only insert at the start of a character */ + win->_nbyte = -1; + win->_insmode = TRUE; + if (_scrmax > 1 && _mbvalid(win) == ERR) + return (ERR); + + if (n < 0) + n = MAXINT; + + /* compute total length of the insertion */ + endx = win->_curx; + maxx = win->_maxx; + for (x = 0; sp[x] != '\0' && x < n && endx < maxx; ++x) { + len = (sp[x] < ' '|| sp[x] == _CTRL('?')) ? 2 : 1; + + if (ISMBIT(sp[x])) { + int m, k, ty; + chtype c; + + /* see if the entire character is defined */ + c = RBYTE(sp[x]); + ty = TYPE(c); + m = x + cswidth[ty] - (ty == 0 ? 1 : 0); + for (k = x + 1; sp[k] != '\0' && k <= m; ++k) { + c = RBYTE(sp[k]); + if (TYPE(c) != 0) + break; + } + if (k <= m) + break; + /* recompute # of columns used */ + len = _curs_scrwidth[ty]; + /* skip an appropriate number of bytes */ + x = m; + } + + if ((endx += len) > maxx) { + endx -= len; + break; + } + } + + /* length of chars to be shifted */ + if ((len = endx - win->_curx) <= 0) + return (ERR); + + /* number of chars insertible */ + n = x; + + /* shift data */ + cury = win->_cury; + + if (_mbinsshift(win, len) == ERR) + return (ERR); + + /* insert new data */ + wcp = win->_y[cury] + win->_curx; + + /* act as if we are adding characters */ + savx = win->_curx; + savy = win->_cury; + win->_insmode = FALSE; + savscrl = win->_scroll; + savimmed = win->_immed; + savsync = win->_sync; + win->_scroll = win->_sync; + + for (; n > 0; --n, ++sp) { + /* multi-byte characters */ + if (_mbtrue && ISMBIT(*sp)) { + (void) _mbaddch(win, A_NORMAL, RBYTE(*sp)); + wcp = win->_y[cury] + win->_curx; + continue; + } + if (_scrmax > 1 && ISMBIT(*wcp)) + (void) _mbclrch(win, cury, win->_curx); + /* single byte character */ + win->_nbyte = -1; + + if (*sp < ' ' || *sp == _CTRL('?')) { + *wcp++ = _CHAR('^') | win->_attrs; + *wcp = _CHAR(_UNCTRL(*sp)) | win->_attrs; + } else + *wcp = _CHAR(*sp) | win->_attrs; + win->_curx += (*sp < ' ' || *sp == _CTRL('?')) ? 2 : 1; + ++wcp; + } + win->_curx = savx; + win->_cury = savy; + + /* update the change structure */ + if (win->_firstch[cury] > win->_curx) + win->_firstch[cury] = win->_curx; + win->_lastch[cury] = maxx - 1; + + win->_flags |= _WINCHANGED; + + win->_scroll = savscrl; + win->_sync = savsync; + win->_immed = savimmed; + + if (win->_sync) + wsyncup(win); + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/winsnwstr.c b/usr/src/lib/libcurses/screen/winsnwstr.c new file mode 100644 index 0000000000..2f55027ae3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winsnwstr.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Insert to 'win' at most n 'characters' of code starting at(cury, curx) + */ +int +winsnwstr(WINDOW *win, wchar_t *code, int n) +{ + char *sp; + + /* translate the process code to character code */ + if ((sp = _strcode2byte(code, NULL, n)) == NULL) + return (ERR); + + /* now call winsnstr to do the real work */ + return (winsnstr(win, sp, -1)); +} diff --git a/usr/src/lib/libcurses/screen/winstr.c b/usr/src/lib/libcurses/screen/winstr.c new file mode 100644 index 0000000000..4bbb8668b0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winstr.c @@ -0,0 +1,79 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +winstr(WINDOW *win, char *str) +{ + int counter = 0; + int cy = win->_cury; + chtype *ptr = &(win->_y[cy][win->_curx]), + *pmax = &(win->_y[cy][win->_maxx]); + chtype *p1st = &(win->_y[cy][0]); + chtype wc; + int sw, s; + + while (ISCBIT(*ptr) && (p1st < ptr)) + ptr--; + + while (ptr < pmax) { + wc = RBYTE(*ptr); + sw = mbscrw((int) wc); + (void) mbeucw((int) wc); + for (s = 0; s < sw; s++, ptr++) { + if ((wc = RBYTE(*ptr)) == MBIT) + continue; + /* LINTED */ + str[counter++] = (char) wc; + if ((wc = LBYTE(*ptr) | MBIT) == MBIT) + continue; + /* LINTED */ + str[counter++] = (char) wc; + } + } + str[counter] = '\0'; + + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/winswch.c b/usr/src/lib/libcurses/screen/winswch.c new file mode 100644 index 0000000000..17608e7273 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winswch.c @@ -0,0 +1,60 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Insert to 'win' a process code at(curx, cury). + */ +int +winswch(WINDOW *win, chtype c) +{ + int i, width; + char buf[CSMAX]; + chtype a; + wchar_t code; + a = c & A_WATTRIBUTES; + code = c & A_WCHARTEXT; + + /* translate the process code to character code */ + if ((width = _curs_wctomb(buf, code & TRIM)) < 0) + return (ERR); + + /* now call winsch to do the real work */ + for (i = 0; i < width; ++i) + if (winsch(win, a|(unsigned char)buf[i]) == ERR) + return (ERR); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/winwch.c b/usr/src/lib/libcurses/screen/winwch.c new file mode 100644 index 0000000000..2b3cf193d3 --- /dev/null +++ b/usr/src/lib/libcurses/screen/winwch.c @@ -0,0 +1,52 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Get a process code at(curx, cury). + */ +chtype +winwch(WINDOW *win) +{ + wchar_t wchar; + chtype a; + + a = (win->_y[win->_cury][win->_curx]) & A_WATTRIBUTES; + + (void) _curs_mbtowc(&wchar, wmbinch(win, win->_cury, win->_curx), + sizeof (wchar_t)); + return (a | wchar); +} diff --git a/usr/src/lib/libcurses/screen/winwchnstr.c b/usr/src/lib/libcurses/screen/winwchnstr.c new file mode 100644 index 0000000000..fbd8de27aa --- /dev/null +++ b/usr/src/lib/libcurses/screen/winwchnstr.c @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Read in ncols worth of data from window win and assign the + * chars to string. NULL terminate string upon completion. + * Return the number of chtypes copied. + */ + +int +winwchnstr(WINDOW *win, chtype *string, int ncols) +{ + chtype *ptr = &(win->_y[win->_cury][win->_curx]); + int counter = 0; + int maxcols = win->_maxx - win->_curx; + int scrw, s, wc; + char *mp, mbbuf[CSMAX+1]; + wchar_t wch; + chtype rawc; + chtype attr; + + if (ncols < 0) + ncols = MAXINT; + + while (ISCBIT(*ptr)) { + ptr--; + maxcols++; + } + + while ((counter < ncols) && maxcols > 0) { + attr = *ptr & A_WATTRIBUTES; + rawc = *ptr & A_WCHARTEXT; + (void) mbeucw((int)RBYTE(rawc)); + scrw = mbscrw((int)RBYTE(rawc)); + for (mp = mbbuf, s = 0; s < scrw; s++, maxcols--, ptr++) { + if ((wc = (int)RBYTE(rawc)) == MBIT) + continue; + /* LINTED */ + *mp++ = (char) wc; + if ((wc = (int)(LBYTE(rawc) | MBIT)) == MBIT) + continue; + /* LINTED */ + *mp++ = (char) wc; + } + *mp = '\0'; + if (_curs_mbtowc(&wch, mbbuf, CSMAX) <= 0) + break; + *string++ = wch | attr; + counter++; + } + if (counter < ncols) + *string = (chtype) 0; + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/winwstr.c b/usr/src/lib/libcurses/screen/winwstr.c new file mode 100644 index 0000000000..eeecb94d4b --- /dev/null +++ b/usr/src/lib/libcurses/screen/winwstr.c @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + + +/* + * Copyright (c) 1997, by Sun Microsystems, Inc. + * All rights reserved. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +winwstr(WINDOW *win, wchar_t *wstr) +{ + int counter = 0; + int cy = win->_cury; + chtype *ptr = &(win->_y[cy][win->_curx]), + *pmax = &(win->_y[cy][win->_maxx]); + chtype *p1st = &(win->_y[cy][0]); + wchar_t wc; + int sw, s; + char *cp, cbuf[CSMAX+1]; + + while (ISCBIT(*ptr) && (p1st < ptr)) + ptr--; + + while (ptr < pmax) { + wc = RBYTE(*ptr); + sw = mbscrw((int)wc); + (void) mbeucw((int)wc); + + cp = cbuf; + for (s = 0; s < sw; s++, ptr++) { + if ((wc = RBYTE(*ptr)) == MBIT) + continue; + /* LINTED */ + *cp++ = (char) wc; + if ((wc = LBYTE(*ptr) | MBIT) == MBIT) + continue; + /* LINTED */ + *cp++ = (char) wc; + } + *cp = '\0'; + + if (_curs_mbtowc(&wc, cbuf, CSMAX) <= 0) + break; + + *wstr++ = wc; + } + + *wstr = (wchar_t)0; + + return (counter); +} diff --git a/usr/src/lib/libcurses/screen/wmove.c b/usr/src/lib/libcurses/screen/wmove.c new file mode 100644 index 0000000000..9a042fff17 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wmove.c @@ -0,0 +1,74 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* This routine moves the cursor to the given point */ + +int +wmove(WINDOW *win, int y, int x) +{ +#ifdef DEBUG + if (outf) { + fprintf(outf, "MOVE to win "); + if (win == stdscr) + fprintf(outf, "stdscr "); + else + fprintf(outf, "%o ", win); + fprintf(outf, "(%d, %d)\n", y, x); + } +#endif /* DEBUG */ + if (x < 0 || y < 0 || x >= win->_maxx || y >= win->_maxy) + return (ERR); + + if (y != win->_cury || x != win->_curx) + win->_nbyte = -1; + + /* LINTED */ + win->_curx = (short) x; + /* LINTED */ + win->_cury = (short) y; + win->_flags |= _WINMOVED; + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wmovenextch.c b/usr/src/lib/libcurses/screen/wmovenextch.c new file mode 100644 index 0000000000..4e569677ea --- /dev/null +++ b/usr/src/lib/libcurses/screen/wmovenextch.c @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1988 by Sun Microsystems, Inc. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wmovenextch(WINDOW *win) +/* + * wmovenextch --- moves the cursor forward to the next char of char + * cursor is currently on. This is used to move forward over a multi-column + * character. When the cursor is on a character at the right-most + * column, the cursor will stay there. + */ +{ + chtype *_yy; + short x; + + _yy = win->_y[win->_cury]; + x = win->_curx; + + if (x + 1 > win->_maxx) /* Can't move any more. */ + return (ERR); + + ++x; + for (; ; ) { + if (x >= win->_maxx) /* No more space.. */ + return (ERR); + if (ISCBIT(_yy[x])) { + ++x; + } else { + break; + } + } + + win->_curx = x; + win->_flags |= _WINMOVED; + return (win->_immed ? wrefresh(win): OK); +} diff --git a/usr/src/lib/libcurses/screen/wmoveprevch.c b/usr/src/lib/libcurses/screen/wmoveprevch.c new file mode 100644 index 0000000000..16d4f965e0 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wmoveprevch.c @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 1988 by Sun Microsystems, Inc. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wmoveprevch(WINDOW *win) +/* + * wmoveprevch --- moves the cursor back to the previous char of char + * cursor is currently on. This is used to move back over a multi-column + * character. When the cursor is on a character at the left-most + * column, the cursor will stay there. + */ +{ + chtype *_yy; + short x; + + (void) wadjcurspos(win); + x = win->_curx; + if (x == 0) /* Can't back up any more. */ + return (ERR); + _yy = win->_y[win->_cury]; + --x; + while ((x > 0) && (ISCBIT(_yy[x]))) + --x; + win->_curx = x; + win->_flags |= _WINMOVED; + return (win->_immed ? wrefresh(win): OK); +} diff --git a/usr/src/lib/libcurses/screen/wnoutref.c b/usr/src/lib/libcurses/screen/wnoutref.c new file mode 100644 index 0000000000..3f9dd35054 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wnoutref.c @@ -0,0 +1,206 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <string.h> +#include <sys/types.h> +#include "curses_inc.h" + +/* Like refresh but does not output */ + +int +wnoutrefresh(WINDOW *win) +{ + short *bch, *ech, *sbch, *sech; + chtype **wcp, **scp, *wc, *sc; + int *hash; + short y, x, xorg, yorg, scrli, scrco, + boty, sminy, smaxy, minx, maxx, lo, hi; + bool doall; + + if (win->_parent) + wsyncdown(win); + + doall = win->_clear; + + sminy = SP->Yabove; + smaxy = sminy + LINES; + scrli = curscr->_maxy; + scrco = curscr->_maxx; + + yorg = win->_begy + win->_yoffset; + xorg = win->_begx; + + /* save flags, cursor positions */ + SP->virt_scr->_leave = win->_leave; + if ((!win->_leave && (win->_flags & (_WINCHANGED | _WINMOVED))) && + ((y = win->_cury + yorg) >= 0) && (y < scrli) && + ((x = win->_curx + xorg) >= 0) && (x < scrco)) { + _virtscr->_cury = y; + _virtscr->_curx = x; + } + if (!(win->_use_idc)) + _virtscr->_use_idc = FALSE; + if (win->_use_idl) + _virtscr->_use_idl = TRUE; + if (win->_clear) { + _virtscr->_clear = TRUE; + win->_clear = FALSE; + win->_flags |= _WINCHANGED; + } + + if (!(win->_flags & _WINCHANGED)) + goto done; + + /* region to update */ + boty = win->_maxy+yorg; + if (yorg >= sminy && yorg < smaxy && boty >= smaxy) + boty = smaxy; + else + if (boty > scrli) + boty = scrli; + boty -= yorg; + + minx = 0; + if ((maxx = win->_maxx+xorg) > scrco) + maxx = scrco; + maxx -= xorg + 1; + + /* update structure */ + bch = win->_firstch; + ech = win->_lastch; + wcp = win->_y; + + hash = _VIRTHASH + yorg; + sbch = _virtscr->_firstch + yorg; + sech = _virtscr->_lastch + yorg; + scp = _virtscr->_y + yorg; + + /* first time around, set proper top/bottom changed lines */ + if (curscr->_sync) { + _VIRTTOP = scrli; + _VIRTBOT = -1; + } + + /* update each line */ + for (y = 0; y < boty; ++y, ++hash, ++bch, ++ech, ++sbch, + ++sech, ++wcp, ++scp) { + if (!doall && *bch == _INFINITY) + continue; + + lo = (doall || *bch == _REDRAW || *bch < minx) ? minx : *bch; + hi = (doall || *bch == _REDRAW || *ech > maxx) ? maxx : *ech; + + wc = *wcp; + sc = *scp; + /* adjust lo and hi so they contain whole characters */ + if (_scrmax > 1) { + if (ISCBIT(wc[lo])) { + for (x = lo - 1; x >= minx; --x) + if (!ISCBIT(wc[x])) + break; + if (x < minx) { + for (x = lo+1; x <= maxx; ++x) + if (!ISCBIT(wc[x])) + break; + if (x > maxx) + goto nextline; + } + lo = x; + } + if (ISMBIT(wc[hi])) { + int w; + unsigned char rb; + for (x = hi; x >= lo; --x) + if (!ISCBIT(wc[x])) + break; + /* LINTED */ + rb = (unsigned char) RBYTE(wc[x]); + w = _curs_scrwidth[TYPE(rb)]; + hi = (x+w) <= maxx+1 ? x+w-1 : x; + } + } + + if (hi < lo) + continue; + + /* clear partial multi-chars about to be overwritten */ + if (_scrmax > 1) { + if (ISMBIT(sc[lo + xorg])) + (void) _mbclrch(_virtscr, y + yorg, lo + xorg); + if (ISMBIT(sc[hi + xorg])) + (void) _mbclrch(_virtscr, y + yorg, hi + xorg); + } + + /* update the change structure */ + if (*bch == _REDRAW || *sbch == _REDRAW) + *sbch = _REDRAW; + else { + if (*sbch > lo+xorg) + *sbch = lo+xorg; + if (*sech < hi+xorg) + *sech = hi+xorg; + } + if ((y + yorg) < _VIRTTOP) + _VIRTTOP = y+yorg; + if ((y + yorg) > _VIRTBOT) + _VIRTBOT = y + yorg; + + /* update the image */ + wc = *wcp + lo; + sc = *scp + lo + xorg; + (void) memcpy((char *) sc, (char *) wc, (size_t) + (((hi - lo) + 1) * sizeof (chtype))); + + /* the hash value of the line */ + *hash = _NOHASH; + +nextline: + *bch = _INFINITY; + *ech = -1; + } + +done: + _virtscr->_flags |= _WINCHANGED; + win->_flags &= ~(_WINCHANGED | _WINMOVED | _WINSDEL); + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/wprintw.c b/usr/src/lib/libcurses/screen/wprintw.c new file mode 100644 index 0000000000..dbea0f77c6 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wprintw.c @@ -0,0 +1,66 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * printw and friends + * + */ + +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine implements a printf on the given window. + */ +/*VARARGS*/ +int +wprintw(WINDOW *win, ...) +{ + va_list ap; + char * fmt; + + va_start(ap, win); + fmt = va_arg(ap, char *); + return (vwprintw(win, fmt, ap)); +} diff --git a/usr/src/lib/libcurses/screen/wredrawln.c b/usr/src/lib/libcurses/screen/wredrawln.c new file mode 100644 index 0000000000..1b8d0e9b85 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wredrawln.c @@ -0,0 +1,77 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * This routine indicates to curses that a screen line is garbaged and + * should be thrown away before having anything written over the top of it. + * It could be used for programs such as editors which want a command to + * redraw just a single line. Such a command could be used in cases where + * there is a noisy line and redrawing the entire screen would be subject + * to even more noise. Just redrawing the single line gives some semblance + * of hope that it would show up unblemished. + * + * This is a more refined version of clearok + */ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wredrawln(WINDOW *win, int begline, int numlines) +{ + short *firstch, *efirstch; + + if (numlines <= 0) + return (ERR); + if (begline < 0) + begline = 0; + if (begline + numlines > win->_maxy) + numlines = win->_maxy - begline; + + firstch = win->_firstch + begline; + efirstch = firstch + numlines; + while (firstch < efirstch) + *firstch++ = _REDRAW; + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wrefresh.c b/usr/src/lib/libcurses/screen/wrefresh.c new file mode 100644 index 0000000000..41a589fbe8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wrefresh.c @@ -0,0 +1,1251 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include <stdlib.h> +#include <string.h> +#include "curses_inc.h" + +/* + * Make the screen look like "win" over the area covered by win. + * This routine may use insert/delete char/line and scrolling-region. + * win : the window being updated + */ + +extern int outchcount; + +static void _updateln(int), _turn_off_background(void), + _setmark1(int, int, chtype *), + _setmark2(int, int, chtype *), _rmargin(int), + _useceod(int, int); +static int _useidch(chtype *, chtype *, int, int, int *), + _prefix(chtype *, chtype *, int, int, int *), + _getceod(int, int); + +static short cy, cx, /* current cursor coord */ + scrli, /* actual screen lines */ + scrco; /* actual screen columns */ +static char **marks; /* the mark table for cookie terminals */ +static char **color_marks; /* color mark table for cookie terminals */ + +#define _ISMARK1(y, x) (marks[y][x / BITSPERBYTE] & (1 << (x % BITSPERBYTE))) +#define _ISMARK2(y, x) (color_marks ? (color_marks[y][x / BITSPERBYTE] & \ + (1 << (x % BITSPERBYTE))) : FALSE) + +#define _VIDEO(c) ((c) & A_ATTRIBUTES & ~A_COLOR) +#define _COLOR(c) ((c) & A_COLOR) + +#ifdef _VR2_COMPAT_CODE +extern char _endwin; +#endif /* _VR2_COMPAT_CODE */ + +int +wrefresh(WINDOW *win) +{ + + short *bnsch, *ensch; + SLK_MAP *slk; + int wx, wy, nc, boty, clby, idby, *hs, curwin; + + curwin = (win == curscr); + + /* don't allow curscr refresh if the screen was just created */ + + if (curwin && curscr->_sync) + return (OK); + + /* go thru _stdbody */ + if (!curwin && (win != _virtscr)) + (void) wnoutrefresh(win); + + /* if there is typeahead */ + if ((_INPUTPENDING = _chkinput()) == TRUE) { + if (curwin) + curscr->_clear = TRUE; + return (OK); + } + + if (curwin || curscr->_clear) + _virtscr->_clear = TRUE; + + /* save curscr cursor coordinates */ + cy = curscr->_cury; + cx = curscr->_curx; + + /* to simplify code in some cases */ + marks = _MARKS; + color_marks = _COLOR_MARKS; + scrli = curscr->_maxy; + scrco = curscr->_maxx; + slk = SP->slk; + + outchcount = 0; + + /* make sure we're in program mode */ + if (SP->fl_endwin) { + /* If endwin is equal to 2 it means we just did a newscreen. */ + if (SP->fl_endwin == TRUE) { + (void) reset_prog_mode(); + if (SP->kp_state) + (void) tputs(keypad_xmit, 1, _outch); + if (slk) + (*_do_slk_tch)(); + if (SP->fl_meta) + (void) tputs(meta_on, 1, _outch); + if (cur_term->_cursorstate != 1) + _PUTS(cur_term->cursor_seq[cur_term-> + _cursorstate], 0); + } + _PUTS(enter_ca_mode, 1); + (void) tputs(ena_acs, 1, _outch); + + if (exit_attribute_mode) + _PUTS(tparm_p0(exit_attribute_mode), 1); + else + /* + * If there is no exit_attribute mode, then vidupdate + * could only possibly turn off one of the below three + * so that's all we ask it turn off. + */ + vidupdate(A_NORMAL, (A_ALTCHARSET | A_STANDOUT | + A_UNDERLINE), _outch); + + SP->fl_endwin = FALSE; + +#ifdef _VR2_COMPAT_CODE + _endwin = (char) FALSE; +#endif /* _VR2_COMPAT_CODE */ + } + + /* clear the screen if required */ + if (_virtscr->_clear) { +/* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + _PUTS(clear_screen, scrli); + cy = cx = curscr->_curx = curscr->_cury = 0; + + /* _sync indicates that this a new screen */ + if (!curscr->_sync) + (void) werase(curscr); + else { + nc = scrco / BITSPERBYTE - (scrco % + BITSPERBYTE ? 0 : 1); + wy = scrli - 1; + bnsch = _BEGNS; ensch = _ENDNS; + hs = _CURHASH; + for (; wy >= 0; --wy) { + *bnsch++ = scrco; + *ensch++ = -1; + *hs++ = 0; + if (marks) + for (wx = nc; wx >= 0; --wx) + marks[wy][wx] = 0; + } + } + + _virtscr->_clear = curscr->_sync = curscr->_clear = FALSE; + if (slk) + (*_do_slk_tch)(); + + /* pretend _virtscr has been totally changed */ + (void) wtouchln(_virtscr, 0, scrli, -1); + _VIRTTOP = 0; + _VIRTBOT = scrli - 1; + + /* will not do clear-eod or ins/del lines */ + clby = idby = scrli; + } else + clby = idby = -1; + + /* Software soft labels; if _changed == 2, slk's are in clear mode. */ + if (slk && slk->_win && (slk->_changed == TRUE)) + (*_do_slk_noref)(); + + /* do line updating */ + _virtscr->_clear = FALSE; + wy = _VIRTTOP; + boty = _VIRTBOT + 1; + bnsch = _virtscr->_firstch + wy; + ensch = _virtscr->_lastch + wy; + + for (; wy < boty; ++wy, ++bnsch, ++ensch) { + /* this line is up-to-date */ + if (*bnsch >= scrco) + goto next; + + /* there is type-ahead */ + if (!curwin && (_INPUTPENDING = _chkinput()) == TRUE) { + /* LINTED */ + _VIRTTOP = (short) wy; + goto done; + } + + if (clby < 0) { + /* now we have to work, check for ceod */ + clby = _getceod(wy, boty); + + /* check for insert/delete lines */ + if (_virtscr->_use_idl) + idby = (*_setidln)(); + } + + /* try clear-to-eod */ + if (wy == clby) + _useceod(wy, boty); + + /* try ins/del lines */ + if (wy == idby) { + curscr->_cury = cy; + curscr->_curx = cx; + (*_useidln)(); + cy = curscr->_cury; + cx = curscr->_curx; + } + + if (*bnsch < scrco) + _updateln(wy); + +next: + *bnsch = _INFINITY; + *ensch = -1; + } + + /* do hardware soft labels; if _changed == 2, */ + /* slk's are in clear mode. */ + if (slk && (slk->_changed == TRUE) && !(slk->_win)) + (*_do_slk_ref)(); + + /* move cursor */ + wy = _virtscr->_cury; + wx = _virtscr->_curx; + if (wy != cy || wx != cx) { + (void) mvcur(cy, cx, wy, wx); + /* LINTED */ + cy = (short) wy; + /* LINTED */ + cx = (short) wx; + } + + /* reset the flags */ + curscr->_clear = FALSE; + _virtscr->_use_idl = FALSE; + _virtscr->_use_idc = TRUE; + _INPUTPENDING = FALSE; + + /* virtual image is now up-to-date */ + _VIRTTOP = scrli; + _VIRTBOT = -1; + +done : + curscr->_cury = cy; + curscr->_curx = cx; + (void) fflush(SP->term_file); + return (outchcount); +} + +/* Shift appropriate portions of a line to leave space for cookies. */ + +static chtype * +_shove(int wy) +{ + chtype *wcp, *cp, prev; + short curx; + int x, cury, didshift; + static chtype *line; + static int length; + + /* allocate space for shifted line */ + if (length < scrco) { + if (line) + free((char *) line); + line = (chtype *) malloc(scrco * sizeof (chtype)); + length = line ? scrco : 0; + } + + /* no space to do it */ + if (!line) + return (_virtscr->_y[wy]); + + prev = A_NORMAL; + cp = line; + wcp = _virtscr->_y[wy]; + curx = _virtscr->_curx; + cury = _virtscr->_cury; + didshift = FALSE; + + for (x = 0; x < scrco; ++x, ++wcp, ++cp) { + if (_ATTR(*wcp) != prev) { + /* use existing blank */ + if (_CHAR(*wcp) == ' ') + *cp = ' ' | _ATTR(*(wcp + 1)); + /* use previous blank */ + else + if ((x > 0) && _CHAR(*(cp - 1)) == ' ') { + *(cp - 1) = ' ' | _ATTR(*wcp); + *cp = *wcp; + } else { + if ((curx >= x) && (cury == wy)) + ++curx; + *cp = ' ' | _ATTR(*wcp); + --wcp; + didshift = TRUE; + } + prev = _ATTR(*cp); + } else + *cp = *wcp; + } + + /* make sure that the end of the line is normal */ + cp = line + scrco - 1; + if (didshift || (_ATTR(*cp) != A_NORMAL) || + ((wy == scrli - 1) && (_ATTR(*(cp - 1)) != A_NORMAL))) { + *cp = didshift ? ' ' : _CHAR(*cp); + if (wy == scrli - 1) + *(cp - 1) = didshift ? ' ' : _CHAR(*(cp - 1)); + } + + if (wy == cury) + _virtscr->_curx = curx >= scrco ? scrco - 1 : curx; + + return (line); +} + +/* + * Update a line. + * Three schemes of coloring are allowed. The first is the usual + * pen-up/pen-down model. The second is the HP26*-like model. + * In this case, colorings are specified by intervals, the left + * side of the interval has the coloring mark, the right side + * has the end-coloring mark. We assume that clear sequences will + * clear ALL marks in the affected regions. The second case is + * signified by the boolean flag ceol_standout_glitch. + * The third case is for terminals that leave visible cookies on + * the screen. This last case is at most an approximation of what + * can be done right. + */ + +static void +_updateln(int wy) +{ + chtype *wcp, *scp, *wp, *sp, wc, sc; + int wx, lastx, x, mtch, idch, blnkx, idcx, video_attrx, + color_attrx, maxi, endns, begns, wx_sav, multi_col; + bool redraw, changed, didcolor, didvideo; + + redraw = (_virtscr->_firstch[wy] == _REDRAW); + endns = _ENDNS[wy]; + begns = _BEGNS[wy]; + + /* easy case */ + if (!redraw && (_virtscr->_lastch[wy] == _BLANK) && (begns >= scrco)) + return; + + /* line images */ + wcp = magic_cookie_glitch <= 0 ? _virtscr->_y[wy] : _shove(wy); + scp = curscr->_y[wy]; + + /* the interval to be updated */ + if (redraw || magic_cookie_glitch >= 0) { + wx = 0; + lastx = scrco; + } else { + wx = _virtscr->_firstch[wy]; + lastx = _virtscr->_lastch[wy] == _BLANK ? scrco : + _virtscr->_lastch[wy] + 1; + } + + /* skip equal parts */ + if (!redraw) { + /* skip the starting equal part */ + wp = wcp + wx; + sp = scp + wx; + for (; wx < lastx; ++wx) + if (*wp++ != *sp++) + break; + if (wx >= lastx) + return; + + /* start update at an entire character */ + for (sp = scp+wx, wp = wcp+wx; wp > wcp; --wp, --sp, --wx) + if (!ISCBIT(*wp) && !ISCBIT(*sp)) + break; + + /* skip the ending equal part */ + wp = wcp + lastx - 1; + sp = scp + lastx - 1; + for (; lastx > wx; --lastx) + if (*wp-- != *sp--) + break; + ++wp; + ++wp; + ++sp; + ++sp; + for (; lastx < scrco; ++wp, ++sp, ++lastx) + if (!ISCBIT(*wp) && !ISCBIT(*sp)) + break; + } + + /* place to do clear-eol */ + if (!clr_eol || endns >= lastx) + blnkx = scrco; + else + if (_virtscr->_lastch[wy] == _BLANK) + blnkx = -1; + else { + for (blnkx = lastx - 1, wp = wcp + blnkx; + blnkx >= wx; --blnkx, --wp) + if (_DARKCHAR(*wp)) + break; + for (sp = scp + blnkx + 1; blnkx < scrco - 1; + ++sp, ++blnkx) + if (!ISCBIT(*sp)) + break; + if (blnkx + _COST(Clr_eol) >= lastx) + blnkx = scrco; + } + + /* on cookie terminals, we may need to do more work */ + if (marks) { + /* video_attrx = color_attrx = scrco; */ + video_attrx = color_attrx = (lastx >= scrco) ? lastx - 1 : + lastx; + + /* find the last video attribute on the line */ + + wp = wcp + video_attrx; + for (; video_attrx >= wx; --video_attrx, --wp) + if (_VIDEO(*wp) != A_NORMAL) + break; + + /* find the last color attribute on the line */ + + if (color_marks) { + wp = wcp + color_attrx; + for (; color_attrx >= wx; --color_attrx, --wp) + if (_COLOR(*wp) != A_NORMAL) + break; + if (color_attrx < lastx) + color_attrx++; + } + if (video_attrx < lastx) + video_attrx++; + + if (video_attrx >= scrco) + --video_attrx; + if (color_marks && color_attrx >= scrco) + --color_attrx; + if (magic_cookie_glitch > 0 && wy == scrli - 1 && + video_attrx == scrco - 1) + --video_attrx; + if (color_marks && magic_cookie_glitch > 0 && + wy == scrli - 1 && color_attrx == scrco - 1) + --color_attrx; + for (wp = wcp+video_attrx; wp >= wcp+wx; --wp) + if (!ISCBIT(*wp)) + break; + } + + /* place for insert/delete chars */ +#define SLACK 4 + if (redraw || (!SP->dchok && !SP->ichok) || !(_virtscr->_use_idc) || + endns < wx || (endns >= lastx && (scrco - lastx) > SLACK)) { + idcx = scrco; + } else + if (!marks) + idcx = -1; + else { + /* on cookie term, only do idch where no attrs */ + /* are used */ + for (idcx = scrco - 1, wp = wcp + idcx; idcx >= wx; + --idcx, --wp) + if (_ATTR(*wp) || _ISMARK1(wy, idcx) || + _ISMARK2(wy, idcx)) + break; + if (idcx >= scrco - SLACK) + idcx = scrco; + } + + if (idcx < lastx && endns >= lastx) + lastx = scrco; + + /* max amount of insert allow */ + if (idcx == scrco || !SP->ichok) + maxi = 0; + else + if (lastx == scrco) + maxi = scrco; + else + maxi = lastx - (endns + 1); + + /* go */ + wcp += wx; + scp += wx; + didvideo = changed = FALSE; + didcolor = (color_marks) ? FALSE : TRUE; + + while (wx < lastx) { + /* skip things that are already right */ + if (!redraw) { + multi_col = 0; + wx_sav = wx; + for (; wx < lastx; ++wx, ++wcp, ++scp) + if (*wcp != *scp) + break; + if (wx >= lastx) + goto done; + for (; wx > wx_sav; --wx, --wcp, --scp) { + if (!ISCBIT(*wcp) && !ISCBIT(*scp)) + break; + multi_col = 1; + } + } + + /* try clear-bol, we'll assume exclusive clr_bol */ + if (!changed && !marks && clr_bol && blnkx > wx && + begns >= wx) { + for (x = wx, wp = wcp; x < lastx; ++x, ++wp) + if (_DARKCHAR(*wp)) + break; + /* clearing only whole screen characters */ + for (sp = scp+(x-wx); x >= wx; --x, --sp) + if (!ISCBIT(*sp)) + break; + x -= 1; + + if ((x - (redraw ? 0 : begns)) > _COST(Clr_bol)) { + (void) mvcur(cy, cx, wy, x); + /* MORE?: colors - mvcur will shuts of */ + /* colors when msgr is not defined */ + +/* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + _PUTS(clr_bol, 1); + /* LINTED */ + cy = (short) wy; + /* LINTED */ + cx = (short) x; + + mtch = x - wx; + (void) memcpy((char *) scp, (char *) wcp, + (mtch * sizeof (chtype))); + wcp += mtch; + scp += mtch; + wx = x; + } + } + + /* screen image is changing */ + changed = TRUE; + + /* move to the point to start refresh */ + if (cy != wy || cx != wx) + (void) mvcur(cy, cx, wy, wx); + /* LINTED */ + cy = (short) wy; + /* LINTED */ + cx = (short) wx; + + /* update screen image */ + while (wx < lastx) { + wc = *wcp; + sc = *scp; + + if (!redraw && !multi_col && wc == sc) + break; + + /* real video attributes */ + if (marks) + curscr->_attrs = _ATTR(sc); + + /* blanks only */ + if (wx > blnkx) { +/* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + _PUTS(clr_eol, 1); + /* LINTED */ + curscr->_curx = (short) wx; + /* LINTED */ + curscr->_cury = (short) wy; + (void) wclrtoeol(curscr); + + if (marks && wx > 0 && _ATTR(*(scp - 1)) != + A_NORMAL) { + _VIDS(A_NORMAL, _ATTR(*(scp - 1))); + if (_VIDEO(*scp - 1)) + _setmark1(wy, wx, NULL); + if (_COLOR(*scp - 1)) + _setmark2(wy, wx, NULL); + } + goto done; + } + + /* try insert/delete chars */ + if (wx > idcx && !ISCBIT(*scp) && + (mtch = _useidch(wcp, scp, lastx - wx, + maxi, &idch))) { + maxi -= idch; + wx += mtch; + scp += mtch; + wcp += mtch; + break; + } + + /* about to output chars, make sure insert */ + /* mode is off */ + if (SP->phys_irm) + _OFFINSERT(); + + /* color and video attributes */ + if (_ATTR(wc) != curscr->_attrs) { + bool color_change = FALSE; + bool video_change = FALSE; + + if (marks) + if (_VIDEO(wc) != _VIDEO(curscr->_attrs)) + video_change = TRUE; + if (color_marks) + if (_COLOR(wc) != _COLOR(curscr->_attrs)) + color_change = TRUE; + + /* the following may occurs when, for */ + /* example the application */ + /* is written for color terminal and then */ + /* run on a monocrome */ + + if (marks && !video_change && !color_change) + goto no_change; + + /* prevent spilling out of line */ + if (marks && !(didcolor && didvideo)) { + if ((video_change && !_ISMARK1(wy, + video_attrx)) || (color_change && + !_ISMARK2(wy, color_attrx))) { + int tempx; + chtype sa = curscr->_attrs; + bool first = FALSE; + bool second = FALSE; + + if (!didvideo && video_change && + !_ISMARK1(wy, video_attrx)) { + didvideo = TRUE; + (void) mvcur(wy, wx, + wy, video_attrx); + _VIDS(_VIDEO(_virtscr->_y[wy] + [video_attrx]), + _VIDEO(_virtscr->_y[wy] + [video_attrx-1])); + _setmark1(wy, video_attrx, + NULL); + first = TRUE; + } + + if (!didcolor && color_change && + !_ISMARK2(wy, color_attrx)) { + didcolor = TRUE; + tempx = first ? video_attrx : wx; + if (tempx != color_attrx) + (void) mvcur(wy, tempx, wy, + color_attrx); + /* + * sc = _COLOR(curscr->_y[wy][color_attrx]); + *_VIDS(sc, (~sc & A_COLOR)); + */ + _VIDS(_COLOR(_virtscr->_y[wy] + [color_attrx]), + _COLOR(_virtscr->_y[wy] + [color_attrx-1])); + _setmark2(wy, color_attrx, NULL); + second = TRUE; + } + (void) mvcur(wy, (second ? color_attrx : + video_attrx), wy, wx); + curscr->_attrs = sa; + } + } + + _VIDS(_ATTR(wc), curscr->_attrs); + + /* on cookie terminals mark the interval */ + if (video_change) + _setmark1(wy, wx, scp); + if (color_change) + _setmark2(wy, wx, scp); + } + + /* end-of-line */ +no_change: + x = 1; + if (_scrmax > 1) + x = _curs_scrwidth[TYPE(RBYTE(wc))]; + if (wx == scrco - x) { + _rmargin(wx); + goto done; + } + + if (transparent_underline && erase_overstrike && + _CHAR(wc) == '_') { + (void) _outch(' '); + (void) mvcur(wy, wx + 1, wy, wx); + } + + /* put out the character */ + (void) _outwch(tilde_glitch && _CHAR(wc) == '~' ? '`' : wc); + + *scp++ = wc; + wcp++; + wx++; + cx++; + /* output entire multi-byte chars */ + while (wx < lastx && ISCBIT(*wcp)) { + (void) _outwch(*wcp); + *scp++ = *wcp++; + wx++; + cx++; + + + + + } + } + } + +done: + if (changed) { + /* update the blank structure */ + for (wx = 0, scp = curscr->_y[wy]; wx < scrco; ++wx, ++scp) + if (_DARKCHAR(*scp)) + break; + /* LINTED */ + _BEGNS[wy] = (short) wx; + if (wx == scrco) + _ENDNS[wy] = -1; + else { + wx = scrco - 1; + scp = curscr->_y[wy] + wx; + for (; wx >= 0; --wx, --scp) + if (_DARKCHAR(*scp)) + break; + /* LINTED */ + _ENDNS[wy] = (short) wx; + } + + /* update the hash structure */ + _CURHASH[wy] = _BEGNS[wy] < scrco ? _NOHASH : 0; + } +} + +/* + * See if a left or right shift is apppropriate + * This routine is called only if !cookie_glitch or no video attributes + * are used in the affected part. + * The main idea is to find a longest common substring which is a + * prefix of one of 'wcp' or 'scp', then either delete or + * insert depending on where the prefix is. + * + * wcp : what we want the screen to look like + * scp : what the screen looks like now + * length: the length to be updated + * maxi: maximum possible insert amount + * id; *id returns the amount of insert/delete + * + * Return the number of chars matched after the shift. + */ + +static int +_useidch(chtype *wcp, chtype *scp, int length, int maxi, int *id) +{ + int x1, x2, blnk, idch, cost, cost_ich1, match; + chtype wc; + + /* try deletion */ + if (SP->dchok && _CHAR(*wcp) != ' ') { + if ((match = _prefix(wcp, scp, length, length / 2, &idch)) > 0) + cost = _COST(dcfixed) + (parm_dch ? _COST(Parm_dch) : + _COST(Delete_character) * idch); + else + cost = _INFINITY; + + if (match >= cost) { +/* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + if (SP->dmode) { + if (SP->sid_equal) { + if (!(SP->phys_irm)) + _ONINSERT(); + } else { + if (SP->phys_irm) + _OFFINSERT(); + _PUTS(enter_delete_mode, 1); + } + } + + if (parm_dch) + _PUTS(tparm_p1(parm_dch, idch), 1); + else + for (x1 = 0; x1 < idch; ++x1) + _PUTS(delete_character, 1); + + if (SP->dmode) { + if (SP->eid_equal) + SP->phys_irm = FALSE; + _PUTS(exit_delete_mode, 1); + } + + /* update screen image */ + for (x1 = 0, x2 = idch; x2 < length; ++x1, ++x2) + scp[x1] = scp[x2]; + for (; x1 < length; ++x1) + scp[x1] = ' '; + + *id = -idch; + return (match); + } + } + + /* no insertion wanted or possible */ + if (!(SP->ichok) || _CHAR(*scp) == ' ') + return (0); + + /* see if insertion is worth it */ + maxi = (idch = length / 2) < maxi ? idch : maxi; + if ((match = _prefix(scp, wcp, length, maxi, &idch)) <= 0) + return (0); + + /* see if inserting blanks only */ + for (blnk = 0; blnk < idch; ++blnk) + if (wcp[blnk] != ' ') { + blnk = 0; + break; + } + + /* see if doing insertion is worth it */ + cost_ich1 = idch * _COST(Insert_character); + if (SP->imode) { + cost = SP->phys_irm ? 0 : _COST(icfixed); + if (blnk > _COST(Parm_ich) && _COST(Parm_ich) < cost_ich1) + cost += _COST(Parm_ich); + else + if (insert_character) + cost += cost_ich1; + } else { + if (parm_ich && _COST(Parm_ich) < cost_ich1) + cost = _COST(Parm_ich); + else + cost = cost_ich1; + } + if ((cost - blnk) > match) + return (0); + + /* perform the insertions */ + + /* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + if (SP->imode) { + if (!SP->phys_irm) + _ONINSERT(); + if (blnk > _COST(Parm_ich) && _COST(Parm_ich) < cost_ich1) + _PUTS(tparm_p1(parm_ich, idch), 1); + else + if (insert_character) + goto do_insert_char; + else + /* so that we'll do real char insertions */ + blnk = 0; + } else { + if (parm_ich && _COST(Parm_ich) < cost_ich1) + _PUTS(tparm_p1(parm_ich, idch), 1); + else { +do_insert_char: + for (x1 = 0; x1 < idch; ++x1) + _PUTS(insert_character, 1); + } + } + + /* inserting desired characters */ + if (!blnk) + for (x1 = 0; x1 < idch; ++x1) { + wc = wcp[x1]; + if (_ATTR(wc) != curscr->_attrs) + _VIDS(_ATTR(wc), curscr->_attrs); + (void) _outwch(_CHAR(wc) == '~' && + tilde_glitch ? '`' : wc); + ++cx; + } + + /* update the screen image */ + for (x1 = length - 1, x2 = length - idch - 1; x2 >= 0; --x1, --x2) + scp[x1] = scp[x2]; + (void) memcpy((char *) scp, (char *) wcp, idch * sizeof (chtype)); + + *id = idch; + return (match + idch); +} + +/* + * Find a substring of s2 that match a prefix of s1. + * The substring is such that: + * 1. it does not start with an element + * that is in perfect alignment with one in s1 and + * 2: it is at least as long as the displacement. + * + * length: the length of s1, s2. + * maxs: only search for match in [1,maxs] of s2. + * begm: *begm returns where the match begins. + * + * Return the number of matches. + */ + +static int +_prefix(chtype *s1, chtype *s2, int length, int maxs, int *begm) +{ + int m, n, k; + + n = 0; + for (m = 1; m <= maxs; ++m) + /* testing for s1[m] != s2[m] is condition 1 */ + if (s1[0] == s2[m] && s1[m] != s2[m]) { + /* see if it's long enough (condition 2) */ + for (k = 2 * m - 1; k > m; --k) + if (s1[k - m] != s2[k]) + break; + /* found a match with a good length */ + if (k == m) { + *begm = m; + + /* count the # of matches */ + s2 += m; + length -= m; + for (n = m; n < length; ++n) + if (s1[n] != s2[n]) + break; + goto done; + } + } + +done: + return (n); +} + +/* Set video markers for cookie terminal. */ + +static void +_setmark1(int y, int x, chtype *s) +{ + long a; + + /* set the mark map */ + marks[y][x / BITSPERBYTE] |= (1 << (x % BITSPERBYTE)); + + if (s) { + a = _VIDEO(curscr->_attrs); + + /* set the video attr of the first char here */ + /* LINTED */ + *s = _CHAR(*s) | _COLOR(*s) | a; + + /* now the video attr of the rest of the affected interval */ + for (x += 1, s += 1; x < scrco; ++x, ++s) + if (_ISMARK1(y, x)) + break; + else + /* LINTED */ + *s = _CHAR(*s) | _COLOR(*s) | a; + } +} + +/* Set color markers for cookie terminal. */ + +static void +_setmark2(int y, int x, chtype *s) +{ + long a; + + /* set the mark map */ + color_marks[y][x / BITSPERBYTE] |= (1 << (x % BITSPERBYTE)); + + if (s) { + a = _COLOR(curscr->_attrs); + + /* set the video attr of the first char here */ + /* LINTED */ + *s = _CHAR(*s) | _VIDEO(*s) | a; + + /* now the video attr of the rest of the affected interval */ + for (x += 1, s += 1; x < scrco; ++x, ++s) + if (_ISMARK2(y, x)) + break; + else + /* LINTED */ + *s = _CHAR(*s) | _VIDEO(*s) | a; + } +} + + +/* At the right margin various weird things can happen. We treat them here. */ + +/* At the right margin various weird things can happen. We treat them here. */ + +static void +_rmargin(int wx) +{ + int x, w, ix; + chtype sc; + chtype *wcp = _virtscr->_y[cy]; + + /* screen may scroll */ + if (cy == scrli - 1) { + /* can't do anything */ + if (!SP->ichok) + return; + + /* the width of the new character */ + w = _curs_scrwidth[TYPE(RBYTE(wcp[wx]))]; + /* the place to put it without causing scrolling */ + for (x = wx - 1; x > 0; --x) + if (!ISCBIT(wcp[x])) + break; + sc = curscr->_y[cy][x]; + + (void) mvcur(cy, cx, cy, x); + if (_ATTR(wcp[wx]) != curscr->_attrs) + _VIDS(_ATTR(wcp[wx]), curscr->_attrs); + (void) _outwch(tilde_glitch && + _CHAR(wcp[wx]) == '~' ? '`' : wcp[wx]); + + for (ix = wx + 1; ix < scrco; ++ix) { + (void) _outwch(wcp[ix]); + } + + /* insert sc back in and push wcp[wx] right */ + (void) mvcur(cy, x+w, cy, x); + + /* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + if (SP->imode && !SP->phys_irm) + _ONINSERT(); + /* width of the old character that was overwritten */ + w = _curs_scrwidth[TYPE(RBYTE(curscr->_y[cy][x]))]; + + if (insert_character) + for (ix = 0; ix < w; ++ix) + _PUTS(insert_character, 1); + else + if (parm_ich && !SP->imode) + _PUTS(tparm_p1(parm_ich, w), 1); + + if (_ATTR(sc) != curscr->_attrs) + _VIDS(_ATTR(sc), curscr->_attrs); + for (ix = x; w > 0; --w, ++ix) + (void) _outwch(curscr->_y[cy][ix]); + + /* make sure the video attrs are ok */ + if (marks && (_ATTR(sc) || _ATTR(wcp[wx]))) + _VIDS(_ATTR(wcp[wx]), ~_ATTR(sc)); + + /* update screen image */ + /* LINTED */ + cx = (short) wx; + curscr->_y[cy][wx] = wcp[wx]; + for (x = wx + 1; x < scrco; ++x) { + (void) _outwch(wcp[x]); + curscr->_y[cy][x] = wcp[x]; + } + return; + } + + /* put char out and update screen image */ + (void) _outwch(tilde_glitch && _CHAR(wcp[wx]) == '~' ? '`' : wcp[wx]); + + + + + + + + + curscr->_y[cy][wx] = wcp[wx]; + + for (x = wx + 1; x < scrco; ++x) { + (void) _outwch(wcp[x]); + curscr->_y[cy][x] = wcp[x]; + } + + /* make sure that wrap-around happens */ + if (!auto_right_margin || eat_newline_glitch) { + (void) _outch('\r'); + (void) _outch('\n'); + } + cx = 0; + ++cy; +} + +/* + * Find the top-most line to do clear-to-eod. + * + * topy, boty: the region to consider + */ + +static int +_getceod(int topy, int boty) +{ + chtype *wcp, *ecp; + int wy; + short *begch, *endch, *begns; + + /* do nothing */ + if ((topy + 1) >= boty) + return (boty); + + wy = boty - 1; + begch = _virtscr->_firstch + wy; + endch = _virtscr->_lastch + wy; + begns = _BEGNS + wy; + + for (; wy >= topy; --wy, --begch, --endch, --begns) { + if (*endch == _BLANK || (*begch >= scrco && *begns >= scrco)) + continue; + + wcp = _virtscr->_y[wy]; + ecp = wcp + scrco; + for (; wcp < ecp; ++wcp) + if (_DARKCHAR(*wcp)) + break; + if (wcp != ecp) + break; + + *endch = _BLANK; + } + + return (wy + 1); +} + +/* Use hardware clear-to-bottom. */ + +static void +_useceod(int topy, int boty) +{ + short *begns, *begch; + + /* skip lines already blanked */ + begch = _virtscr->_firstch + topy; + begns = _BEGNS + topy; + for (; topy < boty; ++topy, ++begns, ++begch) + if (*begns < scrco || *begch == _REDRAW) + break; + else + *begch = _INFINITY; + + /* nothing to do */ + if (topy + 1 >= boty) + return; + + /* see if bottom is clear */ + for (begns = _BEGNS + boty; boty < scrli; ++boty, ++begns) + if (*begns < scrco) + return; + + /* use clear-screen if appropriate */ + if (topy == 0) { + /* SS: colors */ + if (back_color_erase) + _turn_off_background(); + + _PUTS(clear_screen, scrli); + cy = 0; cx = 0; + (void) werase(curscr); + } else + + /* use clear-to-end-of-display or delete lines */ + if (clr_eos || (parm_delete_line && !memory_below)) { + (void) mvcur(cy, cx, topy, 0); + /* LINTED */ + cy = (short) topy; + cx = 0; + /* SS: colors */ + if (back_color_erase) + _turn_off_background(); + _PUTS(clr_eos ? clr_eos : tparm_p1(parm_delete_line, + scrli - topy), scrli - topy); + + /* update curscr */ + /* LINTED */ + curscr->_cury = (short) topy; + curscr->_curx = 0; + (void) wclrtobot(curscr); + } else + /* no hardware support */ + return; + + /* correct the update structure */ + (void) wtouchln(_virtscr, topy, scrli, FALSE); +} + + +static void +_turn_off_background(void) +{ + /* this routine turn the background color to zero. This need to be */ + /* done only in forllowing cases: */ + /* 1) We are using Tek type terminal (which has bce terminfo */ + /* variable) */ + /* 2) The current background is not already zero */ + + if (set_background && cur_term->_cur_pair.background > 0) { + _PUTS(orig_pair, 1); + cur_term->_cur_pair.foreground = -1; + cur_term->_cur_pair.background = -1; + curscr->_attrs &= ~A_COLOR; + } +} diff --git a/usr/src/lib/libcurses/screen/wscanw.c b/usr/src/lib/libcurses/screen/wscanw.c new file mode 100644 index 0000000000..5265960257 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wscanw.c @@ -0,0 +1,65 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +/* + * scanw and friends + * + */ +#include <sys/types.h> +#include "curses_inc.h" +#include <stdarg.h> + +/* + * This routine implements a scanf on the given window. + */ +/*VARARGS*/ +int +wscanw(WINDOW *win, ...) +{ + char *fmt; + va_list ap; + + va_start(ap, win); + fmt = va_arg(ap, char *); + return (vwscanw(win, fmt, ap)); +} diff --git a/usr/src/lib/libcurses/screen/wscrl.c b/usr/src/lib/libcurses/screen/wscrl.c new file mode 100644 index 0000000000..e192f6d962 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wscrl.c @@ -0,0 +1,88 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Scroll the given window up/down n lines. */ +int +wscrl(WINDOW *win, int n) +{ + short curx, cury; + bool savimmed, savsync; + +#ifdef DEBUG + if (outf) + if (win == stdscr) + fprintf(outf, "scroll(stdscr, %d)\n", n); + else + if (win == curscr) + fprintf(outf, "scroll(curscr, %d)\n", n); + else + fprintf(outf, "scroll(%x, %d)\n", win, n); +#endif /* DEBUG */ + if (!win->_scroll || (win->_flags & _ISPAD)) + return (ERR); + + savimmed = win->_immed; + savsync = win->_sync; + win->_immed = win->_sync = FALSE; + + curx = win->_curx; cury = win->_cury; + + if (cury >= win->_tmarg && cury <= win->_bmarg) + win->_cury = win->_tmarg; + else + win->_cury = 0; + + (void) winsdelln(win, -n); + win->_curx = curx; + win->_cury = cury; + + win->_sync = savsync; + + if (win->_sync) + wsyncup(win); + + return ((win->_immed = savimmed) ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wsetscrreg.c b/usr/src/lib/libcurses/screen/wsetscrreg.c new file mode 100644 index 0000000000..fff52b4c31 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wsetscrreg.c @@ -0,0 +1,64 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Change scrolling region. Since we depend on the values + * of tmarg and bmarg in various ways, this can no longer + * be a macro. + */ + +int +wsetscrreg(WINDOW *win, int topy, int boty) +{ + if (topy < 0 || topy >= win->_maxy || boty < 0 || boty >= win->_maxy) + return (ERR); + + /* LINTED */ + win->_tmarg = (short) topy; + /* LINTED */ + win->_bmarg = (short) boty; + return (OK); +} diff --git a/usr/src/lib/libcurses/screen/wsyncdown.c b/usr/src/lib/libcurses/screen/wsyncdown.c new file mode 100644 index 0000000000..4604766b03 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wsyncdown.c @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Make the changes in ancestors visible in win. */ + +void +wsyncdown(WINDOW *win) +{ + short *wbch, *wech, *pbch, *pech, bch, ech, endx; + int wy, px, py, endy; + WINDOW *par; + + py = win->_pary; + px = win->_parx; + endy = win->_maxy; + endx = win->_maxx - 1; + + for (par = win->_parent; par != NULL; par = par->_parent) { + if (par->_flags & (_WINCHANGED | _WIN_ADD_ONE | + _WIN_INS_ONE)) { + wbch = win->_firstch; + wech = win->_lastch; + pbch = par->_firstch + py; + pech = par->_lastch + py; + + for (wy = 0; wy < endy; ++wy, ++wbch, ++wech, + ++pbch, ++pech) { + if (*pbch != _INFINITY) { + if ((bch = *pbch - px) < 0) + bch = 0; + if ((ech = *pech - px) > endx) + ech = endx; + if (!(bch > endx || ech < 0)) { + if (*wbch > bch) + *wbch = bch; + if (*wech < ech) + *wech = ech; + } + } + } + win->_flags |= _WINCHANGED; + } + + py += par->_pary; + px += par->_parx; + } +} diff --git a/usr/src/lib/libcurses/screen/wsyncup.c b/usr/src/lib/libcurses/screen/wsyncup.c new file mode 100644 index 0000000000..1118331354 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wsyncup.c @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* Sync the changes in a window with its ancestors. */ + +void +wsyncup(WINDOW *win) +{ + short *wbch, *wech, *pbch, *pech, bch, ech; + int wy, px, py, endy; + WINDOW *par; + + for (par = win->_parent; par != NULL; win = par, par = par->_parent) { + py = win->_pary; + px = win->_parx; + endy = win->_maxy; + + wbch = win->_firstch; + wech = win->_lastch; + pbch = par->_firstch+ py; + pech = par->_lastch+ py; + + /* + * I don't think we need check WINCHANGED first. + * The reasoning is that all internal calls will have come + * from a function that did change the window. And assumably + * all external calls will work the same way. + */ + par->_flags |= _WINCHANGED; + /* check each line */ + for (wy = 0; wy < endy; ++wy, ++wbch, ++wech, ++pbch, ++pech) + if (*wbch != _INFINITY) { + bch = px + *wbch; + ech = px + *wech; + if (*pbch > bch) + *pbch = bch; + if (*pech < ech) + *pech = ech; + } + } +} + +void +wcursyncup(WINDOW *win) +{ + WINDOW *par = win->_parent; + + while (par != NULL) { + par->_cury = win->_cury + win->_pary; + par->_curx = win->_curx + win->_parx; + par = (win = par)->_parent; + } +} diff --git a/usr/src/lib/libcurses/screen/wtimeout.c b/usr/src/lib/libcurses/screen/wtimeout.c new file mode 100644 index 0000000000..c91f9af7e8 --- /dev/null +++ b/usr/src/lib/libcurses/screen/wtimeout.c @@ -0,0 +1,51 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +void +wtimeout(WINDOW *win, int tm) +{ + win->_delay = tm; +} diff --git a/usr/src/lib/libcurses/screen/wtouchln.c b/usr/src/lib/libcurses/screen/wtouchln.c new file mode 100644 index 0000000000..52c1c89dbe --- /dev/null +++ b/usr/src/lib/libcurses/screen/wtouchln.c @@ -0,0 +1,90 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +/* + * Make a number of lines look like they have/have not been changed. + * y: the start line + * n: the number of lines affected + * changed: 1: changed + * 0: not changed + * -1: changed. Called internally - In this mode + * even REDRAW lines are changed. + */ + +int +wtouchln(WINDOW *win, int y, int n, int changed) +{ + short *firstch, *lastch, b, e; + int maxy = win->_maxy; + + if (y >= maxy) + return (ERR); + if (y < 0) + y = 0; + if ((y + n) > maxy) + n = maxy - y; + firstch = win->_firstch + y; + lastch = win->_lastch + y; + if (changed) { + win->_flags |= _WINCHANGED; + b = 0; + e = win->_maxx - 1; + } else { + b = _INFINITY; + e = -1; + win->_flags &= ~_WINCHANGED; + } + + for (; n-- > 0; firstch++, lastch++) { + if (changed == -1 || *firstch != _REDRAW) + *firstch = b, *lastch = e; + } + + if ((changed == 1) && win->_sync) + wsyncup(win); + + return (((changed == 1) && win->_immed) ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/screen/wvline.c b/usr/src/lib/libcurses/screen/wvline.c new file mode 100644 index 0000000000..0fb238ce2a --- /dev/null +++ b/usr/src/lib/libcurses/screen/wvline.c @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 1997 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1988 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/*LINTLIBRARY*/ + +#include <sys/types.h> +#include "curses_inc.h" + +int +wvline(WINDOW *win, chtype vertch, int num_chars) +{ + short cury = win->_cury, curx = win->_curx; + chtype a, **fp = win->_y; + short *firstch = &(win->_firstch[cury]), + *lastch = &(win->_lastch[cury]); + + if (num_chars <= 0) + return (ERR); + + if (num_chars > win->_maxy - cury + 1) + num_chars = win->_maxy - cury + 1; + if (vertch == 0) + vertch = ACS_VLINE; + a = _ATTR(vertch); + vertch = _WCHAR(win, vertch) | a; + for (num_chars += cury; cury < num_chars; cury++, firstch++, + lastch++) { + fp[cury][curx] = vertch; + if (curx < *firstch) + *firstch = curx; + if (curx > *lastch) + *lastch = curx; + } + win->_flags |= _WINCHANGED; + + if (win->_sync) + wsyncup(win); + + return (win->_immed ? wrefresh(win) : OK); +} diff --git a/usr/src/lib/libcurses/sparc/Makefile b/usr/src/lib/libcurses/sparc/Makefile new file mode 100644 index 0000000000..7fad7849fe --- /dev/null +++ b/usr/src/lib/libcurses/sparc/Makefile @@ -0,0 +1,38 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/sparc/Makefile + +MAPDIR= ../spec/sparc + +include ../Makefile.com + +.KEEP_STATE: + +all: $(LIBS) + +install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) diff --git a/usr/src/lib/libcurses/sparcv9/Makefile b/usr/src/lib/libcurses/sparcv9/Makefile new file mode 100644 index 0000000000..d420e5ba59 --- /dev/null +++ b/usr/src/lib/libcurses/sparcv9/Makefile @@ -0,0 +1,48 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 1997-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +#ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/sparcv9/Makefile + +MAPDIR= ../spec/sparcv9 + +include ../Makefile.com +include ../../Makefile.lib.64 + +.KEEP_STATE: + +$(ROOTLIBDIR64)/$(LIBLINKS) := INS.liblink64 = \ + -$(RM) $@; \ + cd $(ROOTLIBDIR64); \ + $(RM) libtermlib.so$(VERS) libtermcap.so$(VERS);\ + $(RM) libtermlib.so libtermcap.so; \ + $(SYMLINK) $(LIBLINKS)$(VERS) $(LIBLINKS); \ + $(SYMLINK) libcurses.so$(VERS) libtermlib.so$(VERS); \ + $(SYMLINK) libcurses.so$(VERS) libtermcap.so$(VERS); \ + $(SYMLINK) libtermcap.so$(VERS) libtermcap.so; \ + $(SYMLINK) libtermlib.so$(VERS) libtermlib.so + +install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64) diff --git a/usr/src/lib/libcurses/spec/Makefile b/usr/src/lib/libcurses/spec/Makefile new file mode 100644 index 0000000000..ef6c68e2a4 --- /dev/null +++ b/usr/src/lib/libcurses/spec/Makefile @@ -0,0 +1,29 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright (c) 1997-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +# lib/libcurses/spec/Makefile + +include $(SRC)/lib/Makefile.spec.arch diff --git a/usr/src/lib/libcurses/spec/Makefile.targ b/usr/src/lib/libcurses/spec/Makefile.targ new file mode 100644 index 0000000000..23d4453718 --- /dev/null +++ b/usr/src/lib/libcurses/spec/Makefile.targ @@ -0,0 +1,36 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright (c) 1997-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +# lib/libcurses/spec/Makefile.targ + +LIBRARY = libcurses.a +VERS = .1 + +OBJECTS = curses.o + +TRANSCPP = + +SPECCPP = -I../../screen -I.. diff --git a/usr/src/lib/libcurses/spec/amd64/Makefile b/usr/src/lib/libcurses/spec/amd64/Makefile new file mode 100644 index 0000000000..453c0ea671 --- /dev/null +++ b/usr/src/lib/libcurses/spec/amd64/Makefile @@ -0,0 +1,44 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +.KEEP_STATE: + +include ../Makefile.targ + +# Add arch specific objects here +OBJECTS += + +include $(SRC)/lib/Makefile.lib +include $(SRC)/lib/Makefile.lib.64 + +# Uncomment the following if the linker complains +#amd64_C_PICFLAGS = -K PIC + +include $(SRC)/lib/Makefile.spec + +install: $(ROOTABILIB64) diff --git a/usr/src/lib/libcurses/spec/curses.spec b/usr/src/lib/libcurses/spec/curses.spec new file mode 100644 index 0000000000..9d34513aa7 --- /dev/null +++ b/usr/src/lib/libcurses/spec/curses.spec @@ -0,0 +1,2749 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +#pragma ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/spec/curses.spec + +function _getsyx +declaration int _getsyx(int *yp, int *xp) +version SUNW_1.1 +end + +function _meta +declaration int _meta(int bf) +version SUNW_1.1 +end + +function _ring +include <curses.h>, <term.h> +declaration int _ring(bool bf) +version SUNW_1.1 +end + +function _setecho +declaration int _setecho(int bf) +version SUNW_1.1 +end + +function _setnonl +declaration int _setnonl(int bf) +version SUNW_1.1 +end + +function _setqiflush +declaration void _setqiflush(int yes) +version SUNW_1.1 +end + +function baudrate +declaration int baudrate(void) +version SUNW_1.1 +end + +function can_change_color +include <curses.h>, <term.h> +declaration bool can_change_color(void) +version SUNW_1.1 +end + +function cbreak +declaration int cbreak(void) +version SUNW_1.1 +end + +function color_content +declaration int color_content(short color, short *r, short *g, short *b) +version SUNW_1.1 +end + +function copywin +declaration int copywin(WINDOW *Srcwin, WINDOW *Dstwin, int minRowSrc, \ + int minColSrc, int minRowDst, int minColDst, \ + int maxRowDst, int maxColDst, int over_lay) +version SUNW_1.1 +end + +function crmode +declaration int crmode(void) +version SUNW_1.1 +end + +function curserr +declaration void curserr(void) +version SUNWprivate_1.1 +end + +function curs_set +declaration int curs_set(int visibility) +version SUNW_1.1 +end + +function def_prog_mode +declaration int def_prog_mode(void) +version SUNW_1.1 +end + +function def_shell_mode +declaration int def_shell_mode(void) +version SUNW_1.1 +end + +function delay_output +declaration int delay_output(int ms) +version SUNW_1.1 +end + +function delkeymap +include <curses.h>, <term.h> +declaration void delkeymap(TERMINAL *terminal) +version SUNWprivate_1.1 +end + +function delscreen +include <curses.h>, <term.h> +declaration void delscreen(SCREEN *screen) +version SUNW_1.1 +end + +function delterm +include <curses.h>, <term.h> +declaration int delterm(TERMINAL *terminal) +version SUNWprivate_1.1 +end + +function delwin +include <curses.h>, <term.h> +declaration int delwin(WINDOW *win) +version SUNW_1.1 +end + +function derwin +declaration WINDOW *derwin(WINDOW *win, int num_lines, int nc, \ + int by, int bx) +version SUNW_1.1 +end + +function doupdate +declaration int doupdate(void) +version SUNW_1.1 +end + +function dupwin +declaration WINDOW *dupwin(WINDOW *win) +version SUNW_1.1 +end + +function endwin +declaration int endwin(void) +version SUNW_1.1 +end + +function erasechar +declaration char erasechar(void) +version SUNW_1.1 +end + +function filter +declaration int filter(void) +version SUNW_1.1 +end + +function flushinp +declaration int flushinp(void) +version SUNW_1.1 +end + +function getbmap +declaration unsigned long getbmap(void) +version SUNWprivate_1.1 +end + +function getmouse +declaration unsigned long getmouse(void) +version SUNWprivate_1.1 +end + +function getwin +declaration WINDOW *getwin(FILE *filep) +version SUNW_1.1 +end + +function has_colors +include <curses.h>, <term.h> +declaration bool has_colors(void) +version SUNW_1.1 +end + +function has_ic +declaration int has_ic(void) +version SUNW_1.1 +end + +function has_il +declaration int has_il(void) +version SUNW_1.1 +end + +function idlok +include <curses.h>, <term.h> +declaration int idlok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function immedok +include <curses.h>, <term.h> +declaration void immedok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function init_color +declaration int init_color(short color, short r, short g, short b) +version SUNW_1.1 +end + +function init_pair +declaration int init_pair(short pair, short f, short b) +version SUNW_1.1 +end + +function initscr32 extends libcurses/spec/curses.spec initscr +version SUNWprivate_1.1 +end + +function initscr +include <curses.h>, <term.h> +declaration WINDOW *initscr(void) +version SUNW_1.1 +end + +function isendwin +declaration int isendwin(void) +version SUNW_1.1 +end + +function keyname +declaration char *keyname(int key) +version SUNW_1.1 +end + +function keypad +include <curses.h>, <term.h> +declaration int keypad(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function killchar +declaration char killchar(void) +version SUNW_1.1 +end + +function longname +declaration char *longname(void) +version SUNW_1.1 +end + +function m_addch +declaration int m_addch(int c) +version SUNWprivate_1.1 +end + +function m_addstr +declaration int m_addstr(char *str) +version SUNWprivate_1.1 +end + +function m_clear +declaration int m_clear(void) +version SUNWprivate_1.1 +end + +function m_erase +declaration int m_erase(void) +version SUNWprivate_1.1 +end + +function m_initscr +declaration WINDOW *m_initscr(void) +version SUNWprivate_1.1 +end + +function m_move +declaration int m_move(int x, int y) +version SUNWprivate_1.1 +end + +function m_newterm +include <curses.h>, <term.h> +declaration SCREEN *m_newterm(char *type, FILE *outfptr, FILE *infptr) +version SUNWprivate_1.1 +end + +function m_refresh +declaration int m_refresh(void) +version SUNWprivate_1.1 +end + +function map_button +declaration int map_button(unsigned long a) +version SUNWprivate_1.1 +end + +function mouse_off +declaration int mouse_off(long mbe) +version SUNWprivate_1.1 +end + +function mouse_on +declaration int mouse_on(long mbe) +version SUNWprivate_1.1 +end + +function mouse_set +declaration int mouse_set(long mbe) +version SUNWprivate_1.1 +end + +function mvcur +declaration int mvcur(int cury, int curx, int newy, int newx) +version SUNW_1.1 +end + +function mvderwin +declaration int mvderwin(WINDOW *win, int pary, int parx) +version SUNW_1.1 +end + +function mvprintw +declaration int mvprintw(int y, int x, ...) +version SUNW_1.1 +end + +function mvscanw +declaration int mvscanw(int y, int x, ...) +version SUNW_1.1 +end + +function mvwin +declaration int mvwin(WINDOW *win, int by, int bx) +version SUNW_1.1 +end + +function mvwprintw +declaration int mvwprintw(WINDOW *win, int y, int x, ...) +version SUNW_1.1 +end + +function mvwscanw +declaration int mvwscanw(WINDOW *win, int y, int x, ...) +version SUNW_1.1 +end + +function napms +declaration int napms(int ms) +version SUNW_1.1 +end + +function newkey +include <curses.h>, <term.h> +declaration int newkey(char *rcvchars, short keyval, bool macro) +version SUNWprivate_1.1 +end + +function newterm32 extends libcurses/spec/curses.spec newterm +version SUNWprivate_1.1 +end + +function newterm +include <curses.h>, <term.h> +declaration SCREEN *newterm(char *type, FILE *fout, FILE *fin) +version SUNW_1.1 +end + +function newscreen +include <curses.h>, <term.h> +declaration SCREEN *newscreen(char *type, int lsize, int csize, int \ + tabsize, FILE *outfptr, FILE *infptr) +version SUNWprivate_1.1 +end + +function newpad +declaration WINDOW *newpad(int l, int nc) +version SUNW_1.1 +end + +function newwin +declaration WINDOW *newwin(int nlines, int ncols, int by, int bx) +version SUNW_1.1 +end + +function nocbreak +declaration int nocbreak(void) +version SUNW_1.1 +end + +function nocrmode +declaration int nocrmode(void) +version SUNW_1.1 +end + +function noraw +declaration int noraw(void) +version SUNW_1.1 +end + +function pair_content +declaration int pair_content(short pair, short *f, short *b) +version SUNW_1.1 +end + +function p32echochar extends libcurses/spec/curses.spec pechochar +version SUNWprivate_1.1 +end + +function pechochar +include <curses.h>, <term.h> +declaration int pechochar(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function pechowchar +declaration int pechowchar(WINDOW *pad, chtype ch) +version SUNW_1.1 +end + +function pnoutrefresh +declaration int pnoutrefresh(WINDOW *pad, int pby, int pbx, int sby, \ + int sbx, int sey, int sex) +version SUNW_1.1 +end + +function printw +declaration int printw(char *fmt, ...) +version SUNW_1.1 +end + +function prefresh +declaration int prefresh(WINDOW *pad, int pminy, int pminx, int sminy, \ + int sminx, int smaxy, int smaxx) +version SUNW_1.1 +end + +function putwin +declaration int putwin(WINDOW *win, FILE *filep) +version SUNW_1.1 +end + +function raw +declaration int raw(void) +version SUNW_1.1 +end + +function redrawwin +include <term.h> +declaration int redrawwin(WINDOW *win) +version SUNW_1.1 +end + +function request_mouse_pos +declaration int request_mouse_pos(void) +version SUNWprivate_1.1 +end + +function reset_prog_mode +declaration int reset_prog_mode(void) +version SUNW_1.1 +end + +function reset_shell_mode +declaration int reset_shell_mode(void) +version SUNW_1.1 +end + +function resetty +declaration int resetty(void) +version SUNW_1.1 +end + +function ripoffline +declaration int ripoffline(int line, int (*init)(WINDOW *, int)) +version SUNW_1.1 +end + +function savetty +declaration int savetty(void) +version SUNW_1.1 +end + +function scanw +declaration int scanw(char *fmt, ...) +version SUNW_1.1 +end + +function scr_dump +declaration int scr_dump(char *file) +version SUNW_1.1 +end + +function setcurscreen +include <curses.h>, <term.h> +declaration SCREEN *setcurscreen(SCREEN *new) +version SUNWprivate_1.1 +end + +function setcurterm +include <curses.h>, <term.h> +declaration TERMINAL *setcurterm(TERMINAL *newterminal) +version SUNWprivate_1.1 +end + +function setsyx +declaration int setsyx(int y, int x) +version SUNW_1.1 +end + +function setupterm +declaration int setupterm(char *term, int filenum, int *errret) +version SUNW_1.1 +end + +function slk_attroff +declaration int slk_attroff(chtype a) +version SUNW_1.1 +end + +function slk_attron +declaration int slk_attron(chtype a) +version SUNW_1.1 +end + +function slk_attrset +declaration int slk_attrset(chtype a) +version SUNW_1.1 +end + +function slk_clear +declaration int slk_clear(void) +version SUNW_1.1 +end + +function slk_label +declaration char *slk_label(int n) +version SUNW_1.1 +end + +function slk_noutrefresh +declaration int slk_noutrefresh(void) +version SUNW_1.1 +end + +function slk_refresh +declaration int slk_refresh(void) +version SUNW_1.1 +end + +function slk_restore +declaration int slk_restore(void) +version SUNW_1.1 +end + +function slk_set +declaration int slk_set(int n, char *lab, int f) +version SUNW_1.1 +end + +function slk_start +declaration int slk_start(int ng, int *gp) +version SUNWprivate_1.1 +end + +function slk_touch +declaration int slk_touch(void) +version SUNW_1.1 +end + +function start_color +declaration int start_color(void) +version SUNW_1.1 +end + +function termattrs +declaration chtype termattrs(void) +version SUNW_1.1 +end + +function termname +declaration char *termname(void) +version SUNW_1.1 +end + +function traceoff +declaration int traceoff(void) +version SUNWprivate_1.1 +end + +function traceon +declaration int traceon(void) +version SUNWprivate_1.1 +end + +function typeahead +declaration int typeahead(int fd) +version SUNW_1.1 +end + +function unctrl +declaration char *unctrl(int ch) +version SUNW_1.1 +end + +function ungetch +declaration int ungetch(int ch) +version SUNW_1.1 +end + +function ungetwch +declaration int ungetwch(wchar_t code) +version SUNW_1.1 +end + +function vidupdate +declaration void vidupdate(chtype newmode, chtype oldmode, \ + int (*outc)(char)) +version SUNWprivate_1.1 +end + +function vwprintw +declaration int vwprintw(WINDOW *win, char *fmt, va_list ap) +version SUNW_1.1 +end + +function vwscanw +declaration int vwscanw(WINDOW *win, char *fmt, va_list ap) +version SUNW_1.1 +end + +function w32addch extends libcurses/spec/curses.spec waddch +version SUNWprivate_1.1 +end + +function waddch +declaration int waddch(WINDOW *win, chtype ch) +version SUNW_1.1 +end + +function waddchnstr +declaration int waddchnstr(WINDOW *win, chtype *string, int ncols) +version SUNW_1.1 +end + +function waddnstr +declaration int waddnstr(WINDOW *win, char *tstr, int i) +version SUNW_1.1 +end + +function waddnwstr +declaration int waddnwstr(WINDOW *win, wchar_t *code, int n) +version SUNW_1.1 +end + +function waddwch +declaration int waddwch(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function waddwchnstr +declaration int waddwchnstr(WINDOW *win, chtype *string, int ncols) +version SUNW_1.1 +end + +function w32attroff extends libcurses/spec/curses.spec wattroff +version SUNWprivate_1.1 +end + +function w32attron extends libcurses/spec/curses.spec wattron +version SUNWprivate_1.1 +end + +function w32attrset extends libcurses/spec/curses.spec wattrset +version SUNWprivate_1.1 +end + +function w32echochar extends libcurses/spec/curses.spec wechochar +version SUNWprivate_1.1 +end + +function w32insch extends libcurses/spec/curses.spec winsch +version SUNWprivate_1.1 +end + +function wattroff +declaration int wattroff(WINDOW *win, chtype attrs) +version SUNW_1.1 +end + +function wattron +declaration int wattron(WINDOW *win, chtype attrs) +version SUNW_1.1 +end + +function wattrset +declaration int wattrset(WINDOW *win, chtype attrs) +version SUNW_1.1 +end + +function wbkgd +declaration int wbkgd(WINDOW *win, chtype nbkgd) +version SUNW_1.1 +end + +function wborder +declaration int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, \ + chtype bs, chtype tl, chtype tr, chtype bl, chtype br) +version SUNW_1.1 +end + +function wclrtobot +declaration int wclrtobot(WINDOW *win) +version SUNW_1.1 +end + +function wclrtoeol +declaration int wclrtoeol(WINDOW *win) +version SUNW_1.1 +end + +function wcursyncup +declaration void wcursyncup(WINDOW *win) +version SUNW_1.1 +end + +function wdelch +declaration int wdelch(WINDOW *win) +version SUNW_1.1 +end + +function wechochar +declaration int wechochar(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function wechowchar +declaration int wechowchar(WINDOW *win, chtype ch) +version SUNW_1.1 +end + +function wgetch +declaration int wgetch(WINDOW *win) +version SUNW_1.1 +end + +function wgetstr +declaration int wgetstr(WINDOW *win, char *str) +version SUNW_1.1 +end + +function wgetnstr +declaration int wgetnstr(WINDOW *win, char *str, int n) +version SUNW_1.1 +end + +function wgetnwstr +declaration int wgetnwstr(WINDOW *win, wchar_t *str, int n) +version SUNW_1.1 +end + +function wgetwch +declaration int wgetwch(WINDOW *win) +version SUNW_1.1 +end + +function wgetwstr +declaration int wgetwstr(WINDOW *win, wchar_t *str) +version SUNW_1.1 +end + +function whline +declaration int whline(WINDOW *win, chtype ch, int num_chars) +version SUNW_1.1 +end + +function winchnstr +declaration int winchnstr(WINDOW *win, chtype *string, int ncols) +version SUNW_1.1 +end + +function winchstr +declaration int winchstr(WINDOW *win, chtype *string) +version SUNW_1.1 +end + +function winnstr +declaration int winnstr(WINDOW *win, char *string, int ncols) +version SUNW_1.1 +end + +function winnwstr +declaration int winnwstr(WINDOW *win, wchar_t *wstr, int ncols) +version SUNW_1.1 +end + +function winsch +declaration int winsch(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function winsdelln +declaration int winsdelln(WINDOW *win, int id) +version SUNW_1.1 +end + +function winsnstr +declaration int winsnstr(WINDOW *win, char *tsp, int n) +version SUNW_1.1 +end + +function winsnwstr +declaration int winsnwstr(WINDOW *win, wchar_t *code, int n) +version SUNW_1.1 +end + +function winstr +declaration int winstr(WINDOW *win, char *str) +version SUNW_1.1 +end + +function winswch +declaration int winswch(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function winwch +declaration chtype winwch(WINDOW *win) +version SUNW_1.1 +end + +function winwchnstr +declaration int winwchnstr(WINDOW *win, chtype *string, int ncols) +version SUNW_1.1 +end + +function winwstr +declaration int winwstr(WINDOW *win, wchar_t *wstr) +version SUNW_1.1 +end + +function wmouse_position +declaration void wmouse_position(WINDOW *win, int *x, int *y) +version SUNWprivate_1.1 +end + +function wmove +declaration int wmove(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function wnoutrefresh +declaration int wnoutrefresh(WINDOW *win) +version SUNW_1.1 +end + +function wprintw +declaration int wprintw(WINDOW *win, ...) +version SUNW_1.1 +end + +function wredrawln +declaration int wredrawln(WINDOW *win, int begline, int numlines) +version SUNW_1.1 +end + +function wrefresh +declaration int wrefresh(WINDOW *win) +version SUNW_1.1 +end + +function wscanw +declaration int wscanw(WINDOW *win, ...) +version SUNW_1.1 +end + +function wscrl +declaration int wscrl(WINDOW *win, int n) +version SUNW_1.1 +end + +function wsetscrreg +declaration int wsetscrreg(WINDOW *win, int topy, int boty) +version SUNW_1.1 +end + +function wstandend +declaration int wstandend(WINDOW *win) +version SUNW_1.1 +end + +function wstandout +declaration int wstandout(WINDOW *win) +version SUNW_1.1 +end + +function wsyncdown +declaration void wsyncdown(WINDOW *win) +version SUNW_1.1 +end + +function wsyncup +declaration void wsyncup(WINDOW *win) +version SUNW_1.1 +end + +function wtouchln +declaration int wtouchln(WINDOW *win, int y, int n, int changed) +version SUNW_1.1 +end + +function wvline +declaration int wvline(WINDOW *win, chtype vertch, int num_chars) +version SUNW_1.1 +end + +data BC +version SUNWprivate_1.1 +end + +data COLORS +version SUNWprivate_1.1 +end + +data COLOR_PAIRS +version SUNWprivate_1.1 +end + +data COLS +version SUNWprivate_1.1 +end + +data Def_term +version SUNWprivate_1.1 +end + +data LINES +version SUNWprivate_1.1 +end + +data Mouse_status +version SUNWprivate_1.1 +end + +data Oldcolors +version SUNWprivate_1.1 +end + +data PC +version SUNWprivate_1.1 +end + +data SP +version SUNWprivate_1.1 +end + +data TABSIZE +version SUNWprivate_1.1 +end + +data UP +version SUNWprivate_1.1 +end + +function __sscans +declaration int __sscans(WINDOW *win, char *fmt, ...) +version SUNWprivate_1.1 +end + +function _blast_keys +include <curses.h>, <term.h> +declaration void _blast_keys(TERMINAL *terminal) +version SUNWprivate_1.1 +end + +function _branchto +declaration char *_branchto(char *cp, char to) +version SUNWprivate_1.1 +end + +data _called_before +version SUNWprivate_1.1 +end + +function _ccleanup +declaration void _ccleanup(int signo) +version SUNWprivate_1.1 +end + +function _change_color +declaration void _change_color(short newcolor, short oldcolor, \ + int (*outc)(char)) +version SUNWprivate_1.1 +end + +function _change_video +include <curses.h>, <term.h> +declaration int _change_video(chtype newmode, chtype oldmode, int \ + (*outc)(char), bool color_terminal) +version SUNWprivate_1.1 +end + +function _chkinput +declaration int _chkinput(void) +version SUNWprivate_1.1 +end + +function _countchar +declaration int _countchar(void) +version SUNWprivate_1.1 +end + +data _csmax +version SUNWprivate_1.1 +end + +function _curs_mbstowcs +declaration size_t _curs_mbstowcs(wchar_t *pwcs, const char *s, size_t n) +version SUNWprivate_1.1 +end + +function _curs_mbtowc +declaration int _curs_mbtowc(wchar_t *wchar, const char *s, size_t n) +version SUNWprivate_1.1 +end + +data _curs_scrwidth +version SUNWprivate_1.1 +end + +function _curs_wcstombs +declaration size_t _curs_wcstombs(char *s, const wchar_t *pwcs, size_t n) +version SUNWprivate_1.1 +end + +function _curs_wctomb +declaration int _curs_wctomb(char *s, const wchar_t wchar) +version SUNWprivate_1.1 +end + +function _delay +declaration int _delay(int delay, int (*outc)(char)) +version SUNWprivate_1.1 +end + +data _do_slk_noref +version SUNWprivate_1.1 +end + +data _do_slk_ref +version SUNWprivate_1.1 +end + +data _do_slk_tch +version SUNWprivate_1.1 +end + +data _endwin +version SUNWprivate_1.1 +end + +data _first_term +version SUNWprivate_1.1 +end + +data _frst_bools +version SUNWprivate_1.1 +end + +data _frst_nums +version SUNWprivate_1.1 +end + +data _frst_strs +version SUNWprivate_1.1 +end + +data _frst_tblstr +version SUNWprivate_1.1 +end + +function _image +declaration int _image(WINDOW *win) +version SUNWprivate_1.1 +end + +function _init_HP_pair +declaration void _init_HP_pair(short pair, short f, short b) +version SUNWprivate_1.1 +end + +function _init_costs +declaration void _init_costs(void) +version SUNWprivate_1.1 +end + +data _lib_version +version SUNWprivate_1.1 +end + +function _makenew +declaration WINDOW *_makenew(int nlines, int ncols, int begy, int begx) +version SUNWprivate_1.1 +end + +function _mbaddch +declaration int _mbaddch(WINDOW *win, chtype a, chtype b) +version SUNWprivate_1.1 +end + +function _mbclrch +declaration int _mbclrch(WINDOW *win, int y, int x) +version SUNWprivate_1.1 +end + +function _mbinsshift +declaration int _mbinsshift(WINDOW *win, int len) +version SUNWprivate_1.1 +end + +data _mbtrue +version SUNWprivate_1.1 +end + +function _mbvalid +declaration int _mbvalid(WINDOW *win) +version SUNWprivate_1.1 +end + +function _outch +declaration int _outch(char c) +version SUNWprivate_1.1 +end + +function _outchar +declaration int _outchar(char ch) +version SUNWprivate_1.1 +end + +function _outwch +declaration int _outwch(chtype c) +version SUNWprivate_1.1 +end + +function _overlap +declaration int _overlap(WINDOW *Srcwin, WINDOW *Dstwin, int Overlay) +version SUNWprivate_1.1 +end + +function _padjust +declaration int _padjust(WINDOW *pad, int pminy, int pminx, int sminy, \ + int sminx, int smaxy, int smaxx) +version SUNWprivate_1.1 +end + +function _prefresh +declaration int _prefresh(int (*func)(WINDOW *), WINDOW *pad, int pminy, \ + int pminx, int sminy, int sminx, int smaxy, int smaxx) +version SUNWprivate_1.1 +end + +function _quick_echo +declaration int _quick_echo(WINDOW *win, chtype ch) +version SUNWprivate_1.1 +end + +data _quick_ptr +version SUNWprivate_1.1 +end + +data _rip_init +version SUNWprivate_1.1 +end + +function _scr_all +declaration int _scr_all(char *file, int which) +version SUNWprivate_1.1 +end + +data _scrmax +version SUNWprivate_1.1 +end + +data _setidln +version SUNWprivate_1.1 +end + +data _slk_init +version SUNWprivate_1.1 +end + +function _slk_update +declaration int _slk_update(void) +version SUNWprivate_1.1 +end + +function _sprintw +declaration int _sprintw(WINDOW *win, char *fmt, ...) +version SUNWprivate_1.1 +end + +function _strbyte2code +declaration wchar_t *_strbyte2code(char *code, wchar_t *byte, int n) +version SUNWprivate_1.1 +end + +function _strcode2byte +declaration char *_strcode2byte(wchar_t *code, char *b, int n) +version SUNWprivate_1.1 +end + +function _tcsearch +declaration int _tcsearch(char *cap, short offsets[], char *names[], \ + int size, int n) +version SUNWprivate_1.1 +end + +function _tstp +declaration void _tstp(int dummy) +version SUNWprivate_1.1 +end + +data _unctrl +version SUNWprivate_1.1 +end + +function _update_old_y_area +declaration void _update_old_y_area(WINDOW *win, int nlines, int ncols, \ + int start_line, int start_col) +version SUNWprivate_1.1 +end + +data _use_env +version SUNWprivate_1.1 +end + +data _useidln +version SUNWprivate_1.1 +end + +data _virtscr +version SUNWprivate_1.1 +end + +data _y16update +version SUNWprivate_1.1 +end + +data acs32map +version SUNWprivate_1.1 +end + +data acs_map +version SUNWprivate_1.1 +end + +function addch +declaration int addch(chtype ch) +version SUNW_1.1 +end + +function addchnstr +declaration int addchnstr(chtype *s, int n) +version SUNW_1.1 +end + +function addchstr +declaration int addchstr(chtype *s) +version SUNW_1.1 +end + +function addnstr +declaration int addnstr(char *s, int n) +version SUNW_1.1 +end + +function addnwstr +declaration int addnwstr(wchar_t *s, int n) +version SUNW_1.1 +end + +function addstr +declaration int addstr(char *s) +version SUNW_1.1 +end + +function addwch +declaration int addwch(chtype ch) +version SUNW_1.1 +end + +function addwchnstr +declaration int addwchnstr(chtype *str, int n) +version SUNW_1.1 +end + +function addwchstr +declaration int addwchstr(chtype *str) +version SUNW_1.1 +end + +function addwstr +declaration int addwstr(wchar_t *ws) +version SUNW_1.1 +end + +function attroff +declaration int attroff(chtype at) +version SUNW_1.1 +end + +function attron +declaration int attron(chtype at) +version SUNW_1.1 +end + +function attrset +declaration int attrset(chtype at) +version SUNW_1.1 +end + +function beep +declaration int beep(void) +version SUNW_1.1 +end + +data bit_attributes +version SUNWprivate_1.1 +end + +data bkgd +version SUNW_1.1 +end + +function bkgdset +declaration void bkgdset(chtype c) +version SUNW_1.1 +end + +data boolcodes +version SUNWprivate_1.1 +end + +data boolfnames +version SUNWprivate_1.1 +end + +data boolnames +version SUNWprivate_1.1 +end + +function border +declaration int border(chtype ls, chtype rs, chtype ts, chtype bs, \ + chtype tl, chtype tr, chtype bl, chtype br) +version SUNW_1.1 +end + +function box32 extends libcurses/spec/curses.spec box +version SUNWprivate_1.1 +end + +function box +declaration int box(WINDOW *win, chtype verch, chtype horch) +version SUNW_1.1 +end + +function cconvert +declaration char *cconvert(char *string) +version SUNWprivate_1.1 +end + +function cexpand +declaration char *cexpand(char *str) +version SUNWprivate_1.1 +end + +function clear +declaration int clear(void) +version SUNW_1.1 +end + +function clearok +include <curses.h>, <term.h> +declaration int clearok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function clrtobot +declaration int clrtobot(void) +version SUNW_1.1 +end + +function clrtoeol +declaration int clrtoeol(void) +version SUNW_1.1 +end + +function cpr +declaration int cpr(FILE *f, char *c) +version SUNWprivate_1.1 +end + +data cswidth +version SUNWprivate_1.1 +end + +data cur_bools +version SUNWprivate_1.1 +end + +data cur_nums +version SUNWprivate_1.1 +end + +data cur_strs +version SUNWprivate_1.1 +end + +data cur_term +version SUNWprivate_1.1 +end + +data curs_err_strings +version SUNWprivate_1.1 +end + +data curs_errno +version SUNWprivate_1.1 +end + +data curs_parm_err +version SUNWprivate_1.1 +end + +data curscr +version SUNWprivate_1.1 +end + +data curses_version +version SUNWprivate_1.1 +end + +function del_curterm +include <curses.h>, <term.h> +declaration int del_curterm(TERMINAL *terminal) +version SUNW_1.1 +end + +function delch +declaration int delch(void) +version SUNW_1.1 +end + +function deleteln +declaration int deleteln(void) +version SUNW_1.1 +end + +function delkey +declaration int delkey(char *sends, int keyval) +version SUNWprivate_1.1 +end + +function draino +declaration int draino(int ms) +version SUNWprivate_1.1 +end + +function echo +declaration int echo(void) +version SUNW_1.1 +end + +function echochar +declaration int echochar(chtype ch) +version SUNW_1.1 +end + +function echowchar +declaration int echowchar(chtype ch) +version SUNW_1.1 +end + +function erase +declaration int erase(void) +version SUNW_1.1 +end + +function fixterm +declaration int fixterm(void) +version SUNWprivate_1.1 +end + +function flash +declaration int flash(void) +version SUNW_1.1 +end + +function force_doupdate +declaration int force_doupdate(void) +version SUNWprivate_1.1 +end + +function garbagedlines +declaration int garbagedlines(WINDOW *win, int start, int finish) +version SUNWprivate_1.1 +end + +function garbagedwin +declaration int garbagedwin(WINDOW *win) +version SUNWprivate_1.1 +end + +function getattrs +declaration chtype getattrs(WINDOW *win) +version SUNWprivate_1.1 +end + +function getbegx +declaration int getbegx(WINDOW *win) +version SUNWprivate_1.1 +end + +function getbegy +declaration int getbegy(WINDOW *win) +version SUNWprivate_1.1 +end + +function getbkgd +declaration chtype getbkgd(WINDOW *win) +version SUNWprivate_1.1 +end + +function getch +declaration int getch(void) +version SUNW_1.1 +end + +function getcurx +declaration int getcurx(WINDOW *win) +version SUNWprivate_1.1 +end + +function getcury +declaration int getcury(WINDOW *win) +version SUNWprivate_1.1 +end + +function getmaxx +declaration int getmaxx(WINDOW *win) +version SUNWprivate_1.1 +end + +function getmaxy +declaration int getmaxy(WINDOW *win) +version SUNWprivate_1.1 +end + +function getnwstr +declaration int getnwstr(wchar_t *ws, int n) +version SUNW_1.1 +end + +function getparx +declaration int getparx(WINDOW *win) +version SUNWprivate_1.1 +end + +function getpary +declaration int getpary(WINDOW *win) +version SUNWprivate_1.1 +end + +function getstr +declaration int getstr(char *str) +version SUNW_1.1 +end + +function gettmode +declaration int gettmode(void) +version SUNWprivate_1.1 +end + +function getwch +declaration int getwch(void) +version SUNW_1.1 +end + +function getwstr +declaration int getwstr(wchar_t *ws) +version SUNW_1.1 +end + +function halfdelay +declaration int halfdelay(int tens) +version SUNW_1.1 +end + +function hline +declaration int hline(chtype horch, int num_chars) +version SUNWprivate_1.1 +end + +function idcok +include <curses.h>, <term.h> +declaration void idcok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function inch +declaration chtype inch(void) +version SUNW_1.1 +end + +function inchnstr +declaration int inchnstr(chtype *s, int n) +version SUNW_1.1 +end + +function inchstr +declaration int inchstr(chtype *s) +version SUNW_1.1 +end + +function iexpand +declaration char *iexpand(char *string) +version SUNWprivate_1.1 +end + +function infotocap +declaration char *infotocap(char *value, int *err) +version SUNWprivate_1.1 +end + +function init_acs +declaration int init_acs(void) +version SUNWprivate_1.1 +end + +function innstr +declaration int innstr(char *s, int n) +version SUNW_1.1 +end + +function innwstr +declaration int innwstr(wchar_t *ws, int n); +version SUNW_1.1 +end + +function insch +declaration int insch(chtype c) +version SUNW_1.1 +end + +function insdelln +declaration int insdelln(int id) +version SUNW_1.1 +end + +function insertln +declaration int insertln(void) +version SUNW_1.1 +end + +function insnstr +declaration int insnstr(char *s, int n) +version SUNW_1.1 +end + +function insnwstr +declaration int insnwstr(wchar_t *ws, int n) +version SUNW_1.1 +end + +function insstr +declaration int insstr(char *s) +version SUNW_1.1 +end + +function instr +declaration int instr(char *s) +version SUNW_1.1 +end + +function inswch +declaration int inswch(chtype c) +version SUNW_1.1 +end + +function inswstr +declaration int inswstr(wchar_t *ws) +version SUNW_1.1 +end + +function intrflush +declaration int intrflush(WINDOW *win, int flag) +version SUNW_1.1 +end + +function inwch +declaration chtype inwch(void) +version SUNW_1.1 +end + +function inwchnstr +declaration int inwchnstr(chtype *str, int n) +version SUNW_1.1 +end + +function inwchstr +declaration int inwchstr(chtype *str) +version SUNW_1.1 +end + +function inwstr +declaration int inwstr(wchar_t *ws) +version SUNW_1.1 +end + +function is_linetouched +declaration int is_linetouched(WINDOW *win, int line) +version SUNW_1.1 +end + +function is_wintouched +declaration int is_wintouched(WINDOW *win) +version SUNW_1.1 +end + +function leaveok +include <curses.h>, <term.h> +declaration int leaveok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function makenew +declaration WINDOW *makenew(int nlines, int ncols, int begy, int begx) +version SUNWprivate_1.1 +end + +function mbcharlen +declaration int mbcharlen(char *sp) +version SUNWprivate_1.1 +end + +function mbdisplen +declaration int mbdisplen(char *sp) +version SUNWprivate_1.1 +end + +function mbeucw +declaration int mbeucw(int c) +version SUNWprivate_1.1 +end + +function mbgetwidth +declaration void mbgetwidth(void) +version SUNWprivate_1.1 +end + +function mbscrw +declaration int mbscrw(int c) +version SUNWprivate_1.1 +end + +function memSset +declaration void memSset(chtype *s, chtype c, int n) +version SUNWprivate_1.1 +end + +function meta +declaration int meta(WINDOW *win, int flag) +version SUNW_1.1 +end + +function move +declaration int move(int y, int x) +version SUNW_1.1 +end + +function mvaddch +declaration int mvaddch(int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvaddchnstr +declaration int mvaddchnstr(int y, int x, chtype *s, int n) +version SUNW_1.1 +end + +function mvaddchstr +declaration int mvaddchstr(int y, int x, chtype *s) +version SUNW_1.1 +end + +function mvaddnstr +declaration int mvaddnstr(int y, int x, char *s, int n) +version SUNW_1.1 +end + +function mvaddnwstr +declaration int mvaddnwstr(int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvaddstr +declaration int mvaddstr(int y, int x, char *str) +version SUNW_1.1 +end + +function mvaddwch +declaration int mvaddwch(int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvaddwchnstr +declaration int mvaddwchnstr(int y, int x, chtype *str, int n) +version SUNW_1.1 +end + +function mvaddwchstr +declaration int mvaddwchstr(int y, int x, chtype *s) +version SUNW_1.1 +end + +function mvaddwstr +declaration int mvaddwstr(int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvdelch +declaration int mvdelch(int y, int x) +version SUNW_1.1 +end + +function mvgetch +declaration int mvgetch(int y, int x) +version SUNW_1.1 +end + +function mvgetnwstr +declaration int mvgetnwstr(int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvgetstr +declaration int mvgetstr(int y, int x, char *str) +version SUNW_1.1 +end + +function mvgetwch +declaration int mvgetwch(int y, int x) +version SUNW_1.1 +end + +function mvgetwstr +declaration int mvgetwstr(int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvhline +declaration int mvhline(int y, int x, chtype ch, int n) +version SUNWprivate_1.1 +end + +function mvinch +declaration chtype mvinch(int y, int x) +version SUNW_1.1 +end + +function mvinchnstr +declaration int mvinchnstr(int y, int x, chtype *str, int n) +version SUNW_1.1 +end + +function mvinchstr +declaration int mvinchstr(int y, int x, chtype *str) +version SUNW_1.1 +end + +function mvinnstr +declaration int mvinnstr(int y, int x, char *s, int n) +version SUNW_1.1 +end + +function mvinnwstr +declaration int mvinnwstr(int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvinsch +declaration int mvinsch(int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvinsnstr +declaration int mvinsnstr(int y, int x, char *s, int n) +version SUNW_1.1 +end + +function mvinsnwstr +declaration int mvinsnwstr(int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvinsstr +declaration int mvinsstr(int y, int x, char *s) +version SUNW_1.1 +end + +function mvinstr +declaration int mvinstr(int y, int x, char *s) +version SUNW_1.1 +end + +function mvinswch +declaration int mvinswch(int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvinswstr +declaration int mvinswstr(int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvinwch +declaration chtype mvinwch(int y, int x) +version SUNW_1.1 +end + +function mvinwchnstr +declaration int mvinwchnstr(int y, int x, chtype *str, int n) +version SUNW_1.1 +end + +function mvinwchstr +declaration int mvinwchstr(int y, int x, chtype *str) +version SUNW_1.1 +end + +function mvinwstr +declaration int mvinwstr(int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvvline +declaration int mvvline(int y, int x, chtype c, int n) +version SUNWprivate_1.1 +end + +function mvwaddch +declaration int mvwaddch(WINDOW *win, int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvwaddchnstr +declaration int mvwaddchnstr(WINDOW *win, int y, int x, chtype *ch, int n) +version SUNW_1.1 +end + +function mvwaddchstr +declaration int mvwaddchstr(WINDOW *win, int y, int x, chtype *ch) +version SUNW_1.1 +end + +function mvwaddnstr +declaration int mvwaddnstr(WINDOW *win, int y, int x, char *c, int n) +version SUNW_1.1 +end + +function mvwaddnwstr +declaration int mvwaddnwstr(WINDOW *win, int y, int x, wchar_t *wc, int n) +version SUNW_1.1 +end + +function mvwaddstr +declaration int mvwaddstr(WINDOW *win, int y, int x, char *str) +version SUNW_1.1 +end + +function mvwaddwch +declaration int mvwaddwch(WINDOW *win, int y, int x, chtype ch) +version SUNW_1.1 +end + +function mvwaddwchnstr +declaration int mvwaddwchnstr(WINDOW *win, int y, int x, chtype *str, int n) +version SUNW_1.1 +end + +function mvwaddwchstr +declaration int mvwaddwchstr(WINDOW *win, int y, int x, chtype *str) +version SUNW_1.1 +end + +function mvwaddwstr +declaration int mvwaddwstr(WINDOW *win, int y, int x, wchar_t *wc) +version SUNW_1.1 +end + +function mvwdelch +declaration int mvwdelch(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function mvwgetch +declaration int mvwgetch(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function mvwgetnwstr +declaration int mvwgetnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvwgetstr +declaration int mvwgetstr(WINDOW *win, int y, int x, char *str) +version SUNW_1.1 +end + +function mvwgetwch +declaration int mvwgetwch(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function mvwgetwstr +declaration int mvwgetwstr(WINDOW *win, int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvwhline +declaration int mvwhline(WINDOW *win, int y, int x, chtype c, int n) +version SUNWprivate_1.1 +end + +function mvwinch +declaration chtype mvwinch(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function mvwinchnstr +declaration int mvwinchnstr(WINDOW *win, int y, int x, chtype *s, int n) +version SUNW_1.1 +end + +function mvwinchstr +declaration int mvwinchstr(WINDOW *win, int y, int x, chtype *str) +version SUNW_1.1 +end + +function mvwinnstr +declaration int mvwinnstr(WINDOW *win, int y, int x, char *str, int n) +version SUNW_1.1 +end + +function mvwinnwstr +declaration int mvwinnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvwinsch +declaration int mvwinsch(WINDOW *win, int y, int x, chtype c) +version SUNW_1.1 +end + +function mvwinsnstr +declaration int mvwinsnstr(WINDOW *win, int y, int x, char *str, int n) +version SUNW_1.1 +end + +function mvwinsnwstr +declaration int mvwinsnwstr(WINDOW *win, int y, int x, wchar_t *ws, int n) +version SUNW_1.1 +end + +function mvwinsstr +declaration int mvwinsstr(WINDOW *win, int y, int x, char *str) +version SUNW_1.1 +end + +function mvwinstr +declaration int mvwinstr(WINDOW *win, int y, int x, char *str) +version SUNW_1.1 +end + +function mvwinswch +declaration int mvwinswch(WINDOW *win, int y, int x, chtype c) +version SUNW_1.1 +end + +function mvwinswstr +declaration int mvwinswstr(WINDOW *win, int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvwinwch +declaration chtype mvwinwch(WINDOW *win, int y, int x) +version SUNW_1.1 +end + +function mvwinwchnstr +declaration int mvwinwchnstr(WINDOW *win, int y, int x, chtype *str, int n) +version SUNW_1.1 +end + +function mvwinwchstr +declaration int mvwinwchstr(WINDOW *win, int y, int x, chtype *str) +version SUNW_1.1 +end + +function mvwinwstr +declaration int mvwinwstr(WINDOW *win, int y, int x, wchar_t *ws) +version SUNW_1.1 +end + +function mvwvline +declaration int mvwvline(WINDOW *win, int y, int x, chtype c, int n) +version SUNWprivate_1.1 +end + +function nl +declaration int nl(void) +version SUNW_1.1 +end + +function nodelay +include <curses.h>, <term.h> +declaration int nodelay(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function noecho +declaration int noecho(void) +version SUNW_1.1 +end + +function nonl +declaration int nonl(void) +version SUNW_1.1 +end + +function noqiflush +declaration void noqiflush(void) +version SUNW_1.1 +end + +function notimeout +include <curses.h>, <term.h> +declaration int notimeout(WINDOW *win, bool bf) +version SUNW_1.1 +end + +data numcodes +version SUNWprivate_1.1 +end + +data numfnames +version SUNWprivate_1.1 +end + +data numnames +version SUNWprivate_1.1 +end + +data ospeed +version SUNWprivate_1.1 +end + +data outchcount +version SUNWprivate_1.1 +end + +function overlay +declaration int overlay(WINDOW *src, WINDOW *dst) +version SUNW_1.1 +end + +function overwrite +declaration int overwrite(WINDOW *src, WINDOW *dst) +version SUNW_1.1 +end + +data prog_istermios +version SUNWprivate_1.1 +end + +function pr_bfooting +declaration void pr_bfooting(void) +version SUNWprivate_1.1 +end + +function pr_bheading +declaration void pr_bheading(void) +version SUNWprivate_1.1 +end + +function pr_boolean +declaration void pr_boolean(char *infoname, char *capname, \ + char *fullname, int value) +version SUNWprivate_1.1 +end + +function pr_caprestrict +declaration void pr_caprestrict(int onoff) +version SUNWprivate_1.1 +end + +function pr_heading +declaration void pr_heading(char *term, char *synonyms) +version SUNWprivate_1.1 +end + +function pr_init +include <print.h> +declaration void pr_init(enum printtypes type) +version SUNWprivate_1.1 +end + +function pr_nfooting +declaration void pr_nfooting(void) +version SUNWprivate_1.1 +end + +function pr_nheading +declaration void pr_nheading(void) +version SUNWprivate_1.1 +end + +function pr_number +declaration void pr_number(char *infoname, char *capname, \ + char *fullname, int value) +version SUNWprivate_1.1 +end + +function pr_onecolumn +declaration void pr_onecolumn(int onoff) +version SUNWprivate_1.1 +end + +function pr_sfooting +declaration void pr_sfooting(void) +version SUNWprivate_1.1 +end + +function pr_sheading +declaration void pr_sheading(void) +version SUNWprivate_1.1 +end + +function pr_string +declaration void pr_string(char *infoname, char *capname, \ + char *fullname, char *value) +version SUNWprivate_1.1 +end + +function pr_width +declaration void pr_width(int nwidth) +version SUNWprivate_1.1 +end + +data progname +version SUNWprivate_1.1 +end + +function putp +declaration int putp(char *str) +version SUNW_1.1 +end + +function qiflush +declaration void qiflush(void) +version SUNW_1.1 +end + +function refresh +declaration int refresh(void) +version SUNW_1.1 +end + +function resetterm +declaration int resetterm(void) +version SUNWprivate_1.1 +end + +function restartterm +declaration int restartterm(char * term, int filenum, int *errret) +version SUNW_1.1 +end + +function rmpadding +declaration char *rmpadding(char *str, char *padbuffer, int *padding) +version SUNWprivate_1.1 +end + +function saveterm +declaration int saveterm(void) +version SUNWprivate_1.1 +end + +function scr_init +declaration int scr_init(char *file) +version SUNW_1.1 +end + +function scr_ll_dump +declaration int scr_ll_dump(FILE *filep) +version SUNWprivate_1.1 +end + +function scr_reset +declaration int scr_reset(FILE *filep, int type) +version SUNWprivate_1.1 +end + +function scr_restore +declaration int scr_restore(char *file) +version SUNW_1.1 +end + +function scr_set +declaration int scr_set(char *file) +version SUNW_1.1 +end + +function scrl +declaration int scrl(int n) +version SUNW_1.1 +end + +function scroll +declaration int scroll(WINDOW *win) +version SUNW_1.1 +end + +function scrollok +include <curses.h>, <term.h> +declaration int scrollok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +function set_curterm +include <curses.h>, <term.h> +declaration TERMINAL *set_curterm(TERMINAL *newterminal) +version SUNWprivate_1.1 +end + +function set_term +include <curses.h>, <term.h> +declaration SCREEN *set_term(SCREEN *screen) +version SUNW_1.1 +end + +function setkeymap +declaration int setkeymap(void) +version SUNWprivate_1.1 +end + +function setscrreg +declaration int setscrreg(int t, int b) +version SUNW_1.1 +end + +function setterm +declaration int setterm(char *name) +version SUNW_1.1 +end + +data shell_istermios +version SUNWprivate_1.1 +end + +function slk_init +declaration int slk_init(int f) +version SUNW_1.1 +end + +function standend +declaration int standend(void) +version SUNW_1.1 +end + +function standout +declaration int standout(void) +version SUNW_1.1 +end + +data stdscr +version SUNWprivate_1.1 +end + +data strcodes +version SUNWprivate_1.1 +end + +data strfnames +version SUNWprivate_1.1 +end + +data strnames +version SUNWprivate_1.1 +end + +function subpad +include <curses.h>, <term.h> +declaration WINDOW *subpad(WINDOW *win, int l, int nc, int by, int bx) +version SUNW_1.1 +end + +function subwin +include <curses.h>, <term.h> +declaration WINDOW *subwin(WINDOW *win, int l, int nc, int by, int bx) +version SUNW_1.1 +end + +function syncok +include <curses.h>, <term.h> +declaration int syncok(WINDOW *win, bool bf) +version SUNW_1.1 +end + +data term_err_strings +version SUNWprivate_1.1 +end + +data term_errno +version SUNWprivate_1.1 +end + +data term_parm_err +version SUNWprivate_1.1 +end + +function termerr +declaration void termerr(void) +version SUNWprivate_1.1 +end + +function tgetch +declaration int tgetch(int interpret) +version SUNWprivate_1.1 +end + +function tgetent +declaration int tgetent(char *bp, char *name) +version SUNW_1.1 +end + +function tgetflag +declaration int tgetflag(char *tcstr) +version SUNW_1.1 +end + +function tgetnum +declaration int tgetnum(char *tcstr) +version SUNW_1.1 +end + +function tgetstr +declaration char *tgetstr(char *tcstr, char **area) +version SUNW_1.1 +end + +function tgetwch +declaration wchar_t tgetwch(int cntl) +version SUNWprivate_1.1 +end + +function tgoto +declaration char *tgoto(char *cap, int col, int row) +version SUNW_1.1 +end + +function tifgetflag +declaration int tifgetflag(char *tistr) +version SUNWprivate_1.1 +end + +function tifgetnum +declaration int tifgetnum(char *tistr) +version SUNWprivate_1.1 +end + +function tifgetstr +declaration char *tifgetstr(char *tistr) +version SUNWprivate_1.1 +end + +function tigetflag +declaration int tigetflag(char *tistr) +version SUNW_1.1 +end + +function tigetnum +declaration int tigetnum(char *tistr) +version SUNW_1.1 +end + +function tigetstr +declaration char *tigetstr(char *tistr) +version SUNW_1.1 +end + +function timeout +declaration void timeout(int tm) +version SUNW_1.1 +end + +function tinputfd +declaration void tinputfd(int fd) +version SUNWprivate_1.1 +end + +function touchline +include <curses.h>, <term.h> +declaration int touchline(WINDOW *win, int y, int n) +version SUNW_1.1 +end + +function touchwin +include <curses.h>, <term.h> +declaration int touchwin(WINDOW *win) +version SUNW_1.1 +end + +function tparm +declaration char *tparm(char *str, long int p1, long int p2, long int p3, \ + long int p4, long int p5, long int p6, long int p7, \ + long int p8, long int p9) +version SUNW_1.1 +end + +function tparm_p0 +declaration char *tparm_p0(char *instring) +version SUNWprivate_1.1 +end + +function tparm_p1 +declaration char *tparm_p1(char *instring, long l1) +version SUNWprivate_1.1 +end + +function tparm_p2 +declaration char *tparm_p2(char *instring, long l1, long l2) +version SUNWprivate_1.1 +end + +function tparm_p3 +declaration char *tparm_p3(char *instring, long l1, long l2, long l3) +version SUNWprivate_1.1 +end + +function tparm_p4 +declaration char *tparm_p4(char *instring, long l1, long l2, \ + long l3, long l4) +version SUNWprivate_1.1 +end + +function tparm_p7 +declaration char *tparm_p7(char *instring, long l1, long l2, \ + long l3, long l4, long l5, long l6, long l7) +version SUNWprivate_1.1 +end + +function tpr +declaration void tpr(FILE *stream, char *string) +version SUNWprivate_1.1 +end + +function tputs +declaration int tputs(char *cp, int affcnt, int (*outc)(char)) +version SUNW_1.1 +end + +function ttimeout +declaration int ttimeout(int delay) +version SUNWprivate_1.1 +end + +data ttytype +version SUNWprivate_1.1 +end + +function untouchwin +include <curses.h>, <term.h> +declaration int untouchwin(WINDOW *win) +version SUNW_1.1 +end + +function use_env +declaration void use_env(int bf) +version SUNWprivate_1.1 +end + +function vid32attr extends libcurses/spec/curses.spec vidattr +version SUNWprivate_1.1 +end + +function vid32puts extends libcurses/spec/curses.spec vidputs +version SUNWprivate_1.1 +end + +function vidattr +declaration int vidattr(chtype newmode) +version SUNW_1.1 +end + +function vidputs +declaration int vidputs(chtype a, int (*b)(char)) +version SUNW_1.1 +end + +function vline +declaration int vline(chtype vertch, int num_chars) +version SUNWprivate_1.1 +end + +function waddchstr +include <curses.h>, <term.h> +declaration int waddchstr(WINDOW *win, chtype *str) +version SUNW_1.1 +end + +function waddstr +include <curses.h>, <term.h> +declaration int waddstr(WINDOW *win, char *str) +version SUNW_1.1 +end + +function waddwchstr +include <curses.h>, <term.h> +declaration int waddwchstr(WINDOW *win, chtype *str) +version SUNW_1.1 +end + +function waddwstr +include <curses.h>, <term.h> +declaration int waddwstr(WINDOW *win, wchar_t *ws) +version SUNW_1.1 +end + +function wadjcurspos +include <curses.h>, <term.h> +declaration int wadjcurspos(WINDOW *win) +version SUNW_1.1 +end + +function wbkgdset +include <curses.h>, <term.h> +declaration void wbkgdset(WINDOW *win, chtype c) +version SUNW_1.1 +end + +function wclear +include <curses.h>, <term.h> +declaration int wclear(WINDOW *win) +version SUNW_1.1 +end + +function wcscrw +declaration int wcscrw(wchar_t wc) +version SUNWprivate_1.1 +end + +function wdeleteln +include <curses.h>, <term.h> +declaration int wdeleteln(WINDOW *win) +version SUNW_1.1 +end + +function werase +include <curses.h>, <term.h> +declaration int werase(WINDOW *win) +version SUNW_1.1 +end + +function winch +include <curses.h>, <term.h> +declaration chtype winch(WINDOW *win) +version SUNW_1.1 +end + +function winsertln +include <curses.h>, <term.h> +declaration int winsertln(WINDOW *win) +version SUNW_1.1 +end + +function winsstr +include <curses.h>, <term.h> +declaration int winsstr(WINDOW *win, char *str) +version SUNW_1.1 +end + +function winswstr +include <curses.h>, <term.h> +declaration int winswstr(WINDOW *win, wchar_t *ws) +version SUNW_1.1 +end + +function winwchstr +include <curses.h>, <term.h> +declaration int winwchstr(WINDOW *win, chtype *str) +version SUNW_1.1 +end + +function wmbinch +include <curses.h>, <term.h> +declaration char *wmbinch(WINDOW *win, int y, int x) +version SUNWprivate_1.1 +end + +function wmbmove +include <curses.h>, <term.h> +declaration int wmbmove(WINDOW *win, int y, int x) +version SUNWprivate_1.1 +end + +function wmovenextch +include <curses.h>, <term.h> +declaration int wmovenextch(WINDOW *win) +version SUNW_1.1 +end + +function wmoveprevch +include <curses.h>, <term.h> +declaration int wmoveprevch(WINDOW *win) +version SUNW_1.1 +end + +function wtimeout +include <curses.h>, <term.h> +declaration void wtimeout(WINDOW *win, int tm) +version SUNW_1.1 +end diff --git a/usr/src/lib/libcurses/spec/i386/Makefile b/usr/src/lib/libcurses/spec/i386/Makefile new file mode 100644 index 0000000000..44bc48652e --- /dev/null +++ b/usr/src/lib/libcurses/spec/i386/Makefile @@ -0,0 +1,43 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright (c) 1997-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +# lib/libcurses/spec/i386/Makefile + +.KEEP_STATE: + +include ../Makefile.targ + +# Add arch specific objects here +OBJECTS += + +include $(SRC)/lib/Makefile.lib + +# Uncomment the following if the linker complains +#i386_C_PICFLAGS = -K PIC + +include $(SRC)/lib/Makefile.spec + +install: $(ROOTABILIB) diff --git a/usr/src/lib/libcurses/spec/sparc/Makefile b/usr/src/lib/libcurses/spec/sparc/Makefile new file mode 100644 index 0000000000..16877a6747 --- /dev/null +++ b/usr/src/lib/libcurses/spec/sparc/Makefile @@ -0,0 +1,43 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# Copyright (c) 1998-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +# ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/spec/sparc/Makefile + +.KEEP_STATE: + +include ../Makefile.targ + +# Add arch specific objects here +OBJECTS += + +include $(SRC)/lib/Makefile.lib + +# Uncomment the following if the linker complains +sparc_C_PICFLAGS = -K PIC + +include $(SRC)/lib/Makefile.spec + +install: $(ROOTABILIB) diff --git a/usr/src/lib/libcurses/spec/sparcv9/Makefile b/usr/src/lib/libcurses/spec/sparcv9/Makefile new file mode 100644 index 0000000000..d5d3a92af9 --- /dev/null +++ b/usr/src/lib/libcurses/spec/sparcv9/Makefile @@ -0,0 +1,45 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright (c) 1998-1999 by Sun Microsystems, Inc. +# All rights reserved. +# +#pragma ident "%Z%%M% %I% %E% SMI" +# +# lib/libcurses/spec/sparcv9/Makefile + +.KEEP_STATE: + +include ../Makefile.targ + +# Add arch specific objects here +OBJECTS += + +include $(SRC)/lib/Makefile.lib +include $(SRC)/lib/Makefile.lib.64 + +# Uncomment the following if the linker complains +sparcv9_C_PICFLAGS = -K PIC + +include $(SRC)/lib/Makefile.spec + +install: $(ROOTABILIB64) diff --git a/usr/src/lib/libcurses/spec/versions b/usr/src/lib/libcurses/spec/versions new file mode 100644 index 0000000000..38a2cfc77a --- /dev/null +++ b/usr/src/lib/libcurses/spec/versions @@ -0,0 +1,43 @@ +# +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# ident "%Z%%M% %I% %E% SMI" +# + +sparc { + SUNW_1.1; + SUNWprivate_1.1; +} +sparcv9 { + SUNW_1.1; + SUNWprivate_1.1; +} +i386 { + SUNW_1.1; + SUNWprivate_1.1; +} +amd64 { + SUNW_1.1; + SUNWprivate_1.1; +} |