diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk index f199c5829b65..7a64a7b948ee 100644 --- a/lib/ncurses/config.mk +++ b/lib/ncurses/config.mk @@ -1,45 +1,55 @@ # $FreeBSD$ # This Makefile is shared by libncurses, libform, libmenu, libpanel. NCURSES_DIR= ${SRCTOP}/contrib/ncurses +NCURSES_MAJOR= 6 +NCURSES_MINOR= 2 +NCURSES_PATCH= 20200215 -CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC +CFLAGS+= -D_XOPEN_SOURCE_EXTENDED NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h CFLAGS+= -I. CFLAGS+= -I${.CURDIR:H}/ncurses # for ${NCURSES_CFG_H} CFLAGS+= -I${.CURDIR:H}/ncurses CFLAGS+= -I${NCURSES_DIR}/include CFLAGS+= -I${NCURSES_DIR}/ncurses CFLAGS+= -Wall CFLAGS+= -DNDEBUG CFLAGS+= -DHAVE_CONFIG_H # everyone needs this .PATH: ${NCURSES_DIR}/include # tools and directories AWK?= awk TERMINFODIR?= ${SHAREDIR}/misc # Generate headers ncurses_def.h: MKncurses_def.sh ncurses_defs AWK=${AWK} sh ${NCURSES_DIR}/include/MKncurses_def.sh \ ${NCURSES_DIR}/include/ncurses_defs > ncurses_def.h # Manual pages filter MANFILTER= sed -e 's%@TERMINFO@%${TERMINFODIR}/terminfo%g' \ -e 's%@DATADIR@%/usr/share%g' \ -e 's%@NCURSES_OSPEED@%${NCURSES_OSPEED}%g' \ -e 's%@NCURSES_MAJOR@%${NCURSES_MAJOR}%g' \ -e 's%@NCURSES_MINOR@%${NCURSES_MINOR}%g' \ -e 's%@NCURSES_PATCH@%${NCURSES_PATCH}%g' \ + -e 's%@TSET@%tset%g' \ + -e 's%@RESET@%reset%g' \ + -e 's%@CLEAR@%clear%g' \ + -e 's%@TABS@%tabs%g' \ -e 's%@TIC@%tic%g' \ - -e 's%@INFOCMP@%infocmp%g' + -e 's%@TOE@%toe%g' \ + -e 's%@INFOCMP@%infocmp%g' \ + -e 's%@CAPTOINFO@%captoinfo%g' \ + -e 's%@INFOTOCAP@%infotocap%g' diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index 6f03d93a9ac6..aff569a79845 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -1,1147 +1,1144 @@ # $FreeBSD$ PACKAGE= clibs SHLIBDIR?= /lib .include .include "${.CURDIR:H}/config.mk" LIB= ncursesw SHLIB_MAJOR= 9 NO_LINT= NCURSES_MAJOR!= egrep 'NCURSES_MAJOR[ ]*=' ${NCURSES_DIR}/dist.mk | sed -e 's%^[^0-9]*%%' NCURSES_MINOR!= egrep 'NCURSES_MINOR[ ]*=' ${NCURSES_DIR}/dist.mk | sed -e 's%^[^0-9]*%%' NCURSES_PATCH!= egrep 'NCURSES_PATCH[ ]*=' ${NCURSES_DIR}/dist.mk | sed -e 's%^[^0-9]*%%' # From autoconf (!) NCURSES_CH_T= cchar_t NCURSES_OK_WCHAR_T= 1 NEED_WCHAR_H= 1 NCURSES_EXT_COLORS= 1 NCURSES_EXT_FUNCS= 1 NCURSES_CONST= const NCURSES_INLINE= inline NCURSES_LIBUTF8= 0 NCURSES_MBSTATE_T= 0 NCURSES_MOUSE_VERSION= 2 NCURSES_INTEROP_FUNCS= 1 NCURSES_OPAQUE= 0 NCURSES_OPAQUE= 0 NCURSES_OPAQUE_FORM= 0 NCURSES_OPAQUE_MENU= 0 NCURSES_OPAQUE_PANEL= 0 NCURSES_OSPEED= short NCURSES_SBOOL= char NCURSES_SIZE_T= short NCURSES_TPARM_VARARGS= 1 NCURSES_WCHAR_T= 0 NCURSES_WINT_T= 0 NCURSES_XNAMES= 1 NCURSES_WCWIDTH_GRAPHICS= 1 NCURSES_WATTR_MACROS= 1 NCURSES_TPARM_ARG= intptr_t NCURSES_SP_FUNCS= 1 BROKEN_LINKER= 0 BUILTIN_BOOL= 1 ENABLE_LP64= 1 ENABLE_OPAQUE= NCURSES_OPAQUE ENABLE_REENTRANT= 0 HAVE_TCGETATTR= 1 HAVE_TERMIOS_H= 1 HAVE_TERMIO_H= 0 HAVE_VSSCANF= 1 HAVE_STDINT_H= 1 HEADER_STDBOOL= 1 # XXX amd64 1L and int ONEUL= 1U TYPEOF_CHTYPE= uint32_t TYPEOF_MMASK_T= uint32_t TYPE_OF_BOOL= unsigned char USE_BIG_STRINGS= 1 USE_CXX_BOOL= defined(__cplusplus) GENSRCS= \ codes.c \ expanded.c \ fallback.c \ lib_gen.c \ lib_keyname.c \ names.c \ unctrl.c GENHDRS= \ curses.h \ hashsize.h \ init_keytry.h \ ncurses_def.h \ nomacros.h \ parametrized.h \ term.h \ termcap.h \ unctrl.h SRCS= ${GENHDRS} ${GENSRCS} .PATH: ${NCURSES_DIR}/ncurses/base SRCS+= \ define_key.c \ key_defined.c \ keybound.c \ keyok.c \ legacy_coding.c \ lib_addch.c \ lib_addstr.c \ lib_beep.c \ lib_bkgd.c \ lib_box.c \ lib_chgat.c \ lib_clear.c \ lib_clearok.c \ lib_clrbot.c \ lib_clreol.c \ lib_color.c \ lib_colorset.c \ lib_delch.c \ lib_delwin.c \ lib_dft_fgbg.c \ lib_echo.c \ lib_endwin.c \ lib_erase.c \ lib_flash.c \ lib_freeall.c \ lib_getch.c \ lib_getstr.c \ lib_hline.c \ lib_immedok.c \ lib_inchstr.c \ lib_initscr.c \ lib_insch.c \ lib_insdel.c \ lib_insnstr.c \ lib_instr.c \ lib_isendwin.c \ lib_leaveok.c \ lib_mouse.c \ lib_move.c \ lib_mvwin.c \ lib_newterm.c \ lib_newwin.c \ lib_nl.c \ lib_overlay.c \ lib_pad.c \ lib_printw.c \ lib_redrawln.c \ lib_refresh.c \ lib_restart.c \ lib_scanw.c \ lib_screen.c \ lib_scroll.c \ lib_scrollok.c \ lib_scrreg.c \ lib_set_term.c \ lib_slk.c \ lib_slkatr_set.c \ lib_slkatrof.c \ lib_slkatron.c \ lib_slkatrset.c \ lib_slkattr.c \ lib_slkclear.c \ lib_slkcolor.c \ lib_slkinit.c \ lib_slklab.c \ lib_slkrefr.c \ lib_slkset.c \ lib_slktouch.c \ lib_touch.c \ lib_ungetch.c \ lib_vline.c \ lib_wattroff.c \ lib_wattron.c \ lib_winch.c \ lib_window.c \ new_pair.c \ nc_panel.c \ resizeterm.c \ safe_sprintf.c \ tries.c \ version.c \ vsscanf.c \ wresize.c .PATH: ${NCURSES_DIR}/ncurses/tinfo SRCS+= \ access.c \ add_tries.c \ alloc_entry.c \ alloc_ttype.c \ captoinfo.c \ comp_captab.c \ comp_error.c \ comp_expand.c \ comp_hash.c \ comp_parse.c \ comp_scan.c \ comp_userdefs.c \ db_iterator.c \ doalloc.c \ entries.c \ free_ttype.c \ getenv_num.c \ hashed_db.c \ home_terminfo.c \ init_keytry.c \ lib_acs.c \ lib_baudrate.c \ lib_cur_term.c \ lib_data.c \ lib_has_cap.c \ lib_kernel.c \ lib_longname.c \ lib_napms.c \ lib_options.c \ lib_print.c \ lib_raw.c \ lib_setup.c \ lib_termcap.c \ lib_termname.c \ lib_tgoto.c \ lib_ti.c \ lib_tparm.c \ lib_tputs.c \ lib_ttyflags.c \ name_match.c \ obsolete.c \ parse_entry.c \ read_entry.c \ + read_termcap.c \ strings.c \ trim_sgr0.c \ write_entry.c .PATH: ${NCURSES_DIR}/ncurses/tty SRCS+= \ hardscroll.c \ hashmap.c \ lib_mvcur.c \ lib_tstp.c \ lib_twait.c \ lib_vidattr.c \ tty_update.c .PATH: ${NCURSES_DIR}/ncurses/widechar SRCS+= \ charable.c \ lib_add_wch.c \ lib_box_set.c \ lib_cchar.c \ lib_erasewchar.c \ lib_get_wch.c \ lib_get_wstr.c \ lib_hline_set.c \ lib_in_wch.c \ lib_in_wchnstr.c \ lib_ins_wch.c \ lib_inwstr.c \ lib_key_name.c \ lib_pecho_wchar.c \ lib_slk_wset.c \ lib_unget_wch.c \ lib_vid_attr.c \ lib_vline_set.c \ lib_wacs.c \ lib_wunctrl.c .PATH: ${NCURSES_DIR}/ncurses/trace SRCS+= \ lib_trace.c \ visbuf.c # Currently unused, for debugging libncurses itself. DBGSRCS= \ lib_traceatr.c \ lib_tracebits.c \ lib_tracechr.c \ lib_tracedmp.c \ lib_tracemse.c \ trace_buf.c \ trace_tries.c \ trace_xnames.c \ varargs.c -# From our old libtermcap. -# Used instead of the hideous read_termcap.c abomination. -SRCS+= termcap.c - CLEANFILES= ${GENSRCS} ${GENHDRS} keys.list make_hash term.h.new \ make_keys MKterm.h.awk comp_captab.c curses.head -CFLAGS+= -DFREEBSD_NATIVE -DTERMIOS +CFLAGS+= -DTERMIOS # Installed HEADERS= curses.h term.h termcap.h unctrl.h SRCHDRS= ncurses_dll.h CLEANFILES+= ncurses_dll.h INCS= ${HEADERS} ${SRCHDRS} INCSLINKS= curses.h ${INCLUDEDIR}/ncurses.h .if ${MK_INSTALLLIB} != "no" SYMLINKS+= libncursesw.a ${LIBDIR}/libcursesw.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcapw.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlibw.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfow.a # backward compat SYMLINKS+= libncursesw.a ${LIBDIR}/libncurses.a SYMLINKS+= libncursesw.a ${LIBDIR}/libcurses.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcap.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlib.a SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfo.a .endif .if !defined(NO_PIC) # no need for major at all, it's an ld-time redirection only SYMLINKS+= libncursesw.so ${LIBDIR}/libcursesw.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcapw.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlibw.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfow.so # backward compat SYMLINKS+= libncursesw.so ${LIBDIR}/libncurses.so SYMLINKS+= libncursesw.so ${LIBDIR}/libcurses.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcap.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlib.so SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfo.so .endif .if ${MK_PROFILE} != "no" SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcursesw_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcapw_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlibw_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfow_p.a # backward compat SYMLINKS+= libncursesw_p.a ${LIBDIR}/libncurses_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcurses_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcap_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlib_p.a SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfo_p.a .endif DOCSDIR= ${SHAREDIR}/doc/ncurses DOCS= ncurses-intro.html hackguide.html .if ${MK_HTML} != "no" .PATH: ${NCURSES_DIR}/doc/html FILESGROUPS= DOCS .endif # Generated source .ORDER: names.c codes.c names.c: MKnames.awk ${AWK} -f ${NCURSES_DIR}/ncurses/tinfo/MKnames.awk bigstrings=${USE_BIG_STRINGS} ${NCURSES_DIR}/include/Caps > names.c codes.c: MKcodes.awk ${AWK} -f ${NCURSES_DIR}/ncurses/tinfo/MKcodes.awk bigstrings=${USE_BIG_STRINGS} ${NCURSES_DIR}/include/Caps > codes.c lib_gen.c: MKlib_gen.sh curses.h ncurses_dll.h LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CPP:N${CCACHE_BIN}} ${CFLAGS}" \ "${AWK}" generated < curses.h >$@ lib_keyname.c: keys.list MKkeyname.awk ${AWK} -f ${NCURSES_DIR}/ncurses/base/MKkeyname.awk bigstrings=${USE_BIG_STRINGS} keys.list > lib_keyname.c unctrl.c: MKunctrl.awk echo | ${AWK} -f ${NCURSES_DIR}/ncurses/base/MKunctrl.awk bigstrings=${USE_BIG_STRINGS} > unctrl.c comp_captab.c: MKcaptab.sh MKcaptab.awk Caps Caps-ncurses make_hash env PATH=${BTOOLSPATH:U.}:${PATH} sh ${NCURSES_DIR}/ncurses/tinfo/MKcaptab.sh "${AWK}" \ ${USE_BIG_STRINGS} ${NCURSES_DIR}/ncurses/tinfo/MKcaptab.awk \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses > comp_captab.c expanded.c: MKexpanded.sh sh ${NCURSES_DIR}/ncurses/tty/MKexpanded.sh "${CC:N${CCACHE_BIN}} -E" ${CFLAGS} >expanded.c fallback.c: MKfallback.sh sh ${NCURSES_DIR}/ncurses/tinfo/MKfallback.sh "" "" "" > ${.TARGET}.tmp && \ mv -f ${.TARGET}.tmp ${.TARGET} comp_userdefs.c: MKuserdefs.sh Caps Caps-ncurses make_hash env PATH=${BTOOLSPATH:U.}:${PATH} sh -x ${NCURSES_DIR}/ncurses/tinfo/MKuserdefs.sh "${AWK}" \ ${USE_BIG_STRINGS} ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses > ${.TARGET} # Generated headers nomacros.h: MKlib_gen.sh curses.h LC_ALL=C sh ${NCURSES_DIR}/ncurses/base/MKlib_gen.sh "${CC:N${CCACHE_BIN}} -E ${CFLAGS}" \ "${AWK}" generated < curses.h | fgrep undef > $@ init_keytry.h: keys.list make_keys ${BTOOLSPATH:U.}/make_keys keys.list > init_keytry.h hashsize.h: MKhashsize.sh Caps Caps-ncurses sh ${NCURSES_DIR}/include/MKhashsize.sh ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses > $@ parametrized.h: MKparametrized.sh Caps Caps-ncurses AWK=${AWK} sh ${NCURSES_DIR}/include/MKparametrized.sh \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses > $@ term.h: MKterm.h.awk edit_cfg.sh Caps Caps-ncurses ${AWK} -f MKterm.h.awk ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses > $@.new sh ${NCURSES_DIR}/include/edit_cfg.sh ${NCURSES_CFG_H} $@.new mv -f $@.new $@ curses.h: curses.head MKkey_defs.sh Caps Caps-ncurses cat curses.head > $@.new AWK=${AWK} _POSIX2_VERSION=199209 sh ${NCURSES_DIR}/include/MKkey_defs.sh \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses >> $@.new cat ${NCURSES_DIR}/include/curses.wide >> $@.new cat ${NCURSES_DIR}/include/curses.tail >> $@.new mv -f $@.new $@ # Generated intermediate files keys.list: MKkeys_list.sh Caps Caps-ncurses AWK=${AWK} sh ${NCURSES_DIR}/ncurses/tinfo/MKkeys_list.sh \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses | LC_ALL=C sort > keys.list # Build tools DEPENDOBJS+= make_hash make_keys build-tools: make_hash make_keys make_keys: make_keys.c names.c ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} ${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} ${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} -DMAIN_PROGRAM \ ${NCURSES_DIR}/ncurses/tinfo/make_hash.c # ./configure generated MKterm.h.awk: MKterm.h.awk.in sed <${NCURSES_DIR}/include/MKterm.h.awk.in >$@ \ -e "/@BROKEN_LINKER@/s%%${BROKEN_LINKER}%" \ - -e "s%@NCURSES_USE_DATABASE@%0%g" \ + -e "s%@NCURSES_USE_DATABASE@%1%g" \ -e "s%@NCURSES_USE_TERMCAP@%1%g" \ -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \ -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \ -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \ -e "/@NCURSES_TPARM_VARARGS@/s%%${NCURSES_TPARM_VARARGS}%" \ -e "/@NCURSES_SBOOL@/s%%${NCURSES_SBOOL}%" \ -e "/@NCURSES_XNAMES@/s%%${NCURSES_XNAMES}%" \ -e "/@NCURSES_EXT_COLORS@/s%%${NCURSES_EXT_COLORS}%" \ -e "/@HAVE_TERMIOS_H@/s%%${HAVE_TERMIOS_H}%" \ -e "/@HAVE_TERMIO_H@/s%%${HAVE_TERMIO_H}%" \ -e "/@HAVE_TCGETATTR@/s%%${HAVE_TCGETATTR}%" \ -e "s%@cf_cv_enable_reentrant@%${ENABLE_REENTRANT}%g" termcap.h: termcap.h.in sed <${NCURSES_DIR}/include/termcap.h.in >$@ \ -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \ -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \ -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \ -e "/@NCURSES_OSPEED@/s%%${NCURSES_OSPEED}%" ncurses_dll.h: ncurses_dll.h.in sed <${NCURSES_DIR}/include/ncurses_dll.h.in >$@ \ -e "s%@NCURSES_WRAP_PREFIX@%_nc_%g" curses.head: curses.h.in sed <${NCURSES_DIR}/include/curses.h.in >$@ \ -e "/@BROKEN_LINKER@/s%%${BROKEN_LINKER}%" \ -e "/@HAVE_VSSCANF@/s%%${HAVE_VSSCANF}%" \ -e "/@HAVE_STDINT_H@/s%%${HAVE_STDINT_H}%" \ -e "/@NCURSES_CH_T@/s%%${NCURSES_CH_T}%" \ -e "/@NCURSES_CONST@/s%%${NCURSES_CONST}%" \ -e "/@NCURSES_EXT_COLORS@/s%%${NCURSES_EXT_COLORS}%" \ -e "/@NCURSES_EXT_FUNCS@/s%%${NCURSES_EXT_FUNCS}%" \ -e "/@NCURSES_INLINE@/s%%${NCURSES_INLINE}%" \ -e "/@NCURSES_LIBUTF8@/s%%${NCURSES_LIBUTF8}%" \ -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \ -e "/@NCURSES_MBSTATE_T@/s%%${NCURSES_MBSTATE_T}%" \ -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" \ -e "/@NCURSES_MOUSE_VERSION@/s%%${NCURSES_MOUSE_VERSION}%" \ -e "/@NCURSES_OK_WCHAR_T@/s%%${NCURSES_OK_WCHAR_T}%" \ -e "/@NCURSES_OPAQUE@/s%%${NCURSES_OPAQUE}%" \ -e "/@NCURSES_OPAQUE_FORM@/s%%${NCURSES_OPAQUE_FORM}%" \ -e "/@NCURSES_OPAQUE_MENU@/s%%${NCURSES_OPAQUE_MENU}%" \ -e "/@NCURSES_OPAQUE_PANEL@/s%%${NCURSES_OPAQUE_PANEL}%" \ -e "/@NCURSES_PATCH@/s%%${NCURSES_PATCH}%" \ -e "/@NCURSES_SIZE_T@/s%%${NCURSES_SIZE_T}%" \ -e "/@NCURSES_TPARM_VARARGS@/s%%${NCURSES_TPARM_VARARGS}%" \ -e "/@NCURSES_WATTR_MACROS@/s%%${NCURSES_WATTR_MACROS}%"\ -e "/@NCURSES_WCHAR_T@/s%%${NCURSES_WCHAR_T}%" \ -e "/@NCURSES_WCHAR_T@/s%%${NCURSES_WCHAR_T}%" \ -e "/@NCURSES_WCWIDTH_GRAPHICS@/s%%${NCURSES_WCWIDTH_GRAPHICS}%g" \ -e "/@NCURSES_WINT_T@/s%%${NCURSES_WINT_T}%" \ -e "/@NCURSES_INTEROP_FUNCS@/s%%${NCURSES_INTEROP_FUNCS}%g" \ -e "/@NCURSES_TPARM_ARG@/s%%${NCURSES_TPARM_ARG}%g" \ -e "/@NCURSES_SP_FUNCS@/s%%${NCURSES_SP_FUNCS}%g" \ -e "/@NEED_WCHAR_H@/s%%${NEED_WCHAR_H}%" \ -e "/@USE_CXX_BOOL@/s%%${USE_CXX_BOOL}%" \ -e "/@GENERATED_EXT_FUNCS@/s%%generated%g" \ -e "s%@NCURSES_CCHARW_MAX@%5%g" \ -e "s%@cf_cv_1UL@%${ONEUL}%g" \ -e "s%@cf_cv_builtin_bool@%${BUILTIN_BOOL}%g" \ -e "s%@cf_cv_enable_lp64@%${ENABLE_LP64}%g" \ -e "s%@cf_cv_enable_opaque@%${ENABLE_OPAQUE}%g" \ -e "s%@cf_cv_enable_reentrant@%${ENABLE_REENTRANT}%g" \ -e "s%@cf_cv_header_stdbool_h@%${HEADER_STDBOOL}%g" \ -e "s%@cf_cv_type_of_bool@%${TYPE_OF_BOOL}%g" \ -e "s%@cf_cv_typeof_chtype@%${TYPEOF_CHTYPE}%g" \ -e "s%@cf_cv_typeof_mmask_t@%${TYPEOF_MMASK_T}%g" \ -e "s/ _WCHAR_T/ __wchar_t/g" \ -e "s/ _WINT_T/ __wint_t/g" unctrl.h: unctrl.h.in sed <${NCURSES_DIR}/include/$@.in >$@ \ -e "s%@NCURSES_SP_FUNCS@%${NCURSES_SP_FUNCS}%g" \ -e "/@NCURSES_MAJOR@/s%%${NCURSES_MAJOR}%" \ -e "/@NCURSES_MINOR@/s%%${NCURSES_MINOR}%" # MAN page gunk terminfo.5: MKterminfo.sh terminfo.head Caps sh ${NCURSES_DIR}/man/MKterminfo.sh ${NCURSES_DIR}/man/terminfo.head \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/man/terminfo.tail >$@ CLEANFILES+= terminfo.5 .PATH: ${NCURSES_DIR}/man MAN= \ curs_addch.3 \ curs_addchstr.3 \ curs_addstr.3 \ curs_attr.3 \ curs_beep.3 \ curs_bkgd.3 \ curs_bkgrnd.3 \ curs_border.3 \ curs_border_set.3 \ curs_clear.3 \ curs_color.3 \ curs_delch.3 \ curs_deleteln.3 \ curs_extend.3 \ curs_getcchar.3 \ curs_getch.3 \ curs_getstr.3 \ curs_getyx.3 \ curs_inch.3 \ curs_inchstr.3 \ curs_initscr.3 \ curs_inopts.3 \ curs_insch.3 \ curs_insstr.3 \ curs_instr.3 \ curs_inwstr.3 \ curs_kernel.3 \ curs_legacy.3 \ curs_memleaks.3 \ curs_mouse.3 \ curs_move.3 \ curs_opaque.3 \ curs_outopts.3 \ curs_overlay.3 \ curs_pad.3 \ curs_print.3 \ curs_refresh.3 \ curs_scr_dump.3 \ curs_scroll.3 \ curs_slk.3 \ curs_sp_funcs.3 \ curs_termattrs.3 \ curs_termcap.3 \ curs_terminfo.3 \ curs_threads.3 \ curs_touch.3 \ curs_trace.3 \ curs_util.3 \ curs_variables.3 \ curs_window.3 \ default_colors.3 \ define_key.3 \ key_defined.3 \ keybound.3 \ keyok.3 \ legacy_coding.3 \ ncurses.3 \ new_pair.3 \ resizeterm.3 \ term_variables.3 \ wresize.3 MAN+= \ curs_add_wch.3 \ curs_add_wchstr.3 \ curs_addwstr.3 \ curs_get_wch.3 \ curs_get_wstr.3 \ curs_in_wch.3 \ curs_in_wchstr.3 \ curs_ins_wch.3 \ curs_ins_wstr.3 \ curs_printw.3 \ curs_scanw.3 MAN+= term.5 terminfo.5 scr_dump.5 user_caps.5 MAN+= term.7 CLEANFILES+= ${MAN:M*.3} MLINKS= ncurses.3 curses.3 \ curs_addch.3 addch.3 \ curs_addch.3 echochar.3 \ curs_addch.3 mvaddch.3 \ curs_addch.3 mvwaddch.3 \ curs_addch.3 waddch.3 \ curs_addch.3 wechochar.3 \ curs_addchstr.3 addchnstr.3 \ curs_addchstr.3 addchstr.3 \ curs_addchstr.3 mvaddchnstr.3 \ curs_addchstr.3 mvaddchstr.3 \ curs_addchstr.3 mvwaddchnstr.3 \ curs_addchstr.3 mvwaddchstr.3 \ curs_addchstr.3 waddchnstr.3 \ curs_addchstr.3 waddchstr.3 \ curs_addstr.3 addnstr.3 \ curs_addstr.3 addstr.3 \ curs_addstr.3 mvaddnstr.3 \ curs_addstr.3 mvaddstr.3 \ curs_addstr.3 mvwaddnstr.3 \ curs_addstr.3 mvwaddstr.3 \ curs_addstr.3 waddnstr.3 \ curs_addstr.3 waddstr.3 \ curs_attr.3 PAIR_NUMBER.3 \ curs_attr.3 attr_get.3 \ curs_attr.3 attr_off.3 \ curs_attr.3 attr_on.3 \ curs_attr.3 attr_set.3 \ curs_attr.3 attroff.3 \ curs_attr.3 attron.3 \ curs_attr.3 attrset.3 \ curs_attr.3 chgat.3 \ curs_attr.3 color_set.3 \ curs_attr.3 mvchgat.3 \ curs_attr.3 mvwchgat.3 \ curs_attr.3 standend.3 \ curs_attr.3 standout.3 \ curs_attr.3 wattr_get.3 \ curs_attr.3 wattr_off.3 \ curs_attr.3 wattr_on.3 \ curs_attr.3 wattr_set.3 \ curs_attr.3 wattroff.3 \ curs_attr.3 wattron.3 \ curs_attr.3 wattrset.3 \ curs_attr.3 wchgat.3 \ curs_attr.3 wcolor_set.3 \ curs_attr.3 wstandend.3 \ curs_attr.3 wstandout.3 \ curs_beep.3 beep.3 \ curs_beep.3 flash.3 \ curs_bkgd.3 bkgd.3 \ curs_bkgd.3 bkgdset.3 \ curs_bkgd.3 getbkgd.3 \ curs_bkgd.3 wbkgd.3 \ curs_bkgd.3 wbkgdset.3 \ curs_bkgrnd.3 bkgrnd.3 \ curs_bkgrnd.3 bkgrndset.3 \ curs_bkgrnd.3 getbkgrnd.3 \ curs_bkgrnd.3 wbkgrnd.3 \ curs_bkgrnd.3 wbkgrndset.3 \ curs_bkgrnd.3 wgetbkgrnd.3 \ curs_border.3 border.3 \ curs_border.3 box.3 \ curs_border.3 hline.3 \ curs_border.3 mvhline.3 \ curs_border.3 mvvline.3 \ curs_border.3 mvwhline.3 \ curs_border.3 mvwvline.3 \ curs_border.3 vline.3 \ curs_border.3 wborder.3 \ curs_border.3 whline.3 \ curs_border.3 wvline.3 \ curs_border_set.3 border_set.3 \ curs_border_set.3 box_set.3 \ curs_border_set.3 hline_set.3 \ curs_border_set.3 mvhline_set.3 \ curs_border_set.3 mvvline_set.3 \ curs_border_set.3 mvwhline_set.3 \ curs_border_set.3 mvwvline_set.3 \ curs_border_set.3 vline_set.3 \ curs_border_set.3 wborder_set.3 \ curs_border_set.3 whline_set.3 \ curs_border_set.3 wvline_set.3 \ curs_clear.3 clear.3 \ curs_clear.3 clrtobot.3 \ curs_clear.3 clrtoeol.3 \ curs_clear.3 erase.3 \ curs_clear.3 wclear.3 \ curs_clear.3 wclrtobot.3 \ curs_clear.3 wclrtoeol.3 \ curs_clear.3 werase.3 \ curs_color.3 COLOR_PAIR.3 \ curs_color.3 can_change_color.3 \ curs_color.3 color_content.3 \ curs_color.3 has_colors.3 \ curs_color.3 init_color.3 \ curs_color.3 init_pair.3 \ curs_color.3 pair_content.3 \ curs_color.3 start_color.3 \ curs_delch.3 delch.3 \ curs_delch.3 mvdelch.3 \ curs_delch.3 mvwdelch.3 \ curs_delch.3 wdelch.3 \ curs_deleteln.3 deleteln.3 \ curs_deleteln.3 insdelln.3 \ curs_deleteln.3 insertln.3 \ curs_deleteln.3 wdeleteln.3 \ curs_deleteln.3 winsdelln.3 \ curs_deleteln.3 winsertln.3 \ curs_extend.3 curses_version.3 \ curs_extend.3 use_extended_names.3 \ curs_getcchar.3 getcchar.3 \ curs_getcchar.3 setcchar.3 \ curs_getch.3 getch.3 \ curs_getch.3 has_key.3 \ curs_getch.3 mvgetch.3 \ curs_getch.3 mvwgetch.3 \ curs_getch.3 ungetch.3 \ curs_getch.3 wgetch.3 \ curs_getstr.3 getnstr.3 \ curs_getstr.3 getstr.3 \ curs_getstr.3 mvgetnstr.3 \ curs_getstr.3 mvgetstr.3 \ curs_getstr.3 mvwgetnstr.3 \ curs_getstr.3 mvwgetstr.3 \ curs_getstr.3 wgetnstr.3 \ curs_getstr.3 wgetstr.3 \ curs_getyx.3 getbegyx.3 \ curs_getyx.3 getmaxyx.3 \ curs_getyx.3 getparyx.3 \ curs_getyx.3 getyx.3 \ curs_inch.3 inch.3 \ curs_inch.3 mvinch.3 \ curs_inch.3 mvwinch.3 \ curs_inch.3 winch.3 \ curs_inchstr.3 inchnstr.3 \ curs_inchstr.3 inchstr.3 \ curs_inchstr.3 mvinchnstr.3 \ curs_inchstr.3 mvinchstr.3 \ curs_inchstr.3 mvwinchnstr.3 \ curs_inchstr.3 mvwinchstr.3 \ curs_inchstr.3 winchnstr.3 \ curs_inchstr.3 winchstr.3 \ curs_initscr.3 delscreen.3 \ curs_initscr.3 endwin.3 \ curs_initscr.3 initscr.3 \ curs_initscr.3 isendwin.3 \ curs_initscr.3 newterm.3 \ curs_initscr.3 set_term.3 \ curs_inopts.3 cbreak.3 \ curs_inopts.3 echo.3 \ curs_inopts.3 halfdelay.3 \ curs_inopts.3 intrflush.3 \ curs_inopts.3 keypad.3 \ curs_inopts.3 meta.3 \ curs_inopts.3 nocbreak.3 \ curs_inopts.3 nodelay.3 \ curs_inopts.3 noecho.3 \ curs_inopts.3 noqiflush.3 \ curs_inopts.3 noraw.3 \ curs_inopts.3 notimeout.3 \ curs_inopts.3 qiflush.3 \ curs_inopts.3 raw.3 \ curs_inopts.3 timeout.3 \ curs_inopts.3 typeahead.3 \ curs_inopts.3 wtimeout.3 \ curs_insch.3 insch.3 \ curs_insch.3 mvinsch.3 \ curs_insch.3 mvwinsch.3 \ curs_insch.3 winsch.3 \ curs_insstr.3 insnstr.3 \ curs_insstr.3 insstr.3 \ curs_insstr.3 mvinsnstr.3 \ curs_insstr.3 mvinsstr.3 \ curs_insstr.3 mvwinsnstr.3 \ curs_insstr.3 mvwinsstr.3 \ curs_insstr.3 winsnstr.3 \ curs_insstr.3 winsstr.3 \ curs_instr.3 innstr.3 \ curs_instr.3 instr.3 \ curs_instr.3 mvinnstr.3 \ curs_instr.3 mvinstr.3 \ curs_instr.3 mvwinnstr.3 \ curs_instr.3 mvwinstr.3 \ curs_instr.3 winnstr.3 \ curs_instr.3 winstr.3 \ curs_kernel.3 curs_set.3 \ curs_kernel.3 def_prog_mode.3 \ curs_kernel.3 def_shell_mode.3 \ curs_kernel.3 getsyx.3 \ curs_kernel.3 napms.3 \ curs_kernel.3 reset_prog_mode.3 \ curs_kernel.3 reset_shell_mode.3 \ curs_kernel.3 resetty.3 \ curs_kernel.3 ripoffline.3 \ curs_kernel.3 savetty.3 \ curs_kernel.3 setsyx.3 \ curs_legacy.3 getbegx.3 \ curs_legacy.3 getbegy.3 \ curs_legacy.3 getcurx.3 \ curs_legacy.3 getcury.3 \ curs_legacy.3 getmaxx.3 \ curs_legacy.3 getmaxy.3 \ curs_legacy.3 getparx.3 \ curs_legacy.3 getpary.3 \ curs_memleaks.3 _nc_free_and_exit.3 \ curs_memleaks.3 _nc_freeall.3 \ curs_mouse.3 getmouse.3 \ curs_mouse.3 mouse_trafo.3 \ curs_mouse.3 mouseinterval.3 \ curs_mouse.3 mousemask.3 \ curs_mouse.3 ungetmouse.3 \ curs_mouse.3 wenclose.3 \ curs_mouse.3 wmouse_trafo.3 \ curs_move.3 move.3 \ curs_move.3 wmove.3 \ curs_opaque.3 is_cleared.3 \ curs_opaque.3 is_idcok.3 \ curs_opaque.3 is_idlok.3 \ curs_opaque.3 is_immedok.3 \ curs_opaque.3 is_keypad.3 \ curs_opaque.3 is_leaveok.3 \ curs_opaque.3 is_nodelay.3 \ curs_opaque.3 is_notimeout.3 \ curs_opaque.3 is_scrollok.3 \ curs_opaque.3 is_syncok.3 \ curs_opaque.3 is_timeout.3 \ curs_opaque.3 wgetparent.3 \ curs_opaque.3 wgetscrreg.3 \ curs_outopts.3 clearok.3 \ curs_outopts.3 idcok.3 \ curs_outopts.3 idlok.3 \ curs_outopts.3 immedok.3 \ curs_outopts.3 leaveok.3 \ curs_outopts.3 nl.3 \ curs_outopts.3 nonl.3 \ curs_outopts.3 scrollok.3 \ curs_outopts.3 setscrreg.3 \ curs_outopts.3 wsetscrreg.3 \ curs_overlay.3 copywin.3 \ curs_overlay.3 overlay.3 \ curs_overlay.3 overwrite.3 \ curs_pad.3 newpad.3 \ curs_pad.3 pecho_wchar.3 \ curs_pad.3 pechochar.3 \ curs_pad.3 pnoutrefresh.3 \ curs_pad.3 prefresh.3 \ curs_pad.3 subpad.3 \ curs_print.3 mcprint.3 \ curs_refresh.3 doupdate.3 \ curs_refresh.3 redrawwin.3 \ curs_refresh.3 refresh.3 \ curs_refresh.3 wnoutrefresh.3 \ curs_refresh.3 wredrawln.3 \ curs_refresh.3 wrefresh.3 \ curs_scr_dump.3 scr_dump.3 \ curs_scr_dump.3 scr_init.3 \ curs_scr_dump.3 scr_restore.3 \ curs_scr_dump.3 scr_set.3 \ curs_scroll.3 scrl.3 \ curs_scroll.3 scroll.3 \ curs_scroll.3 wscrl.3 \ curs_slk.3 slk_attr.3 \ curs_slk.3 slk_attr_off.3 \ curs_slk.3 slk_attr_on.3 \ curs_slk.3 slk_attr_set.3 \ curs_slk.3 slk_attroff.3 \ curs_slk.3 slk_attron.3 \ curs_slk.3 slk_attrset.3 \ curs_slk.3 slk_clear.3 \ curs_slk.3 slk_color.3 \ curs_slk.3 slk_init.3 \ curs_slk.3 slk_label.3 \ curs_slk.3 slk_noutrefresh.3 \ curs_slk.3 slk_refresh.3 \ curs_slk.3 slk_restore.3 \ curs_slk.3 slk_set.3 \ curs_slk.3 slk_touch.3 \ curs_sp_funcs.3 sp_funcs.3 \ curs_sp_funcs.3 assume_default_colors_sp.3 \ curs_sp_funcs.3 baudrate_sp.3 \ curs_sp_funcs.3 beep_sp.3 \ curs_sp_funcs.3 can_change_color_sp.3 \ curs_sp_funcs.3 cbreak_sp.3 \ curs_sp_funcs.3 ceiling_panel.3 \ curs_sp_funcs.3 color_content_sp.3 \ curs_sp_funcs.3 curs_set_sp.3 \ curs_sp_funcs.3 def_prog_mode_sp.3 \ curs_sp_funcs.3 def_shell_mode_sp.3 \ curs_sp_funcs.3 define_key_sp.3 \ curs_sp_funcs.3 del_curterm_sp.3 \ curs_sp_funcs.3 delay_output_sp.3 \ curs_sp_funcs.3 doupdate_sp.3 \ curs_sp_funcs.3 echo_sp.3 \ curs_sp_funcs.3 endwin_sp.3 \ curs_sp_funcs.3 erasechar_sp.3 \ curs_sp_funcs.3 filter_sp.3 \ curs_sp_funcs.3 flash_sp.3 \ curs_sp_funcs.3 flushinp_sp.3 \ curs_sp_funcs.3 get_escdelay_sp.3 \ curs_sp_funcs.3 getmouse_sp.3 \ curs_sp_funcs.3 getwin_sp.3 \ curs_sp_funcs.3 ground_panel.3 \ curs_sp_funcs.3 halfdelay_sp.3 \ curs_sp_funcs.3 has_colors_sp.3 \ curs_sp_funcs.3 has_ic_sp.3 \ curs_sp_funcs.3 has_il_sp.3 \ curs_sp_funcs.3 has_key_sp.3 \ curs_sp_funcs.3 has_mouse_sp.3 \ curs_sp_funcs.3 init_color_sp.3 \ curs_sp_funcs.3 init_pair_sp.3 \ curs_sp_funcs.3 intrflush_sp.3 \ curs_sp_funcs.3 is_term_resized_sp.3 \ curs_sp_funcs.3 isendwin_sp.3 \ curs_sp_funcs.3 key_defined_sp.3 \ curs_sp_funcs.3 keybound_sp.3 \ curs_sp_funcs.3 keyname_sp.3 \ curs_sp_funcs.3 keyok_sp.3 \ curs_sp_funcs.3 killchar_sp.3 \ curs_sp_funcs.3 mcprint_sp.3 \ curs_sp_funcs.3 mouseinterval_sp.3 \ curs_sp_funcs.3 mousemask_sp.3 \ curs_sp_funcs.3 mvcur_sp.3 \ curs_sp_funcs.3 napms_sp.3 \ curs_sp_funcs.3 new_form_sp.3 \ curs_sp_funcs.3 new_menu_sp.3 \ curs_sp_funcs.3 new_prescr.3 \ curs_sp_funcs.3 newpad_sp.3 \ curs_sp_funcs.3 newterm_sp.3 \ curs_sp_funcs.3 newwin_sp.3 \ curs_sp_funcs.3 nl_sp.3 \ curs_sp_funcs.3 nocbreak_sp.3 \ curs_sp_funcs.3 noecho_sp.3 \ curs_sp_funcs.3 nofilter_sp.3 \ curs_sp_funcs.3 nonl_sp.3 \ curs_sp_funcs.3 noqiflush_sp.3 \ curs_sp_funcs.3 noraw_sp.3 \ curs_sp_funcs.3 pair_content_sp.3 \ curs_sp_funcs.3 putp_sp.3 \ curs_sp_funcs.3 qiflush_sp.3 \ curs_sp_funcs.3 raw_sp.3 \ curs_sp_funcs.3 reset_prog_mode_sp.3 \ curs_sp_funcs.3 reset_shell_mode_sp.3 \ curs_sp_funcs.3 resetty_sp.3 \ curs_sp_funcs.3 resize_term_sp.3 \ curs_sp_funcs.3 resizeterm_sp.3 \ curs_sp_funcs.3 restartterm_sp.3 \ curs_sp_funcs.3 ripoffline_sp.3 \ curs_sp_funcs.3 savetty_sp.3 \ curs_sp_funcs.3 scr_init_sp.3 \ curs_sp_funcs.3 scr_restore_sp.3 \ curs_sp_funcs.3 scr_set_sp.3 \ curs_sp_funcs.3 set_curterm_sp.3 \ curs_sp_funcs.3 set_escdelay_sp.3 \ curs_sp_funcs.3 set_tabsize_sp.3 \ curs_sp_funcs.3 slk_attr_set_sp.3 \ curs_sp_funcs.3 slk_attr_sp.3 \ curs_sp_funcs.3 slk_attroff_sp.3 \ curs_sp_funcs.3 slk_attron_sp.3 \ curs_sp_funcs.3 slk_attrset_sp.3 \ curs_sp_funcs.3 slk_clear_sp.3 \ curs_sp_funcs.3 slk_color_sp.3 \ curs_sp_funcs.3 slk_init_sp.3 \ curs_sp_funcs.3 slk_label_sp.3 \ curs_sp_funcs.3 slk_noutrefresh_sp.3 \ curs_sp_funcs.3 slk_refresh_sp.3 \ curs_sp_funcs.3 slk_restore_sp.3 \ curs_sp_funcs.3 slk_set_sp.3 \ curs_sp_funcs.3 slk_touch_sp.3 \ curs_sp_funcs.3 start_color_sp.3 \ curs_sp_funcs.3 term_attrs_sp.3 \ curs_sp_funcs.3 termattrs_sp.3 \ curs_sp_funcs.3 termname_sp.3 \ curs_sp_funcs.3 tgetent_sp.3 \ curs_sp_funcs.3 tgetflag_sp.3 \ curs_sp_funcs.3 tgetnum_sp.3 \ curs_sp_funcs.3 tgetstr_sp.3 \ curs_sp_funcs.3 tigetflag_sp.3 \ curs_sp_funcs.3 tigetnum_sp.3 \ curs_sp_funcs.3 tigetstr_sp.3 \ curs_sp_funcs.3 tputs_sp.3 \ curs_sp_funcs.3 typeahead_sp.3 \ curs_sp_funcs.3 unctrl_sp.3 \ curs_sp_funcs.3 unget_wch_sp.3 \ curs_sp_funcs.3 ungetch_sp.3 \ curs_sp_funcs.3 ungetmouse_sp.3 \ curs_sp_funcs.3 update_panels_sp.3 \ curs_sp_funcs.3 use_default_colors_sp.3 \ curs_sp_funcs.3 use_env_sp.3 \ curs_sp_funcs.3 use_legacy_coding_sp.3 \ curs_sp_funcs.3 vid_attr_sp.3 \ curs_sp_funcs.3 vid_puts_sp.3 \ curs_sp_funcs.3 vidattr_sp.3 \ curs_sp_funcs.3 vidputs_sp.3 \ curs_sp_funcs.3 wunctrl_sp.3 \ curs_termattrs.3 baudrate.3 \ curs_termattrs.3 erasechar.3 \ curs_termattrs.3 erasewchar.3 \ curs_termattrs.3 has_ic.3 \ curs_termattrs.3 has_il.3 \ curs_termattrs.3 killchar.3 \ curs_termattrs.3 killwchar.3 \ curs_termattrs.3 longname.3 \ curs_termattrs.3 term_attrs.3 \ curs_termattrs.3 termattrs.3 \ curs_termattrs.3 termname.3 \ curs_termcap.3 termcap.3 \ curs_termcap.3 tgetent.3 \ curs_termcap.3 tgetflag.3 \ curs_termcap.3 tgetnum.3 \ curs_termcap.3 tgetstr.3 \ curs_termcap.3 tgoto.3 \ curs_termcap.3 tputs.3 \ curs_terminfo.3 del_curterm.3 \ curs_terminfo.3 mvcur.3 \ curs_terminfo.3 putp.3 \ curs_terminfo.3 restartterm.3 \ curs_terminfo.3 set_curterm.3 \ curs_terminfo.3 setterm.3 \ curs_terminfo.3 setupterm.3 \ curs_terminfo.3 tigetflag.3 \ curs_terminfo.3 tigetnum.3 \ curs_terminfo.3 tigetstr.3 \ curs_terminfo.3 tparm.3 \ curs_terminfo.3 vid_attr.3 \ curs_terminfo.3 vid_puts.3 \ curs_terminfo.3 vidattr.3 \ curs_terminfo.3 vidputs.3 \ curs_threads.3 set_escdelay.3 \ curs_threads.3 set_tabsize.3 \ curs_threads.3 use_screen.3 \ curs_threads.3 use_window.3 \ curs_touch.3 is_linetouched.3 \ curs_touch.3 is_wintouched.3 \ curs_touch.3 touchline.3 \ curs_touch.3 touchwin.3 \ curs_touch.3 untouchwin.3 \ curs_touch.3 wtouchln.3 \ curs_trace.3 _nc_tracebits.3 \ curs_trace.3 _traceattr.3 \ curs_trace.3 _traceattr2.3 \ curs_trace.3 _tracechar.3 \ curs_trace.3 _tracechtype.3 \ curs_trace.3 _tracechtype2.3 \ curs_trace.3 _tracedump.3 \ curs_trace.3 _tracef.3 \ curs_trace.3 _tracemouse.3 \ curs_trace.3 trace.3 \ curs_util.3 delay_output.3 \ curs_util.3 filter.3 \ curs_util.3 flushinp.3 \ curs_util.3 getwin.3 \ curs_util.3 key_name.3 \ curs_util.3 keyname.3 \ curs_util.3 nofilter.3 \ curs_util.3 putwin.3 \ curs_util.3 unctrl.3 \ curs_util.3 use_env.3 \ curs_util.3 wunctrl.3 \ curs_window.3 delwin.3 \ curs_window.3 derwin.3 \ curs_window.3 dupwin.3 \ curs_window.3 mvderwin.3 \ curs_window.3 mvwin.3 \ curs_window.3 newwin.3 \ curs_window.3 subwin.3 \ curs_window.3 syncok.3 \ curs_window.3 wcursyncup.3 \ curs_window.3 wsyncdown.3 \ curs_window.3 wsyncup.3 \ default_colors.3 assume_default_colors.3 \ default_colors.3 use_default_colors.3 \ legacy_coding.3 use_legacy_coding.3 \ resizeterm.3 is_term_resized.3 \ resizeterm.3 resize_term.3 MLINKS+=curs_add_wch.3 add_wch.3 \ curs_add_wch.3 echo_wchar.3 \ curs_add_wch.3 mvadd_wch.3 \ curs_add_wch.3 mvwadd_wch.3 \ curs_add_wch.3 wadd_wch.3 \ curs_add_wch.3 wecho_wchar.3 \ curs_add_wchstr.3 add_wchnstr.3 \ curs_add_wchstr.3 add_wchstr.3 \ curs_add_wchstr.3 mvadd_wchnstr.3 \ curs_add_wchstr.3 mvadd_wchstr.3 \ curs_add_wchstr.3 mvwadd_wchnstr.3 \ curs_add_wchstr.3 mvwadd_wchstr.3 \ curs_add_wchstr.3 wadd_wchnstr.3 \ curs_add_wchstr.3 wadd_wchstr.3 \ curs_addwstr.3 addnwstr.3 \ curs_addwstr.3 addwstr.3 \ curs_addwstr.3 mvaddnwstr.3 \ curs_addwstr.3 mvaddwstr.3 \ curs_addwstr.3 mvwaddnwstr.3 \ curs_addwstr.3 mvwaddwstr.3 \ curs_addwstr.3 waddnwstr.3 \ curs_addwstr.3 waddwstr.3 \ curs_get_wch.3 get_wch.3 \ curs_get_wch.3 mvget_wch.3 \ curs_get_wch.3 mvwget_wch.3 \ curs_get_wch.3 unget_wch.3 \ curs_get_wch.3 wget_wch.3 \ curs_get_wstr.3 get_wstr.3 \ curs_get_wstr.3 getn_wstr.3 \ curs_get_wstr.3 mvget_wstr.3 \ curs_get_wstr.3 mvgetn_wstr.3 \ curs_get_wstr.3 mvwget_wstr.3 \ curs_get_wstr.3 mvwgetn_wstr.3 \ curs_get_wstr.3 wget_wstr.3 \ curs_get_wstr.3 wgetn_wstr.3 \ curs_in_wch.3 in_wch.3 \ curs_in_wch.3 mvin_wch.3 \ curs_in_wch.3 mvwin_wch.3 \ curs_in_wch.3 win_wch.3 \ curs_in_wchstr.3 in_wchnstr.3 \ curs_in_wchstr.3 in_wchstr.3 \ curs_in_wchstr.3 mvin_wchnstr.3 \ curs_in_wchstr.3 mvin_wchstr.3 \ curs_in_wchstr.3 mvwin_wchnstr.3 \ curs_in_wchstr.3 mvwin_wchstr.3 \ curs_in_wchstr.3 win_wchnstr.3 \ curs_in_wchstr.3 win_wchstr.3 \ curs_ins_wch.3 ins_wch.3 \ curs_ins_wch.3 mvins_wch.3 \ curs_ins_wch.3 mvwins_wch.3 \ curs_ins_wch.3 wins_wch.3 \ curs_ins_wstr.3 ins_nwstr.3 \ curs_ins_wstr.3 ins_wstr.3 \ curs_ins_wstr.3 mvins_nwstr.3 \ curs_ins_wstr.3 mvins_wstr.3 \ curs_ins_wstr.3 mvwins_nwstr.3 \ curs_ins_wstr.3 mvwins_wstr.3 \ curs_ins_wstr.3 wins_nwstr.3 \ curs_ins_wstr.3 wins_wstr.3 \ curs_inwstr.3 innwstr.3 \ curs_inwstr.3 inwstr.3 \ curs_inwstr.3 mvinnwstr.3 \ curs_inwstr.3 mvinwstr.3 \ curs_inwstr.3 mvwinnwstr.3 \ curs_inwstr.3 mvwinwstr.3 \ curs_inwstr.3 winnwstr.3 \ curs_inwstr.3 winwstr.3 \ curs_printw.3 mvprintw.3 \ curs_printw.3 mvwprintw.3 \ curs_printw.3 printw.3 \ curs_printw.3 vw_printw.3 \ curs_printw.3 vwprintw.3 \ curs_printw.3 wprintw.3 \ curs_scanw.3 mvscanw.3 \ curs_scanw.3 mvwscanw.3 \ curs_scanw.3 scanw.3 \ curs_scanw.3 vw_scanw.3 \ curs_scanw.3 vwscanw.3 \ curs_scanw.3 wscanw.3 .include # Keep the .SUFFIXES line after the include of bsd.lib.mk .SUFFIXES: .3 .3x .3x.3: cat ${.IMPSRC} > ${.TARGET} diff --git a/lib/ncurses/ncurses/ncurses_cfg.h b/lib/ncurses/ncurses/ncurses_cfg.h index 0a92c2f23ba4..49cef464b803 100644 --- a/lib/ncurses/ncurses/ncurses_cfg.h +++ b/lib/ncurses/ncurses/ncurses_cfg.h @@ -1,253 +1,252 @@ /* include/ncurses_cfg.h. Generated automatically by configure. */ /**************************************************************************** * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* * $Id: ncurses_cfg.hin,v 1.11 2017/12/09 20:41:54 tom Exp $ * * Both ncurses_cfg.h and ncurses_def.h are internal header-files used when * building ncurses. * * This is a template-file used to generate the "ncurses_cfg.h" file. * * Rather than list every definition, the configuration script substitutes the * definitions that it finds using 'sed'. You need a patch (original date * 971222) to autoconf 2.12 or 2.13 to do this. * * See: * http://invisible-island.net/autoconf/ * ftp://ftp.invisible-island.net/autoconf/ */ /* $FreeBSD$ */ #ifndef NC_CONFIG_H #define NC_CONFIG_H #define SYSTEM_NAME "FreeBSD" #if 0 #include #endif #define HAVE_LONG_FILE_NAMES 1 #define MIXEDCASE_FILENAMES 1 #define USE_SYSMOUSE 1 +#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/site-terminfo" +#define TERMINFO "/usr/share/terminfo" #define HAVE_BIG_CORE 1 #define TERMPATH "/etc/termcap:/usr/share/misc/termcap" #define USE_GETCAP 1 #define HAVE_UNISTD_H 1 #define HAVE_REMOVE 1 #define HAVE_UNLINK 1 #define HAVE_LINK 1 #define HAVE_SYMLINK 1 #define USE_LINKS 1 #define BSD_TPUTS 1 #define HAVE_LANGINFO_CODESET 1 +#define USE_WIDEC_SUPPORT 1 +#define NCURSES_WIDECHAR 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_PUTWC 1 +#define HAVE_BTOWC 1 +#define HAVE_WCTOB 1 +#define HAVE_MBTOWC 1 +#define HAVE_WCTOMB 1 +#define HAVE_MBLEN 1 +#define HAVE_MBRLEN 1 +#define HAVE_MBRTOWC 1 +#define HAVE_WCSRTOMBS 1 +#define HAVE_MBSRTOWCS 1 +#define HAVE_WCSTOMBS 1 +#define HAVE_MBSTOWCS 1 +#define NEED_WCHAR_H 1 #define HAVE_FSEEKO 1 #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define SIZEOF_SIGNED_CHAR 1 #define NCURSES_EXT_FUNCS 1 #define HAVE_ASSUME_DEFAULT_COLORS 1 #define HAVE_CURSES_VERSION 1 #define HAVE_HAS_KEY 1 #define HAVE_RESIZETERM 1 #define HAVE_RESIZE_TERM 1 #define HAVE_TERM_ENTRY_H 1 #define HAVE_USE_DEFAULT_COLORS 1 #define HAVE_USE_EXTENDED_NAMES 1 #define HAVE_USE_SCREEN 1 #define HAVE_USE_WINDOW 1 #define HAVE_WRESIZE 1 #define NCURSES_SP_FUNCS 1 #define HAVE_TPUTS_SP 1 +#define NCURSES_EXT_COLORS 1 +#define HAVE_ALLOC_PAIR 1 +#define HAVE_INIT_EXTENDED_COLOR 1 +#define HAVE_RESET_COLOR_PAIRS 1 #define NCURSES_EXT_PUTWIN 1 #define NCURSES_NO_PADDING 1 #define USE_SIGWINCH 1 #define NCURSES_WRAP_PREFIX "_nc_" #define USE_ASSUMED_COLOR 1 #define USE_HASHMAP 1 #define USE_COLORFGBG 1 #define GCC_SCANF 1 #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #define GCC_PRINTF 1 #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #define GCC_UNUSED __attribute__((unused)) #define GCC_NORETURN __attribute__((noreturn)) #define HAVE_NC_ALLOC_H 1 #define HAVE_GETTIMEOFDAY 1 #define STDC_HEADERS 1 #define HAVE_DIRENT_H 1 #define TIME_WITH_SYS_TIME 1 #define HAVE_REGEX_H_FUNCS 1 #define HAVE_FCNTL_H 1 #define HAVE_GETOPT_H 1 #define HAVE_LIMITS_H 1 #define HAVE_LOCALE_H 1 #define HAVE_MATH_H 1 #define HAVE_POLL_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_POLL_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TIMES_H 1 #define HAVE_TTYENT_H 1 #define HAVE_UNISTD_H 1 #define HAVE_WCTYPE_H 1 #define HAVE_UNISTD_H 1 #define HAVE_GETOPT_H 1 #define HAVE_GETOPT_HEADER 1 +#define DECL_ENVIRON 1 +#define HAVE_ENVIRON 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_STRDUP 1 #define HAVE_SYS_TIME_SELECT 1 #define SIG_ATOMIC_T volatile sig_atomic_t #define HAVE_ERRNO 1 #define HAVE_GETCWD 1 #define HAVE_GETEGID 1 #define HAVE_GETEUID 1 #define HAVE_GETOPT 1 #define HAVE_GETTTYNAM 1 #define HAVE_ISSETUGID 1 #define HAVE_LOCALECONV 1 #define HAVE_POLL 1 #define HAVE_PUTENV 1 #define HAVE_REMOVE 1 #define HAVE_SELECT 1 #define HAVE_SETBUF 1 #define HAVE_SETBUFFER 1 #define HAVE_SETENV 1 #define HAVE_SETVBUF 1 #define HAVE_SIGACTION 1 #define HAVE_SIGVEC 1 +#define HAVE_SNPRINTF 1 #define HAVE_STRDUP 1 #define HAVE_STRSTR 1 #define HAVE_SYSCONF 1 #define HAVE_TCGETPGRP 1 #define HAVE_TIMES 1 #define HAVE_TSEARCH 1 #define HAVE_VSNPRINTF 1 #define HAVE_BSD_CGETENT 1 #define HAVE_ISASCII 1 #define HAVE_NANOSLEEP 1 #define HAVE_TERMIOS_H 1 #define HAVE_UNISTD_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_TCGETATTR 1 #define HAVE_VSSCANF 1 #define HAVE_UNISTD_H 1 #define HAVE_MKSTEMP 1 #define HAVE_SIZECHANGE 1 #define HAVE_WORKING_POLL 1 #define HAVE_VA_COPY 1 #define HAVE_UNISTD_H 1 #define HAVE_FORK 1 #define HAVE_VFORK 1 #define HAVE_WORKING_VFORK 1 #define HAVE_WORKING_FORK 1 #define USE_FOPEN_BIN_R 1 #define USE_OPENPTY_HEADER #define USE_XTERM_PTY 1 -#define USE_HASHED_DB 1 #define HAVE_TYPEINFO 1 #define HAVE_IOSTREAM 1 #define IOSTREAM_NAMESPACE 1 +#define SIZEOF_BOOL 1 #define CPP_HAS_STATIC_CAST 1 +#define SIZEOF_WCHAR_T 4 #define HAVE_SLK_COLOR 1 #define HAVE_PANEL_H 1 #define HAVE_LIBPANEL 1 #define HAVE_MENU_H 1 #define HAVE_LIBMENU 1 #define HAVE_FORM_H 1 #define HAVE_LIBFORM 1 #define NCURSES_PATHSEP ':' #define NCURSES_VERSION_STRING "6.2.20200215" #define NCURSES_OSPEED_COMPAT 1 #define HAVE_CURSES_DATA_BOOLNAMES 1 -/* - * Begin FreeBSD-specific changes - */ -/* Support ENABLE_WIDEC */ -#ifdef ENABLE_WIDEC -#define USE_WIDEC_SUPPORT 1 -#define NCURSES_WIDECHAR 1 -#define NCURSES_EXT_FUNCS 1 -#define NCURSES_EXT_COLORS 1 -#define HAVE_ALLOC_PAIR 1 -#define HAVE_INIT_EXTENDED_COLOR 1 -#define HAVE_RESET_COLOR_PAIRS 1 -#define HAVE_PUTWC 1 -#define HAVE_BTOWC 1 -#define HAVE_WCTOB 1 -#define HAVE_MBTOWC 1 -#define HAVE_WCTOMB 1 -#define HAVE_MBLEN 1 -#define HAVE_MBRLEN 1 -#define HAVE_MBRTOWC 1 -#define HAVE_WCSRTOMBS 1 -#define HAVE_MBSRTOWCS 1 -#define HAVE_WCSTOMBS 1 -#define HAVE_MBSTOWCS 1 -#define NEED_WCHAR_H 1 -#define SIZEOF_WCHAR_T 4 -#endif -/* - * End FreeBSD-specific changes - */ - #include /* The C compiler may not treat these properly but C++ has to */ #ifdef __cplusplus #undef const #undef inline #endif /* On HP-UX, the C compiler doesn't grok mbstate_t without -D_XOPEN_SOURCE=500. However, this causes problems on IRIX. So, we #define mbstate_t to int in configure.in only for the C compiler if needed. */ #ifndef __cplusplus #ifdef NEED_MBSTATE_T_DEF #define mbstate_t int #endif #endif /* * vile:cmode */ #endif /* NC_CONFIG_H */ diff --git a/lib/ncurses/ncurses/termcap.c b/lib/ncurses/ncurses/termcap.c deleted file mode 100644 index 535301a1b474..000000000000 --- a/lib/ncurses/ncurses/termcap.c +++ /dev/null @@ -1,266 +0,0 @@ -/* A portion of this file is from ncurses: */ -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ - -#include - -#include -#include -#include -#include - -/* The rest is from BSD */ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#if 0 -#ifndef lint -static const char sccsid[] = "@(#)termcap.c 8.1 (Berkeley) 6/4/93"; -#endif /* not lint */ -#endif - -#include -#include -#include -#include -#include -#include -#include "pathnames.h" - -#define PBUFSIZ MAXPATHLEN /* max length of filename path */ -#define PVECSIZ 32 /* max number of names in path */ -#define TBUFSIZ 1024 /* max length of _nc_tgetent buffer */ - -char _nc_termcap[TBUFSIZ + 1]; /* Last getcap, provided to tgetent() emul */ - -/* - * termcap - routines for dealing with the terminal capability data base - * - * BUG: Should use a "last" pointer in tbuf, so that searching - * for capabilities alphabetically would not be a n**2/2 - * process when large numbers of capabilities are given. - * Note: If we add a last pointer now we will screw up the - * tc capability. We really should compile termcap. - * - * Essentially all the work here is scanning and decoding escapes - * in string capabilities. We don't use stdio because the editor - * doesn't, and because living w/o it is not hard. - */ - -/* - * Get an entry for terminal name in buffer _nc_termcap from the termcap - * file. - */ -int -_nc_read_termcap_entry(const char *const name, TERMTYPE2 *const tp) -{ - ENTRY *ep; - char *p; - char *cp; - char *dummy; - char **fname; - char *home; - int i; - char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ - char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ - char **pvec; /* holds usable tail of path vector */ - char *termpath; - - _nc_termcap[0] = '\0'; /* in case */ - dummy = NULL; - fname = pathvec; - pvec = pathvec; - p = pathbuf; - cp = getenv("TERMCAP"); - /* - * TERMCAP can have one of two things in it. It can be the - * name of a file to use instead of /etc/termcap. In this - * case it better start with a "/". Or it can be an entry to - * use so we don't have to read the file. In this case it - * has to already have the newlines crunched out. If TERMCAP - * does not hold a file name then a path of names is searched - * instead. The path is found in the TERMPATH variable, or - * becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists. - */ - if (!cp || *cp != '/') { /* no TERMCAP or it holds an entry */ - if ( (termpath = getenv("TERMPATH")) ) - strncpy(pathbuf, termpath, PBUFSIZ); - else { - if ( (home = getenv("HOME")) ) {/* set up default */ - strncpy(pathbuf, home, PBUFSIZ - 1); /* $HOME first */ - pathbuf[PBUFSIZ - 2] = '\0'; /* -2 because we add a slash */ - p += strlen(pathbuf); /* path, looking in */ - *p++ = '/'; - } /* if no $HOME look in current directory */ - strncpy(p, _PATH_DEF, PBUFSIZ - (p - pathbuf)); - } - } - else /* user-defined name in TERMCAP */ - strncpy(pathbuf, cp, PBUFSIZ); /* still can be tokenized */ - - /* For safety */ - if (issetugid()) - strcpy(pathbuf, _PATH_DEF_SEC); - - pathbuf[PBUFSIZ - 1] = '\0'; - - *fname++ = pathbuf; /* tokenize path into vector of names */ - while (*++p) - if (*p == ' ' || *p == ':') { - *p = '\0'; - while (*++p) - if (*p != ' ' && *p != ':') - break; - if (*p == '\0') - break; - *fname++ = p; - if (fname >= pathvec + PVECSIZ) { - fname--; - break; - } - } - *fname = (char *) 0; /* mark end of vector */ - if (cp && *cp && *cp != '/') - if (cgetset(cp) < 0) - return(-2); - - i = cgetent(&dummy, pathvec, (char *)name); - - if (i == 0) { - char *pd, *ps, *tok, *s, *tcs; - size_t len; - - pd = _nc_termcap; - ps = dummy; - if ((tok = strchr(ps, ':')) == NULL) { - len = strlen(ps); - if (len >= TBUFSIZ) - i = -1; - else - strcpy(pd, ps); - goto done; - } - len = tok - ps + 1; - if (pd + len + 1 - _nc_termcap >= TBUFSIZ) { - i = -1; - goto done; - } - memcpy(pd, ps, len); - ps += len; - pd += len; - *pd = '\0'; - tcs = pd - 1; - for (;;) { - while ((tok = strsep(&ps, ":")) != NULL && - *(tok - 2) != '\\' && - (*tok == '\0' || *tok == '\\' || !isgraph(UChar(*tok)))) - ; - if (tok == NULL) - break; - for (s = tcs; s != NULL && s[1] != '\0'; - s = strchr(s, ':')) { - s++; - if (s[0] == tok[0] && s[1] == tok[1]) - goto skip_it; - } - len = strlen(tok); - if (pd + len + 1 - _nc_termcap >= TBUFSIZ) { - i = -1; - break; - } - memcpy(pd, tok, len); - pd += len; - *pd++ = ':'; - *pd = '\0'; - skip_it: ; - } - } -done: - if (dummy) - free(dummy); - - -/* - * From here on is ncurses-specific glue code - */ - - if (i < 0) - return(TGETENT_ERR); - - _nc_set_source("TERMCAP"); - _nc_read_entry_source((FILE *)NULL, _nc_termcap, FALSE, TRUE, NULLHOOK); - - if (_nc_head == (ENTRY *)NULL) - return(TGETENT_ERR); - - /* resolve all use references */ - _nc_resolve_uses2(TRUE, FALSE); - - for_entry_list(ep) - if (_nc_name_match(ep->tterm.term_names, name, "|:")) - { - /* - * Make a local copy of the terminal capabilities, delinked - * from the list. - */ - memcpy(tp, &ep->tterm, sizeof(TERMTYPE)); - _nc_delink_entry(_nc_head, &(ep->tterm)); - free(ep); - _nc_free_entries(_nc_head); - _nc_head = _nc_tail = NULL; /* do not reuse! */ - - return TGETENT_YES; /* OK */ - } - - _nc_free_entries(_nc_head); - _nc_head = _nc_tail = NULL; /* do not reuse! */ - return(TGETENT_NO); /* not found */ -} diff --git a/share/mk/src.tools.mk b/share/mk/src.tools.mk index 722734bbfc1a..5e3b7048409b 100644 --- a/share/mk/src.tools.mk +++ b/share/mk/src.tools.mk @@ -1,25 +1,26 @@ # Various tools used by the FreeBSD make installworld / distrib-dirs / # distribution / installkernel targets. Also called "bootstrap tools" # historically, however that name seemed to be ambiguous, as those tools # merely help distributing the OS build artefacts into staging / production # area. # # Very tiny subset of "itools", if you are old enough to know what it is. # # Please keep the list short, this file may and will be included from # many places within the source tree. Rule of thumb: if the above mentioned # targets survive with MYTOOL_CMD=false, then MYTOOL_CMD probably # does not belong here. Stick it somewhere else, thank you very much! # # $FreeBSD$ .if !target(____) INSTALL_CMD?= install MTREE_CMD?= mtree PWD_MKDB_CMD?= pwd_mkdb SERVICES_MKDB_CMD?= services_mkdb CAP_MKDB_CMD?= cap_mkdb +TIC_CMD?= tic ____: .endif # !target(____) diff --git a/usr.bin/Makefile b/usr.bin/Makefile index fcc406d2efc5..3e71dbb30e6b 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -1,300 +1,298 @@ # From: @(#)Makefile 8.3 (Berkeley) 1/7/94 # $FreeBSD$ .include SUBDIR= alias \ apply \ asa \ awk \ backlight \ banner \ basename \ brandelf \ bsdcat \ bsdiff \ bzip2 \ bzip2recover \ cap_mkdb \ chat \ chpass \ cksum \ cmp \ col \ colrm \ column \ comm \ compress \ cpuset \ csplit \ ctlstat \ cut \ diff \ dirname \ du \ elfctl \ elfdump \ enigma \ env \ etdump \ expand \ false \ fetch \ find \ fmt \ fold \ fstat \ fsync \ gcore \ gencat \ getaddrinfo \ getconf \ getent \ getopt \ grep \ gzip \ head \ hexdump \ id \ ident \ ipcrm \ ipcs \ join \ jot \ keylogin \ keylogout \ killall \ ktrace \ ktrdump \ lam \ ldd \ leave \ less \ lessecho \ lesskey \ limits \ locale \ localedef \ lock \ lockf \ logger \ login \ logins \ logname \ look \ lorder \ lsvfs \ lzmainfo \ m4 \ mandoc \ mesg \ minigzip \ ministat \ mkdep \ mkfifo \ mkimg \ mktemp \ mkuzip \ mt \ ncal \ + ncurses \ netstat \ newgrp \ nfsstat \ nice \ nl \ nohup \ opieinfo \ opiekey \ opiepasswd \ pagesize \ passwd \ paste \ patch \ pathchk \ perror \ posixshmcontrol \ pr \ printenv \ printf \ proccontrol \ procstat \ protect \ rctl \ renice \ resizewin \ rev \ revoke \ rpcinfo \ rs \ rup \ ruptime \ rusers \ rwall \ rwho \ script \ sdiff \ sed \ seq \ shar \ showmount \ sockstat \ soelim \ sort \ split \ stat \ stdbuf \ strings \ su \ systat \ - tabs \ tail \ tar \ tcopy \ tee \ time \ timeout \ tip \ top \ touch \ - tput \ tr \ true \ truncate \ - tset \ tsort \ tty \ uname \ unexpand \ uniq \ unzip \ units \ unvis \ uudecode \ uuencode \ vis \ vmstat \ w \ wall \ wc \ what \ whereis \ which \ whois \ write \ xargs \ xinstall \ xo \ xz \ xzdec \ yes \ zstd # NB: keep these sorted by MK_* knobs SUBDIR.${MK_ACCT}+= lastcomm SUBDIR.${MK_AT}+= at SUBDIR.${MK_ATM}+= atm SUBDIR.${MK_BLUETOOTH}+= bluetooth SUBDIR.${MK_BSD_CPIO}+= cpio SUBDIR.${MK_CALENDAR}+= calendar SUBDIR.${MK_CLANG}+= clang SUBDIR.${MK_DIALOG}+= dpv SUBDIR.${MK_EE}+= ee SUBDIR.${MK_FILE}+= file SUBDIR.${MK_FINGER}+= finger SUBDIR.${MK_FTP}+= ftp SUBDIR.${MK_GAMES}+= caesar SUBDIR.${MK_GAMES}+= factor SUBDIR.${MK_GAMES}+= fortune SUBDIR.${MK_GAMES}+= grdc SUBDIR.${MK_GAMES}+= morse SUBDIR.${MK_GAMES}+= number SUBDIR.${MK_GAMES}+= pom SUBDIR.${MK_GAMES}+= primes SUBDIR.${MK_GAMES}+= random SUBDIR.${MK_CXX}+= dtc .if ${MK_GH_BC} == "yes" SUBDIR+= gh-bc .else SUBDIR.${MK_OPENSSL}+= bc SUBDIR.${MK_OPENSSL}+= dc .endif SUBDIR.${MK_HESIOD}+= hesinfo SUBDIR.${MK_ICONV}+= iconv SUBDIR.${MK_ICONV}+= mkcsmapper SUBDIR.${MK_ICONV}+= mkesdb SUBDIR.${MK_ISCSI}+= iscsictl SUBDIR.${MK_KDUMP}+= kdump SUBDIR.${MK_KDUMP}+= truss SUBDIR.${MK_KERBEROS_SUPPORT}+= compile_et SUBDIR.${MK_LDNS_UTILS}+= drill SUBDIR.${MK_LDNS_UTILS}+= host SUBDIR.${MK_LIB32}+= ldd32 SUBDIR.${MK_LOCATE}+= locate # XXX msgs? SUBDIR.${MK_MAIL}+= biff SUBDIR.${MK_MAIL}+= from SUBDIR.${MK_MAIL}+= mail SUBDIR.${MK_MAIL}+= msgs SUBDIR.${MK_MAKE}+= bmake SUBDIR.${MK_MAN_UTILS}+= man SUBDIR.${MK_NETCAT}+= nc SUBDIR.${MK_NIS}+= ypcat SUBDIR.${MK_NIS}+= ypmatch SUBDIR.${MK_NIS}+= ypwhich SUBDIR.${MK_OPENSSH}+= ssh-copy-id SUBDIR.${MK_OPENSSL}+= chkey SUBDIR.${MK_OPENSSL}+= newkey SUBDIR.${MK_QUOTAS}+= quota SUBDIR.${MK_SENDMAIL}+= vacation SUBDIR.${MK_TALK}+= talk SUBDIR.${MK_TELNET}+= telnet SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua SUBDIR.${MK_TESTS}+= tests SUBDIR.${MK_TEXTPROC}+= ul SUBDIR.${MK_TFTP}+= tftp SUBDIR.${MK_TOOLCHAIN}+= addr2line SUBDIR.${MK_TOOLCHAIN}+= ar SUBDIR.${MK_TOOLCHAIN}+= c89 SUBDIR.${MK_TOOLCHAIN}+= c99 SUBDIR.${MK_TOOLCHAIN}+= ctags .if ${MK_LLVM_CXXFILT} == "no" SUBDIR.${MK_TOOLCHAIN}+= cxxfilt .endif SUBDIR.${MK_TOOLCHAIN}+= objcopy SUBDIR.${MK_TOOLCHAIN}+= file2c SUBDIR.${MK_TOOLCHAIN}+= gprof SUBDIR.${MK_TOOLCHAIN}+= indent SUBDIR.${MK_TOOLCHAIN}+= lex SUBDIR.${MK_TOOLCHAIN}+= mkstr SUBDIR.${MK_TOOLCHAIN}+= nm SUBDIR.${MK_TOOLCHAIN}+= readelf SUBDIR.${MK_TOOLCHAIN}+= rpcgen SUBDIR.${MK_TOOLCHAIN}+= unifdef SUBDIR.${MK_TOOLCHAIN}+= size SUBDIR.${MK_TOOLCHAIN}+= xstr SUBDIR.${MK_TOOLCHAIN}+= yacc SUBDIR.${MK_VI}+= vi SUBDIR.${MK_VT}+= vtfontcvt SUBDIR.${MK_USB}+= usbhidaction SUBDIR.${MK_USB}+= usbhidctl SUBDIR.${MK_UTMPX}+= last .if ${MK_CXX} != "no" SUBDIR.${MK_UTMPX}+= users .endif SUBDIR.${MK_UTMPX}+= who SUBDIR.${MK_SVN}+= svn SUBDIR.${MK_SVNLITE}+= svn SUBDIR.${MK_OFED}+= ofed # These are normally only handled for build-tools. .if make(clean*) SUBDIR+= mkcsmapper_static SUBDIR+= mkesdb_static .endif .include SUBDIR_PARALLEL= .include diff --git a/usr.bin/ncurses/Makefile b/usr.bin/ncurses/Makefile new file mode 100644 index 000000000000..cd8344aa1a97 --- /dev/null +++ b/usr.bin/ncurses/Makefile @@ -0,0 +1,40 @@ +PACKAGE= runtime + +.include +.include "${SRCTOP}/lib/ncurses/config.mk" + +.PATH: ${NCURSES_DIR}/progs ${NCURSES_DIR}/man + +PROGS= tic tput infocmp toe tabs clear tset +SRCS.tic= tic.c transform.c dump_entry.c tparm_type.c +SRCS.tput= tput.c tparm_type.c transform.c dump_entry.c clear_cmd.c reset_cmd.c \ + tty_settings.c +SRCS.infocmp= infocmp.c dump_entry.c +SRCS.tabs= tabs.c tty_settings.c +SRCS.clear= clear.c clear_cmd.c tty_settings.c +SRCS.tset= tset.c tty_settings.c transform.c reset_cmd.c +CFLAGS+= -I${NCURSES_DIR}/progs \ + -I${NCURSES_DIR}/include \ + -I${SRCTOP}/lib/ncurses/ncurses \ + -I${OBJTOP}/lib/ncurses/ncurses \ + -I${.CURDIR} +LIBADD= ncursesw +CLEANFILES= termsort.c + +termsort.c: MKtermsort.sh + sh ${NCURSES_DIR}/progs/MKtermsort.sh ${AWK} ${NCURSES_DIR}/include/Caps > ${.TARGET} +dump_entry.c: termsort.c + +LINKS.tic= ${BINDIR}/tic ${BINDIR}/captoinfo \ + ${BINDIR}/tic ${BINDIR}/infotocap +LINKS.tset= ${BINDIR}/tset ${BINDIR}/reset + +MLINKS.tic= tic.1 captoinfo.1 \ + tic.1 infotocap.1 +MLINKS.tset= tset.1 reset.1 + +.include + +.SUFFIXES: .1 .1m +.1m.1: + cat ${.IMPSRC} > ${.TARGET} diff --git a/usr.bin/ncurses/transform.h b/usr.bin/ncurses/transform.h new file mode 100644 index 000000000000..ec255c05c4dd --- /dev/null +++ b/usr.bin/ncurses/transform.h @@ -0,0 +1,10 @@ +#ifndef __TRANSFORM_H +#define __TRANSFORM_H 1 +#include +extern bool same_program(const char *, const char *); +#define PROG_CAPTOINFO "captoinfo" +#define PROG_INFOTOCAP "infotocap" +#define PROG_CLEAR "clear" +#define PROG_RESET "reset" +#define PROG_INIT "init" +#endif /* __TRANSFORM_H */ diff --git a/usr.bin/tput/Makefile b/usr.bin/tput/Makefile deleted file mode 100644 index d3171dab7ef0..000000000000 --- a/usr.bin/tput/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $FreeBSD$ - -PROG= tput -LIBADD= ncursesw -SCRIPTS=clear.sh -MLINKS= tput.1 clear.1 - -.include diff --git a/usr.bin/tput/Makefile.depend b/usr.bin/tput/Makefile.depend deleted file mode 100644 index 9b2a343de2dc..000000000000 --- a/usr.bin/tput/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncursesw \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/tput/clear.sh b/usr.bin/tput/clear.sh deleted file mode 100644 index 2c6e093e10c7..000000000000 --- a/usr.bin/tput/clear.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# -# SPDX-License-Identifier: BSD-3-Clause -# -# Copyright (c) 1989, 1993 -# The Regents of the University of California. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# -# @(#)clear.sh 8.1 (Berkeley) 6/6/93 -# - -exec tput clear diff --git a/usr.bin/tput/tput.1 b/usr.bin/tput/tput.1 deleted file mode 100644 index 996575bb622e..000000000000 --- a/usr.bin/tput/tput.1 +++ /dev/null @@ -1,179 +0,0 @@ -.\" Copyright (c) 1989, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)tput.1 8.2 (Berkeley) 3/19/94 -.\" $FreeBSD$ -.\" -.Dd June 15, 2002 -.Dt TPUT 1 -.Os -.Sh NAME -.Nm tput , -.Nm clear -.Nd terminal capability interface -.Sh SYNOPSIS -.Nm -.Op Fl T Ar term -.Op Ar attribute ... -.Nm clear -.Sh DESCRIPTION -The -.Nm -utility makes terminal-dependent information available to users or shell -applications. -.Pp -The -.Nm clear -utility executes the -.Dl tput clear -command, ignoring any arguments. -.Pp -The only option to -.Nm -is: -.Bl -tag -width 2n -.It Fl T -The terminal name as specified in the -.Xr termcap 5 -database, for example, -.Dq vt100 -or -.Dq xterm . -If not specified, -.Nm -retrieves the -.Dq Ev TERM -variable from the environment unless that too is not specified, -in which case an error message will be sent to standard error and -the error status will be 2. -.El -.Pp -The -.Nm -utility outputs a string for each -.Ar attribute -that is of type string; a number for each of type integer. -Otherwise, -.Nm -exits 0 if the terminal has the capability and 1 if it does not, -without further action. -.Pp -If an -.Ar attribute -is of type string, and takes arguments (e.g.\& cursor movement, -the termcap -.Dq cm -capability) the arguments are taken from the command line immediately -following the attribute. -.Pp -The following special attributes are available. -The first three use the capabilities of the specified terminal, -and only work if compatible with the utility's terminal. -.Bl -tag -width Ar -.It Cm clear -Clear the screen (the -.Xr termcap 5 -.Dq cl -capability). -.It Cm init -Initialize the terminal (the -.Xr termcap 5 -.Dq is -capability). -.It Cm reset -Reset the terminal (the -.Xr termcap 5 -.Dq rs -capability). -.It Cm longname -Print the descriptive name of the user's terminal type. -.El -.Sh ENVIRONMENT -.Bl -tag -width ".Ev TERM" -.It Ev TERM -The terminal name, if set and -.Fl T -is not used. -.El -.Sh EXIT STATUS -The exit status of -.Nm -is as follows: -.Bl -tag -width indent -.It 0 -If the last -.Ar attribute -is of type string or integer, its value was successfully written -to standard output. -If the -.Ar attribute -is of type boolean, the terminal does have the -.Ar attribute . -Otherwise, no -.Ar attribute -was specified. -.It 1 -If the last -.Ar attribute -is of type boolean, -this terminal does not have the -.Ar attribute . -.It 2 -Usage error. -For example, see -.Fl T -description. -.It 3 -No information is available about the specified terminal type. -.El -.Sh SEE ALSO -.Xr termcap 5 , -.Xr terminfo 5 -.Sh STANDARDS -The -.Nm -utility conforms to -.St -p1003.1-2001 . -.Sh HISTORY -The -.Nm -utility appeared in -.Bx 4.4 . -.Sh BUGS -The -.Nm -utility cannot really distinguish between different types of attributes. -.Pp -Some termcap entries depend upon having a -.Sq % -in them that is just a -.Sq % -and nothing more. -Right now we just warn about them if they do not -have a valid type declaration. -These warnings are sent to -stderr. diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c deleted file mode 100644 index 8f678f61b1a0..000000000000 --- a/usr.bin/tput/tput.c +++ /dev/null @@ -1,214 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1980, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1988, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif - -#ifndef lint -static const char sccsid[] = "@(#)tput.c 8.2 (Berkeley) 3/19/94"; -#endif - -#include - -#include -#include -#include -#include -#include -#include - -#undef putchar -#define outc putchar - -static void prlongname(char *); -static void usage(void); -static char **process(const char *, char *, char **); - -int -main(int argc, char **argv) -{ - int ch, exitval, n; - char *cptr, *term, buf[1024], tbuf[1024]; - const char *p; - - term = NULL; - while ((ch = getopt(argc, argv, "T:")) != -1) - switch(ch) { - case 'T': - term = optarg; - break; - case '?': - default: - usage(); - } - argc -= optind; - argv += optind; - - if (argc < 1) - usage(); - - if (!term && !(term = getenv("TERM"))) -errx(2, "no terminal type specified and no TERM environmental variable."); - if (tgetent(tbuf, term) != 1) - err(3, "tgetent failure"); - for (exitval = 0; (p = *argv) != NULL; ++argv) { - switch (*p) { - case 'c': - if (!strcmp(p, "clear")) - p = "cl"; - break; - case 'i': - if (!strcmp(p, "init")) - p = "is"; - break; - case 'l': - if (!strcmp(p, "longname")) { - prlongname(tbuf); - continue; - } - break; - case 'r': - if (!strcmp(p, "reset")) - p = "rs"; - break; - } - cptr = buf; - if (tgetstr(p, &cptr)) - argv = process(p, buf, argv); - else if ((n = tgetnum(p)) != -1) - (void)printf("%d\n", n); - else - exitval = !tgetflag(p); - } - exit(exitval); -} - -static void -prlongname(char *buf) -{ - int savech; - char *p, *savep; - - for (p = buf; *p && *p != ':'; ++p); - savech = *(savep = p); - for (*p = '\0'; p >= buf && *p != '|'; --p); - (void)printf("%s\n", p + 1); - *savep = savech; -} - -static char ** -process(const char *cap, char *str, char **argv) -{ - static const char errfew[] = - "not enough arguments (%d) for capability `%s'"; - static const char errmany[] = - "too many arguments (%d) for capability `%s'"; - static const char erresc[] = - "unknown %% escape `%c' for capability `%s'"; - char *cp; - int arg_need, arg_rows, arg_cols; - - /* Count how many values we need for this capability. */ - for (cp = str, arg_need = 0; *cp != '\0'; cp++) - if (*cp == '%') - switch (*++cp) { - case 'd': - case '2': - case '3': - case '.': - case '+': - arg_need++; - break; - case '%': - case '>': - case 'i': - case 'r': - case 'n': - case 'B': - case 'D': - break; - case 'p': - if (cp[1]) { - cp++; - break; - } - default: - /* - * hpux has lot's of them, but we complain - */ - warnx(erresc, *cp, cap); - } - - /* And print them. */ - switch (arg_need) { - case 0: - (void)tputs(str, 1, outc); - break; - case 1: - arg_cols = 0; - - if (*++argv == NULL || *argv[0] == '\0') - errx(2, errfew, 1, cap); - arg_rows = atoi(*argv); - - (void)tputs(tgoto(str, arg_cols, arg_rows), 1, outc); - break; - case 2: - if (*++argv == NULL || *argv[0] == '\0') - errx(2, errfew, 2, cap); - arg_cols = atoi(*argv); - - if (*++argv == NULL || *argv[0] == '\0') - errx(2, errfew, 2, cap); - arg_rows = atoi(*argv); - - (void) tputs(tgoto(str, arg_cols, arg_rows), arg_rows, outc); - break; - - default: - errx(2, errmany, arg_need, cap); - } - return (argv); -} - -static void -usage(void) -{ - (void)fprintf(stderr, "usage: tput [-T term] attribute ...\n"); - exit(2); -} diff --git a/usr.bin/tset/Makefile b/usr.bin/tset/Makefile deleted file mode 100644 index acf833495428..000000000000 --- a/usr.bin/tset/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/9/93 -# $FreeBSD$ - -PROG= tset -SRCS= map.c misc.c set.c term.c tset.c wrterm.c - -LIBADD= ncursesw -LINKS= ${BINDIR}/tset ${BINDIR}/reset -MLINKS= tset.1 reset.1 - -.include diff --git a/usr.bin/tset/Makefile.depend b/usr.bin/tset/Makefile.depend deleted file mode 100644 index 9b2a343de2dc..000000000000 --- a/usr.bin/tset/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncursesw \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.bin/tset/extern.h b/usr.bin/tset/extern.h deleted file mode 100644 index 79fee1be0501..000000000000 --- a/usr.bin/tset/extern.h +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)extern.h 8.1 (Berkeley) 6/9/93 - * $FreeBSD$ - */ - -#include - -extern struct termios mode, oldmode; -extern int Columns, isreset, Lines; -extern int erasech, intrchar, killch; -extern speed_t Ospeed; - -void add_mapping(const char *, char *); -void cat(char *); -const char *get_termcap_entry(char *, char **); -const char *mapped(const char *); -int outc(int); -void reset_mode(void); -void set_control_chars(void); -void set_conversions(int); -void set_init(void); -void wrtermcap(char *); diff --git a/usr.bin/tset/map.c b/usr.bin/tset/map.c deleted file mode 100644 index 4fa6d859f055..000000000000 --- a/usr.bin/tset/map.c +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93"; -#endif - -#include - -#include -#include -#include -#include - -#include "extern.h" - -static speed_t tset_baudrate(char *); - -/* Baud rate conditionals for mapping. */ -#define GT 0x01 -#define EQ 0x02 -#define LT 0x04 -#define NOT 0x08 -#define GE (GT | EQ) -#define LE (LT | EQ) - -typedef struct map { - struct map *next; /* Linked list of maps. */ - char *porttype; /* Port type, or "" for any. */ - char *type; /* Terminal type to select. */ - int conditional; /* Baud rate conditionals bitmask. */ - speed_t speed; /* Baud rate to compare against. */ -} MAP; - -static MAP *cur, *maplist; - -/* - * Syntax for -m: - * [port-type][test baudrate]:terminal-type - * The baud rate tests are: >, <, @, =, ! - */ -void -add_mapping(const char *port, char *arg) -{ - MAP *mapp; - char *copy, *p, *termp; - - copy = strdup(arg); - mapp = malloc(sizeof(MAP)); - if (copy == NULL || mapp == NULL) - errx(1, "malloc"); - mapp->next = NULL; - if (maplist == NULL) - cur = maplist = mapp; - else { - cur->next = mapp; - cur = mapp; - } - - mapp->porttype = arg; - mapp->conditional = 0; - - arg = strpbrk(arg, "><@=!:"); - - if (arg == NULL) { /* [?]term */ - mapp->type = mapp->porttype; - mapp->porttype = NULL; - goto done; - } - - if (arg == mapp->porttype) /* [><@=! baud]:term */ - termp = mapp->porttype = NULL; - else - termp = arg; - - for (;; ++arg) /* Optional conditionals. */ - switch(*arg) { - case '<': - if (mapp->conditional & GT) - goto badmopt; - mapp->conditional |= LT; - break; - case '>': - if (mapp->conditional & LT) - goto badmopt; - mapp->conditional |= GT; - break; - case '@': - case '=': /* Not documented. */ - mapp->conditional |= EQ; - break; - case '!': - mapp->conditional |= NOT; - break; - default: - goto next; - } - -next: if (*arg == ':') { - if (mapp->conditional) - goto badmopt; - ++arg; - } else { /* Optional baudrate. */ - arg = strchr(p = arg, ':'); - if (arg == NULL) - goto badmopt; - *arg++ = '\0'; - mapp->speed = tset_baudrate(p); - } - - if (*arg == '\0') /* Non-optional type. */ - goto badmopt; - - mapp->type = arg; - - /* Terminate porttype, if specified. */ - if (termp != NULL) - *termp = '\0'; - - /* If a NOT conditional, reverse the test. */ - if (mapp->conditional & NOT) - mapp->conditional = ~mapp->conditional & (EQ | GT | LT); - - /* If user specified a port with an option flag, set it. */ -done: if (port) { - if (mapp->porttype) -badmopt: errx(1, "illegal -m option format: %s", copy); - mapp->porttype = strdup(port); - } - free(copy); - -#ifdef MAPDEBUG - (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); - (void)printf("type: %s\n", mapp->type); - (void)printf("conditional: "); - p = ""; - if (mapp->conditional & GT) { - (void)printf("GT"); - p = "/"; - } - if (mapp->conditional & EQ) { - (void)printf("%sEQ", p); - p = "/"; - } - if (mapp->conditional & LT) - (void)printf("%sLT", p); - (void)printf("\nspeed: %d\n", mapp->speed); -#endif -} - -/* - * Return the type of terminal to use for a port of type 'type', as specified - * by the first applicable mapping in 'map'. If no mappings apply, return - * 'type'. - */ -const char * -mapped(const char *type) -{ - MAP *mapp; - int match; - - match = 0; - for (mapp = maplist; mapp; mapp = mapp->next) - if (mapp->porttype == NULL || !strcmp(mapp->porttype, type)) { - switch (mapp->conditional) { - case 0: /* No test specified. */ - match = 1; - break; - case EQ: - match = (Ospeed == mapp->speed); - break; - case GE: - match = (Ospeed >= mapp->speed); - break; - case GT: - match = (Ospeed > mapp->speed); - break; - case LE: - match = (Ospeed <= mapp->speed); - break; - case LT: - match = (Ospeed < mapp->speed); - break; - } - if (match) - return (mapp->type); - } - /* No match found; return given type. */ - return (type); -} - -typedef struct speeds { - const char *string; - speed_t speed; -} SPEEDS; - -static SPEEDS speeds[] = { - { "0", B0 }, - { "134.5", B134 }, - { "exta", B19200 }, - { "extb", B38400 }, - { NULL, 0 } -}; - -static speed_t -tset_baudrate(char *rate) -{ - SPEEDS *sp; - speed_t speed; - - /* The baudrate number can be preceded by a 'B', which is ignored. */ - if (*rate == 'B') - ++rate; - - for (sp = speeds; sp->string; ++sp) - if (!strcasecmp(rate, sp->string)) - return (sp->speed); - speed = atol(rate); - if (speed == 0) - errx(1, "unknown baud rate %s", rate); - return speed; -} diff --git a/usr.bin/tset/misc.c b/usr.bin/tset/misc.c deleted file mode 100644 index 737fde9dc130..000000000000 --- a/usr.bin/tset/misc.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/9/93"; -#endif - -#include -#include -#include -#include - -#include "extern.h" - -void -cat(char *file) -{ - register int fd, nr, nw; - char buf[1024]; - - if ((fd = open(file, O_RDONLY, 0)) < 0) - err(1, "%s", file); - - while ((nr = read(fd, buf, sizeof(buf))) > 0) - if ((nw = write(STDERR_FILENO, buf, nr)) == -1) - err(1, "write to stderr"); - if (nr != 0) - err(1, "%s", file); - (void)close(fd); -} - -int -outc(int c) -{ - return putc(c, stderr); -} diff --git a/usr.bin/tset/set.c b/usr.bin/tset/set.c deleted file mode 100644 index df204cebeebe..000000000000 --- a/usr.bin/tset/set.c +++ /dev/null @@ -1,324 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char sccsid[] = "@(#)set.c 8.2 (Berkeley) 2/28/94"; -#endif - -#include -#include -#include -#include - -#include "extern.h" - -#define CHK(val, dft) (val <= 0 ? dft : val) - -int set_tabs(void); - -/* - * Reset the terminal mode bits to a sensible state. Very useful after - * a child program dies in raw mode. - */ -void -reset_mode(void) -{ - tcgetattr(STDERR_FILENO, &mode); - -#if defined(VDISCARD) && defined(CDISCARD) - mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD); -#endif - mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); - mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE); -#if defined(VFLUSH) && defined(CFLUSH) - mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH); -#endif - mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR); - mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL); -#if defined(VLNEXT) && defined(CLNEXT) - mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT); -#endif - mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); -#if defined(VREPRINT) && defined(CRPRNT) - mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT); -#endif - mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART); - mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP); - mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP); -#if defined(VWERASE) && defined(CWERASE) - mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); -#endif - - mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR -#ifdef IUCLC - | IUCLC -#endif -#ifdef IXANY - | IXANY -#endif - | IXOFF); - - mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON -#ifdef IMAXBEL - | IMAXBEL -#endif - ); - - mode.c_oflag &= ~(0 -#ifdef OLCUC - | OLCUC -#endif -#ifdef OCRNL - | OCRNL -#endif -#ifdef ONOCR - | ONOCR -#endif -#ifdef ONLRET - | ONLRET -#endif -#ifdef OFILL - | OFILL -#endif -#ifdef OFDEL - | OFDEL -#endif -#ifdef NLDLY - | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY -#endif - ); - - mode.c_oflag |= (OPOST -#ifdef ONLCR - | ONLCR -#endif - ); - - mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | CLOCAL); - mode.c_cflag |= (CS8 | CREAD); - mode.c_lflag &= ~(ECHONL | NOFLSH | TOSTOP -#ifdef ECHOPTR - | ECHOPRT -#endif -#ifdef XCASE - | XCASE -#endif - ); - - mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK -#ifdef ECHOCTL - | ECHOCTL -#endif -#ifdef ECHOKE - | ECHOKE -#endif - ); - - tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); -} - -/* - * Determine the erase, interrupt, and kill characters from the termcap - * entry and command line and update their values in 'mode'. - */ -void -set_control_chars(void) -{ - char *bp, *p, bs_char, buf[1024]; - - bp = buf; - p = tgetstr("kb", &bp); - if (p == NULL || p[1] != '\0') - p = tgetstr("bc", &bp); - if (p != NULL && p[1] == '\0') - bs_char = p[0]; - else if (tgetflag("bs")) - bs_char = CTRL('h'); - else - bs_char = 0; - - if (erasech == 0 && bs_char != 0 && !tgetflag("os")) - erasech = -1; - if (erasech < 0) - erasech = (bs_char != 0) ? bs_char : CTRL('h'); - - if (mode.c_cc[VERASE] == 0 || erasech != 0) - mode.c_cc[VERASE] = erasech ? erasech : CERASE; - - if (mode.c_cc[VINTR] == 0 || intrchar != 0) - mode.c_cc[VINTR] = intrchar ? intrchar : CINTR; - - if (mode.c_cc[VKILL] == 0 || killch != 0) - mode.c_cc[VKILL] = killch ? killch : CKILL; -} - -/* - * Set up various conversions in 'mode', including parity, tabs, returns, - * echo, and case, according to the termcap entry. If the program we're - * running was named with a leading upper-case character, map external - * uppercase to internal lowercase. - */ -void -set_conversions(int usingupper) -{ - if (tgetflag("UC") || usingupper) { -#ifdef IUCLC - mode.c_iflag |= IUCLC; - mode.c_oflag |= OLCUC; -#endif - } else if (tgetflag("LC")) { -#ifdef IUCLC - mode.c_iflag &= ~IUCLC; - mode.c_oflag &= ~OLCUC; -#endif - } - mode.c_iflag &= ~(PARMRK | INPCK); - mode.c_lflag |= ICANON; - if (tgetflag("EP")) { - mode.c_cflag |= PARENB; - mode.c_cflag &= ~PARODD; - } - if (tgetflag("OP")) { - mode.c_cflag |= PARENB; - mode.c_cflag |= PARODD; - } - -#ifdef ONLCR - mode.c_oflag |= ONLCR; -#endif - mode.c_iflag |= ICRNL; - mode.c_lflag |= ECHO; - mode.c_oflag |= OXTABS; - if (tgetflag("NL")) { /* Newline, not linefeed. */ -#ifdef ONLCR - mode.c_oflag &= ~ONLCR; -#endif - mode.c_iflag &= ~ICRNL; - } - if (tgetflag("HD")) /* Half duplex. */ - mode.c_lflag &= ~ECHO; - if (tgetflag("pt")) /* Print tabs. */ - mode.c_oflag &= ~OXTABS; - mode.c_lflag |= (ECHOE | ECHOK); -} - -/* Output startup string. */ -void -set_init(void) -{ - char *bp, buf[1024]; - int settle; - - bp = buf; - if (tgetstr("pc", &bp) != 0) /* Get/set pad character. */ - PC = buf[0]; - -#ifdef TAB3 - if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { - oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); - tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode); - } -#endif - settle = set_tabs(); - - if (isreset) { - bp = buf; - if (tgetstr("rs", &bp) != 0 || tgetstr("is", &bp) != 0) { - tputs(buf, 0, outc); - settle = 1; - } - bp = buf; - if (tgetstr("rf", &bp) != 0 || tgetstr("if", &bp) != 0) { - cat(buf); - settle = 1; - } - } - - if (settle) { - (void)putc('\r', stderr); - (void)fflush(stderr); - (void)sleep(1); /* Settle the terminal. */ - } -} - -/* - * Set the hardware tabs on the terminal, using the ct (clear all tabs), - * st (set one tab) and ch (horizontal cursor addressing) capabilities. - * This is done before if and is, so they can patch in case we blow this. - * Return nonzero if we set any tab stops, zero if not. - */ -int -set_tabs(void) -{ - int c; - char *capsp, *clear_tabs; - char *set_column, *set_pos, *Set_tab; - char caps[1024]; - const char *tg_out; - - capsp = caps; - Set_tab = tgetstr("st", &capsp); - - if (Set_tab && (clear_tabs = tgetstr("ct", &capsp))) { - (void)putc('\r', stderr); /* Force to left margin. */ - tputs(clear_tabs, 0, outc); - } - - set_column = tgetstr("ch", &capsp); - set_pos = set_column ? NULL : tgetstr("cm", &capsp); - - if (Set_tab) { - for (c = 8; c < Columns; c += 8) { - /* - * Get to the right column. "OOPS" is returned by - * tgoto() if it can't do the job. (*snarl*) - */ - tg_out = "OOPS"; - if (set_column) - tg_out = tgoto(set_column, 0, c); - if (*tg_out == 'O' && set_pos) - tg_out = tgoto(set_pos, c, Lines - 1); - if (*tg_out != 'O') - tputs(tg_out, 1, outc); - else - (void)fprintf(stderr, "%s", " "); - /* Set the tab. */ - tputs(Set_tab, 0, outc); - } - putc('\r', stderr); - return (1); - } - return (0); -} diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c deleted file mode 100644 index 1c0196b1473c..000000000000 --- a/usr.bin/tset/term.c +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93"; -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "extern.h" - -static char tbuf[1024]; /* Termcap entry. */ - -const char *askuser(const char *); -char *ttys(char *); - -/* - * Figure out what kind of terminal we're dealing with, and then read in - * its termcap entry. - */ -const char * -get_termcap_entry(char *userarg, char **tcapbufp) -{ - struct ttyent *t; - int rval; - char *p, *ttypath; - const char *ttype; - - if (userarg) { - ttype = userarg; - goto found; - } - - /* Try the environment. */ - if ((ttype = getenv("TERM"))) - goto map; - - /* Try ttyname(3); check for dialup or other mapping. */ - if ((ttypath = ttyname(STDERR_FILENO))) { - if ((p = strrchr(ttypath, '/'))) - ++p; - else - p = ttypath; - if ((t = getttynam(p))) { - ttype = t->ty_type; - goto map; - } - } - - /* If still undefined, use "unknown". */ - ttype = "unknown"; - -map: ttype = mapped(ttype); - - /* - * If not a path, remove TERMCAP from the environment so we get a - * real entry from /etc/termcap. This prevents us from being fooled - * by out of date stuff in the environment. - */ -found: if ((p = getenv("TERMCAP")) != NULL && *p != '/') - unsetenv("TERMCAP"); - - /* - * ttype now contains a pointer to the type of the terminal. - * If the first character is '?', ask the user. - */ - if (ttype[0] == '?') { - if (ttype[1] != '\0') - ttype = askuser(ttype + 1); - else - ttype = askuser(NULL); - } - - /* Find the termcap entry. If it doesn't exist, ask the user. */ - while ((rval = tgetent(tbuf, ttype)) == 0) { - warnx("terminal type %s is unknown", ttype); - ttype = askuser(NULL); - } - if (rval == -1) - errx(1, "termcap: %s", strerror(errno ? errno : ENOENT)); - *tcapbufp = tbuf; - return (ttype); -} - -/* Prompt the user for a terminal type. */ -const char * -askuser(const char *dflt) -{ - static char answer[256]; - char *p; - - /* We can get recalled; if so, don't continue uselessly. */ - if (feof(stdin) || ferror(stdin)) { - (void)fprintf(stderr, "\n"); - exit(1); - } - for (;;) { - if (dflt) - (void)fprintf(stderr, "Terminal type? [%s] ", dflt); - else - (void)fprintf(stderr, "Terminal type? "); - (void)fflush(stderr); - - if (fgets(answer, sizeof(answer), stdin) == NULL) { - if (dflt == NULL) { - (void)fprintf(stderr, "\n"); - exit(1); - } - return (dflt); - } - - if ((p = strchr(answer, '\n'))) - *p = '\0'; - if (answer[0]) - return (answer); - if (dflt != NULL) - return (dflt); - } -} diff --git a/usr.bin/tset/tset.1 b/usr.bin/tset/tset.1 deleted file mode 100644 index 57e904a37a06..000000000000 --- a/usr.bin/tset/tset.1 +++ /dev/null @@ -1,421 +0,0 @@ -.\" Copyright (c) 1985, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)tset.1 8.1 (Berkeley) 6/9/93 -.\" $FreeBSD$ -.\" -.Dd June 6, 2015 -.Dt TSET 1 -.Os -.Sh NAME -.Nm tset , -.Nm reset -.Nd terminal initialization -.Sh SYNOPSIS -.Nm -.Op Fl IQrSs -.Op Fl -.Op Fl e Ar ch -.Op Fl i Ar ch -.Op Fl k Ar ch -.Op Fl m Ar mapping -.Op Ar terminal -.Nm reset -.Op Fl IQrSs -.Op Fl -.Op Fl e Ar ch -.Op Fl i Ar ch -.Op Fl k Ar ch -.Op Fl m Ar mapping -.Op Ar terminal -.Sh DESCRIPTION -The -.Nm -utility initializes terminals. -It first determines the type of terminal that you are using. -This determination is done as follows, using the first terminal type found. -.Pp -.Bl -bullet -compact -offset indent -.It -The -.Ar terminal -argument specified on the command line. -.It -The value of the -.Ev TERM -environment variable. -.It -The terminal type associated with the standard error output device in the -.Pa /etc/ttys -file. -.It -The default terminal type, ``unknown''. -.El -.Pp -If the terminal type was not specified on the command-line, the -.Fl m -option mappings are then applied (see below for more information). -Then, if the terminal type begins with a question mark (``?''), the user is -prompted for confirmation of the terminal type. -An empty response confirms the type, or, another type can be entered to -specify a new type. -Once the terminal type has been determined, the termcap entry for the terminal -is retrieved. -If no termcap entry is found for the type, the user is prompted for another -terminal type. -.Pp -Once the termcap entry is retrieved, the window size, backspace, interrupt -and line kill characters (among many other things) are set and the terminal -and tab initialization strings are sent to the standard error output. -Finally, if the erase, interrupt and line kill characters have changed, -or are not set to their default values, their values are displayed to the -standard error output. -.Pp -When invoked as -.Nm reset , -.Nm -sets cooked and echo modes, turns off cbreak and raw modes, turns on -newline translation and resets any unset special characters to their -default values before doing the terminal initialization described above. -This is useful after a program dies leaving a terminal in an abnormal state. -Note, you may have to type -.Dq Li reset -(the line-feed character is normally control-J) to get the terminal -to work, as carriage-return may no longer work in the abnormal state. -Also, the terminal will often not echo the command. -.Pp -The options are as follows: -.Bl -tag -width flag -.It Fl -The terminal type is displayed to the standard output, and the terminal is -not initialized in any way. -.It Fl e -Set the erase character to -.Ar ch . -.It Fl I -Do not send the terminal or tab initialization strings to the terminal. -.It Fl i -Set the interrupt character to -.Ar ch . -.It Fl k -Set the line kill character to -.Ar ch . -.It Fl m -Specify a mapping from a port type to a terminal. -See below for more information. -.It Fl Q -Do not display any values for the erase, interrupt and line kill characters. -.It Fl r -Print the terminal type to the standard error output. -.It Fl S -Print the terminal type and the termcap entry to the standard output. -See the section below on setting the environment for details. -.It Fl s -Print the sequence of shell commands to initialize the environment variables -.Ev TERM -and -.Ev TERMCAP -to the standard output. -See the section below on setting the environment for details. -.El -.Pp -The arguments for the -.Fl e , -.Fl i -and -.Fl k -options may either be entered as actual characters or by using the -.Dq hat -notation, i.e., control-h may be specified as -.Dq Li ^H -or -.Dq Li ^h . -.Sh SETTING THE ENVIRONMENT -It is often desirable to enter the terminal type and information about -the terminal's capabilities into the shell's environment. -This is done using the -.Fl S -and -.Fl s -options. -.Pp -When the -.Fl S -option is specified, the terminal type and the termcap entry are written -to the standard output, separated by a space and without a terminating -newline. -This can be assigned to an array by -.Nm csh -and -.Nm ksh -users and then used like any other shell array. -.Pp -When the -.Fl s -option is specified, the commands to enter the information into the -shell's environment are written to the standard output. -If the -.Ev SHELL -environment variable ends in ``csh'', the commands are for the -.Nm csh , -otherwise, they are for -.Xr sh 1 . -Note, the -.Nm csh -commands set and unset the shell variable -.Dq noglob , -leaving it unset. -The following line in the -.Pa .login -or -.Pa .profile -files will initialize the environment correctly: -.Bd -literal -offset indent -eval \`tset -s options ... \` -.Ed -.Pp -To demonstrate a simple use of the -.Fl S -option, the following lines in the -.Pa .login -file have an equivalent effect: -.Bd -literal -offset indent -set noglob -set term=(`tset -S options ...`) -setenv TERM $term[1] -setenv TERMCAP "$term[2]" -unset term -unset noglob -.Ed -.Sh TERMINAL TYPE MAPPING -When the terminal is not hardwired into the system (or the current system -information is incorrect) the terminal type derived from the -.Pa /etc/ttys -file or the -.Ev TERM -environment variable is often something generic like -.Dq network , -.Dq dialup , -or -.Dq unknown . -When -.Nm -is used in a startup script -.Pf ( Pa .profile -for -.Xr sh 1 -users or -.Pa .login -for -.Xr csh 1 -users) it is often desirable to provide information about the type of -terminal used on such ports. -The purpose of the -.Fl m -option is to -.Dq map -from some set of conditions to a terminal type, that is, to -tell -.Nm -``If I'm on this port at a particular speed, guess that I'm on that -kind of terminal''. -.Pp -The argument to the -.Fl m -option consists of an optional port type, an optional operator, an optional -baud rate specification, an optional colon (``:'') character and a terminal -type. -The port type is a string (delimited by either the operator or the colon -character). -The operator may be any combination of: -.Dq Li \&> , -.Dq Li \&< , -.Dq Li \&@ , -and -.Dq Li \&! ; -.Dq Li \&> -means greater than, -.Dq Li \&< -means less than, -.Dq Li \&@ -means equal to -and -.Dq Li !\& -inverts the sense of the test. -The baud rate is specified as a number and is compared with the speed -of the standard error output (which should be the control terminal). -The terminal type is a string. -.Pp -If the terminal type is not specified on the command line, the -.Fl m -mappings are applied to the terminal type. -If the port type and baud rate match the mapping, the terminal type specified -in the mapping replaces the current type. -If more than one mapping is specified, the first applicable mapping is used. -.Pp -For example, consider the following mapping: -.Dq Li dialup>9600:vt100 . -The port type is -.Dq Li dialup , -the operator is -.Dq Li > , -the baud rate specification is -.Dq Li 9600 , -and the terminal type is -.Dq Li vt100 . -The result of this mapping is to specify that if the terminal type is -.Dq Li dialup , -and the baud rate is greater than 9600 baud, a terminal type of -.Dq Li vt100 -will be used. -.Pp -If no port type is specified, the terminal type will match any port type, -for example, -.Dq Li -m dialup:vt100 -m :?xterm -will cause any dialup port, regardless of baud rate, to match the terminal -type -.Dq Li vt100 , -and any non-dialup port type to match the terminal type -.Dq Li ?xterm . -Note, because of the leading question mark, the user will be -queried on a default port as to whether they are actually using an -.Ar xterm -terminal. -.Pp -No whitespace characters are permitted in the -.Fl m -option argument. -Also, to avoid problems with metacharacters, it is suggested that the entire -.Fl m -option argument be placed within single quote characters, and that -.Nm csh -users insert a backslash character (``\e'') before any exclamation -marks (``!''). -.Sh ENVIRONMENT -The -.Nm -command utilizes the -.Ev SHELL -and -.Ev TERM -environment variables. -.Sh FILES -.Bl -tag -width /usr/share/misc/termcap -compact -.It Pa /etc/ttys -system port name to terminal type mapping database -.It Pa /usr/share/misc/termcap -terminal capability database -.El -.Sh COMPATIBILITY -The -.Fl A , -.Fl E , -.Fl h , -.Fl u -and -.Fl v -options have been deleted from the -.Nm -utility. -None of them were documented in -.Bx 4.3 -and all are of limited utility at -best. -The -.Fl a , -.Fl d -and -.Fl p -options are similarly not documented or useful, but were retained as they -appear to be in widespread use. -It is strongly recommended that any usage of these three options be -changed to use the -.Fl m -option instead. -The -.Fl n -option remains, but has no effect. -It is still permissible to specify the -.Fl e , -.Fl i -and -.Fl k -options without arguments, although it is strongly recommended that such -usage be fixed to explicitly specify the character. -.Pp -Executing -.Nm -as -.Nm reset -no longer implies the -.Fl Q -option. -Also, the interaction between the -.Fl -option and the -.Ar terminal -argument in some historic implementations of -.Nm -has been removed. -.Pp -Finally, the -.Nm -implementation has been completely redone (as part of the addition to the -system of a -.St -p1003.1-88 -compliant terminal interface) and will no longer compile on systems with -older terminal interfaces. -.Sh SEE ALSO -.Xr csh 1 , -.Xr sh 1 , -.Xr stty 1 , -.Xr tty 4 , -.Xr termcap 5 , -.Xr ttys 5 , -.Xr environ 7 -.Sh HISTORY -The -.Nm -and -.Nm reset -utilities first appeared in -.Bx 1 . -.Sh AUTHORS -.An -nosplit -The original version of -.Nm tset -was written by -.An Eric P. Allman -in October 1977, and -.Nm reset -was originally written by -.An Kurt Shoens . -The current version also contains code by -.An Zeyd M. Ben-Halim , -.An Eric S. Raymond , -and -.An Thomas E. Dickey . diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c deleted file mode 100644 index be6fbf3abd2d..000000000000 --- a/usr.bin/tset/tset.c +++ /dev/null @@ -1,299 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1980, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif - -#ifndef lint -static const char sccsid[] = "@(#)tset.c 8.1 (Berkeley) 6/9/93"; -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "extern.h" - -void obsolete(char *[]); -void report(const char *, int, u_int); -void usage(void); - -struct termios mode, oldmode; - -int erasech; /* new erase character */ -int intrchar; /* new interrupt character */ -int isreset; /* invoked as reset */ -int killch; /* new kill character */ -int Lines, Columns; /* window size */ -speed_t Ospeed; - -int -main(int argc, char *argv[]) -{ -#ifdef TIOCGWINSZ - struct winsize win; -#endif - int ch, noinit, noset, quiet, Sflag, sflag, showterm, usingupper; - char *p, *tcapbuf; - const char *ttype; - - if (tcgetattr(STDERR_FILENO, &mode) < 0) - err(1, "standard error"); - - oldmode = mode; - Ospeed = cfgetospeed(&mode); - - if ((p = strrchr(*argv, '/'))) - ++p; - else - p = *argv; - usingupper = isupper(*p); - if (!strcasecmp(p, "reset")) { - isreset = 1; - reset_mode(); - } - - obsolete(argv); - noinit = noset = quiet = Sflag = sflag = showterm = 0; - while ((ch = getopt(argc, argv, "-a:d:e:Ii:k:m:np:QSrs")) != -1) { - switch (ch) { - case '-': /* display term only */ - noset = 1; - break; - case 'a': /* OBSOLETE: map identifier to type */ - add_mapping("arpanet", optarg); - break; - case 'd': /* OBSOLETE: map identifier to type */ - add_mapping("dialup", optarg); - break; - case 'e': /* erase character */ - erasech = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; - break; - case 'I': /* no initialization strings */ - noinit = 1; - break; - case 'i': /* interrupt character */ - intrchar = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; - break; - case 'k': /* kill character */ - killch = optarg[0] == '^' && optarg[1] != '\0' ? - optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : - optarg[0]; - break; - case 'm': /* map identifier to type */ - add_mapping(NULL, optarg); - break; - case 'n': /* OBSOLETE: set new tty driver */ - break; - case 'p': /* OBSOLETE: map identifier to type */ - add_mapping("plugboard", optarg); - break; - case 'Q': /* don't output control key settings */ - quiet = 1; - break; - case 'S': /* output TERM/TERMCAP strings */ - Sflag = 1; - break; - case 'r': /* display term on stderr */ - showterm = 1; - break; - case 's': /* output TERM/TERMCAP strings */ - sflag = 1; - break; - case '?': - default: - usage(); - } - } - argc -= optind; - argv += optind; - - if (argc > 1) - usage(); - - ttype = get_termcap_entry(*argv, &tcapbuf); - - if (!noset) { - Columns = tgetnum("co"); - Lines = tgetnum("li"); - -#ifdef TIOCGWINSZ - /* Set window size */ - (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win); - if (win.ws_row == 0 && win.ws_col == 0 && - Lines > 0 && Columns > 0) { - win.ws_row = Lines; - win.ws_col = Columns; - (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win); - } -#endif - set_control_chars(); - set_conversions(usingupper); - - if (!noinit) - set_init(); - - /* Set the modes if they've changed. */ - if (memcmp(&mode, &oldmode, sizeof(mode))) - tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); - } - - if (noset) - (void)printf("%s\n", ttype); - else { - if (showterm) - (void)fprintf(stderr, "Terminal type is %s.\n", ttype); - /* - * If erase, kill and interrupt characters could have been - * modified and not -Q, display the changes. - */ - if (!quiet) { - report("Erase", VERASE, CERASE); - report("Kill", VKILL, CKILL); - report("Interrupt", VINTR, CINTR); - } - } - - if (Sflag) { - (void)printf("%s ", ttype); - if (strlen(tcapbuf) > 0) - wrtermcap(tcapbuf); - } - - if (sflag) { - /* - * Figure out what shell we're using. A hack, we look for an - * environmental variable SHELL ending in "csh". - */ - if ((p = getenv("SHELL")) && - !strcmp(p + strlen(p) - 3, "csh")) { - printf("set noglob;\nsetenv TERM %s;\n", ttype); - if (strlen(tcapbuf) > 0) { - printf("setenv TERMCAP '"); - wrtermcap(tcapbuf); - printf("';\n"); - } - printf("unset noglob;\n"); - } else { - printf("TERM=%s;\n", ttype); - if (strlen(tcapbuf) > 0) { - printf("TERMCAP='"); - wrtermcap(tcapbuf); - printf("';\nexport TERMCAP;\n"); - } - printf("export TERM;\n"); - } - } - - exit(0); -} - -/* - * Tell the user if a control key has been changed from the default value. - */ -void -report(const char *name, int which, u_int def) -{ - u_int old, new; - - new = mode.c_cc[which]; - old = oldmode.c_cc[which]; - - if (old == new && old == def) - return; - - (void)fprintf(stderr, "%s %s ", name, old == new ? "is" : "set to"); - - if (new == 010) - (void)fprintf(stderr, "backspace.\n"); - else if (new == 0177) - (void)fprintf(stderr, "delete.\n"); - else if (new < 040) { - new ^= 0100; - (void)fprintf(stderr, "control-%c (^%c).\n", new, new); - } else - (void)fprintf(stderr, "%c.\n", new); -} - -/* - * Convert the obsolete argument form into something that getopt can handle. - * This means that -e, -i and -k get default arguments supplied for them. - */ -void -obsolete(char *argv[]) -{ - for (; *argv; ++argv) { - if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') || - (argv[0][1] != 'e' && argv[0][1] != 'i' && argv[0][1] != 'k') || - argv[0][2] != '\0') - continue; - switch(argv[0][1]) { - case 'e': - argv[0] = strdup("-e^H"); - break; - case 'i': - argv[0] = strdup("-i^C"); - break; - case 'k': - argv[0] = strdup("-k^U"); - break; - } - } -} - -void -usage(void) -{ - (void)fprintf(stderr, "%s\n%s\n", -"usage: tset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]", -" reset [-IQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]"); - exit(1); -} - diff --git a/usr.bin/tset/wrterm.c b/usr.bin/tset/wrterm.c deleted file mode 100644 index cd98558f20a9..000000000000 --- a/usr.bin/tset/wrterm.c +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -__FBSDID("$FreeBSD$"); - -#ifndef lint -static const char sccsid[] = "@(#)wrterm.c 8.1 (Berkeley) 6/9/93"; -#endif - -#include - -#include -#include -#include -#include - -#include "extern.h" - -/* - * Output termcap entry to stdout, quoting characters that would give the - * shell problems and omitting empty fields. - */ -void -wrtermcap(char *bp) -{ - register int ch; - register char *p; - char *t, *sep; - - /* Find the end of the terminal names. */ - if ((t = strchr(bp, ':')) == NULL) - errx(1, "termcap names not colon terminated"); - *t++ = '\0'; - - /* Output terminal names that don't have whitespace. */ - sep = strdup(""); - while ((p = strsep(&bp, "|")) != NULL) - if (*p != '\0' && strpbrk(p, " \t") == NULL) { - (void)printf("%s%s", sep, p); - sep = strdup("|"); - } - (void)putchar(':'); - - /* - * Output fields, transforming any dangerous characters. Skip - * empty fields or fields containing only whitespace. - */ - while ((p = strsep(&t, ":")) != NULL) { - while ((ch = *p) != '\0' && isspace(ch)) - ++p; - if (ch == '\0') - continue; - while ((ch = *p++) != '\0') - switch(ch) { - case '\033': - (void)printf("\\E"); - case ' ': /* No spaces. */ - (void)printf("\\040"); - break; - case '!': /* No csh history chars. */ - (void)printf("\\041"); - break; - case ',': /* No csh history chars. */ - (void)printf("\\054"); - break; - case '"': /* No quotes. */ - (void)printf("\\042"); - break; - case '\'': /* No quotes. */ - (void)printf("\\047"); - break; - case '`': /* No quotes. */ - (void)printf("\\140"); - break; - case '\\': /* Anything following is OK. */ - case '^': - (void)putchar(ch); - if ((ch = *p++) == '\0') - break; - /* FALLTHROUGH */ - default: - (void)putchar(ch); - } - (void)putchar(':'); - } -}