On 2014-11-04 Tue 01:55 AM |, Alexei Malinin wrote:
> Hi, Craig.
>
> I think that I understand your problem - you use pccon in the wrong
> place, i. e. for tty00, but pccon is intended for use with ttyC*
>
> For tty00 of the target device I use the same TERM type, which is set on
> the device from which I make serial access to this target device.
> So for your example when you make serial access to teak.britvault.co.uk
> from @palm you should set xterm+sl for tty00 of teak.britvault.co.uk.
>
Ah! (Cluebat -vs- solitary brain cell.....)
I compared a few terminal types and observed a variety of output:
$ grep ^ttyC ttys | fgrep -w on
ttyC0 "/usr/libexec/getty std.9600" vt220 on
ttyC1 "/usr/libexec/getty std.9600" pccon on
ttyC2 "/usr/libexec/getty std.9600" wsvt25m on
ttyC3 "/usr/libexec/getty std.9600" pcvt25-color on
ttyC5 "/usr/libexec/getty std.9600" pcvt25-color on secure
$ cat ~/bin/ttyC-term-tput-tester
#!/bin/sh
print "\$SHELL:\t${SHELL}"
print "\$TERM:\t${TERM}"
print -n "tty:\t"
tty
for cap in mb md mh mr so se us ue
do
print -n "${cap}:\t"
tput ${cap} && print 'Yes'
tput me
done
# blink mb turn on blinking
# bold md turn on bold (extra bright) mode
# sgr0 me turn off all attributes
# dim mh turn on half-bright mode
# rev mr turn on reverse video mode
# sms so begin standout mode
# rmso se exit standout mode
# smul us begin underline mode
# rmul ue exit underline mode
_tput_colours=$(tput colors)
[[ ${_tput_colours} -gt 0 ]] &&
{
jot ${_tput_colours} 0 |
while read _colour_id
do
print -n "clr${_colour_id}:\t"
tput AF ${_colour_id} && print 'colour'
tput me
done
}
# Outputs:
$SHELL: /bin/sh
$TERM: vt220
tty: /dev/ttyC0
mb: [5mYes # blinking
[0mmd: [1mYes # emboldened
[0mmh: tput: Unknown terminfo capability `mh'
[0mmr: [7mYes # reversed
[0mso: [7mYes # reversed/stood out
[0mse: [27mYes
[0mus: [4mYes # not underlined, cyan colour
[0mue: [24mYes
[0m
$SHELL: /bin/sh
$TERM: pccon
tty: /dev/ttyC1
mb: tput: Unknown terminfo capability `mb'
[0mmd: tput: Unknown terminfo capability `md'
[0mmh: tput: Unknown terminfo capability `mh'
[0mmr: [7mYes # reversed
[0mso: [7mYes # reversed/stood out
[0mse: [mYes
[0mus: tput: Unknown terminfo capability `us'
[0mue: tput: Unknown terminfo capability `ue'
[0mclr0: [30mcolour
[0mclr1: [31mcolour
[0mclr2: [32mcolour
[0mclr3: [33mcolour
[0mclr4: [34mcolour
[0mclr5: [35mcolour
[0mclr6: [36mcolour
[0mclr7: [37mcolour
[0m
$SHELL: /bin/sh
$TERM: wsvt25m
tty: /dev/ttyC2
mb: [5mYes # blinking
[0mmd: [1mYes # emboldened
[0mmh: tput: Unknown terminfo capability `mh'
[0mmr: [7mYes # reversed
[0mso: [7mYes # reversed/stood out
[0mse: [27mYes
[0mus: [4mYes # no underline, cyan colour
[0mue: [24mYes
[0mclr0: [30mcolour
[0mclr1: [31mcolour
[0mclr2: [32mcolour
[0mclr3: [33mcolour
[0mclr4: [34mcolour
[0mclr5: [35mcolour
[0mclr6: [36mcolour
[0mclr7: [37mcolour
[0m
$SHELL: /bin/sh
$TERM: pcvt25-color
tty: /dev/ttyC3
mb: [5mYes # blinking
[mmd: [1mYes # emboldened
[mmh: tput: Unknown terminfo capability `mh'
[mmr: [7mYes # reversed
[mso: [7mYes # reversed/stood out
[mse: [27mYes
[mus: [4mYes # no underline, cyan colour
[mue: [24mYes
[mclr0: [30mcolour
[mclr1: [31mcolour
[mclr2: [32mcolour
[mclr3: [33mcolour
[mclr4: [34mcolour
[mclr5: [35mcolour
[mclr6: [36mcolour
[mclr7: [37mcolour
[m
# ssh session:
$SHELL: /bin/sh
$TERM: xterm+sl
tty: /dev/ttyp6
mb: [5mYes # blinking
(B[mmd: [1mYes # emboldened
(B[mmh: tput: Unknown terminfo capability `mh'
(B[mmr: [7mYes # reversed
(B[mso: [7mYes # reveresd/stood out
(B[mse: [27mYes
(B[mus: [4mYes # underlined, no colour
(B[mue: [24mYes
(B[mclr0: [30mcolour
(B[mclr1: [31mcolour
(B[mclr2: [32mcolour
(B[mclr3: [33mcolour
(B[mclr4: [34mcolour
(B[mclr5: [35mcolour
(B[mclr6: [36mcolour
(B[mclr7: [37mcolour
(B[m
# tmux session:
$SHELL: /bin/sh
$TERM: screen
tty: /dev/ttyp5
mb: [5mYes # blinking
[0mmd: [1mYes # emboldened
[0mmh: tput: Unknown terminfo capability `mh'
[0mmr: [7mYes # reversed
[0mso: [3mYes # reversed/stood out
[0mse: [23mYes
[0mus: [4mYes # underlined, no colour
[0mue: [24mYes
[0mclr0: [30mcolour
[0mclr1: [31mcolour
[0mclr2: [32mcolour
[0mclr3: [33mcolour
[0mclr4: [34mcolour
[0mclr5: [35mcolour
[0mclr6: [36mcolour
[0mclr7: [37mcolour
[0m
$ stat .profile
stat: .profile: No such file or directory
$ cat /etc/profile
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab
#
# Solve amd symlink related window decoration issues:
# Also needed for tmux as $TERM = 'screen'
[[ ${PWD} == ${HOME} ]] ||
{
# /nonexistent?
[[ -d ${HOME} ]] && cd
}
[[ -o interactive ]] &&
{
[[ -n ${XTERM_VERSION} ]] && I='I'
eval $(tset -${I}sQ '-munknown:?vt220' ${TERM})
# Settings:
set -o trackall
set -o csh-history
set -o bgnice
# Aliases:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias df='df -h'
alias du='du -h'
alias ls='ls -F'
alias quit='print use: exit'
alias logout='quit'
alias logoff='quit'
alias bye='quit'
alias cls='print use: clear'
alias p='ps -l'
alias j='jobs'
alias mkpasswd='apg -M SNCL -E 01OIl\| -n 1'
alias ns='netstat -naf inet'
alias traceroute='traceroute -I'
alias mutt='mutt -y'
alias sube='sudo -H -i -u'
alias m2u="tr ''\015'' ''\012''"
alias u2m="tr ''\012'' ''\015''"
alias dos2unix="tr '\\r' '\\n'"
alias unix2dos="tr '\\n' '\\r'"
HISTSIZE='100'
HISTFILE="${HOME}/.sh_history"
PAGER='less'
MANPAGER=${PAGER}
LESS="--LONG-PROMPT --ignore-case"
export HISTSIZE HISTFILE PAGER MANPAGER LESS
# terminfo(5)
# blink mb turn on blinking
# bold md turn on bold (extra bright) mode
# sgr0 me turn off all attributes
# dim mh turn on half-bright mode
# rev mr turn on reverse video mode
# sms so begin standout mode
# rmso se exit standout mode
# smul us begin underline mode
# rmul ue exit underline mode
tp_blink=$(tput mb 2>/dev/null)
tp_bold=$(tput md 2>/dev/null)
tp_normal=$(tput me)
tp_standout=$(tput so 2>/dev/null)
tp_underline=$(tput us 2>/dev/null)
# If the terminal can put colours;
[[ $(tput colors) -gt 7 ]] &&
{
whence -p colorls > /dev/null && alias ls='colorls -GF'
# terminfo(5) colours
# black 0
# red 1
# green 2
# yellow 3
# blue 4
# magenta 5
# cyan 6
# white 7
# Set a random colour between red & cyan
tp_colour=$(tput AF $(jot -r 1 1 6))
tp_colour_red=$(tput AF 1)
#
http://unix.stackexchange.com/questions/119/colors-in-man-pages
#
http://unix.stackexchange.com/questions/108699/documentation-on-less-termcap-variables
LESS_TERMCAP_mb="${tp_blink}${tp_colour_red}"
LESS_TERMCAP_md="${tp_bold}$(tput AF 2)"
# tput: Unknown terminfo capability `mh':
LESS_TERMCAP_mh=$(tput AF 5) # see if this ever shows up....
# default: export LESS_TERMCAP_mr=$(tput mr)
LESS_TERMCAP_so="${tp_standout}$(tput AF 3)"
LESS_TERMCAP_se=${tp_normal}
LESS_TERMCAP_us="${tp_underline}$(tput AF 6)"
LESS_TERMCAP_ue=${tp_normal}
export LESS_TERMCAP_mb LESS_TERMCAP_md LESS_TERMCAP_mh \
LESS_TERMCAP_so LESS_TERMCAP_se LESS_TERMCAP_us
LESS_TERMCAP_ue
}
whence -p vim > /dev/null &&
{
EDITOR='vim'
VIM_TMP="/var/tmp/${LOGNAME}//"
export EDITOR VIM_TMP
[[ -d ${VIM_TMP} ]] ||
{
mkdir ${VIM_TMP} && chmod 0700 ${VIM_TMP}
}
alias view='vim -R'
}
HOSTNAME=${HOSTNAME:-$(hostname)}
TAG="${LOGNAME}@${HOSTNAME}"
# Adapted from <[email protected]>'s post:
# http://marc.info/?l=openbsd-misc&m=141447819727360&w=2
function _ps1_err
{
local _rc=$?
[[ ${_rc} -eq 0 ]] || print -n
"${tp_colour_red}${tp_blink}${tp_standout} (${_rc}) "
return ${_rc}
}
# Mostly emulate ksh's PS1 \W
function _ksh_W
{
case ${PWD} in
${HOME})
print '~'
;;
'/')
print '/'
;;
*)
print "${PWD##*/}/"
;;
esac
}
# Mostly emulate ksh's \u@\h:\W
PROMPT="<${LOGNAME}@${HOSTNAME%%.*}:"'$(_ksh_W)>'
if [[ ${LOGNAME} == 'root' || -z ${tp_colour} ]]
then
PROMPT="${tp_standout}${PROMPT}"
else
PROMPT="${tp_colour}${PROMPT}"
[[ $(($RANDOM%2)) -eq 0 ]] && PROMPT="${tp_bold}${PROMPT}"
fi
PROMPT="${PROMPT}${tp_normal}"'$(_ps1_err)'
# Finally, append the '#|$' and [space] characters
if [[ ${LOGNAME} == 'root' ]]
then
PROMPT="${PROMPT}#"
else
PROMPT="${PROMPT}\$"
fi
# All done setting PS1
PS1="${PROMPT}${tp_normal} "
# terminfo(5): hs: has extra status line
# FIXME screen-s is missing :hs in /etc/termcap,
tput hs &&
{
WLS=$(tput ts) # move to status line, column #1
WLE=$(tput fs) # return from status line
}
# If window decorations:
[[ -n ${WLS} ]] &&
{
function _stripe
{
local _return_code=$?
print -n "${WLS}"$(_ksh_W)" <${TAG}>${WLE}" > /dev/tty
return ${_return_code}
}
alias cd='_cd'
function _cd
{
\cd "$@" && _stripe
}
alias ftp='_ftp'
function _ftp
{
\ftp "$@"
_stripe
}
alias ssh='_ssh'
function _ssh
{
\ssh "$@"
_stripe
}
alias telnet='_telnet'
function _telnet
{
\telnet "$@"
_stripe
}
alias rlogin='_rlogin'
function _rlogin
{
\rlogin "$@"
_stripe
}
alias su='_su'
function _su
{
\su "$@"
_stripe
}
alias sudo='_sudo'
function _sudo
{
\sudo "$@"
_stripe
}
alias tip='_tip'
function _tip
{
\tip "$@"
_stripe
}
alias cu='_cu'
function _cu
{
\cu "$@"
_stripe
}
_stripe
}
}
$ uname -a
OpenBSD teak.britvault.co.uk 5.5 GENERIC#276 i386
>
> --
> Alexei
>
>
> On 11/04/14 00:34, Craig R. Skinner wrote:
> > On 2014-10-31 Fri 14:54 PM |, Alexei Malinin wrote:
> >>> Hi Alexei,
> >>>
> >>> Do you think it would be possible to add these attributes to
> >>> your OpenBSD pccon terminfo/termcap entry:
> >>>
> >>> mb: turn on blinking
> >>> md: turn on bold (extra bright) mode
> >>> mh: turn on half-bright mode
> >>> us: begin underline mode
> >>> ue: exit underline mode
> >>>
> >>> hs: has status line
> >>> es: escape can be used on the status line
> >>> ts: move to status line, column #1
> >>> fs: return from status line
> >> Hi, Craig.
> >>
> >> The possibility depends on the capabilities of the OpenBSD wscons(4)
> >> driver (see also src/sys/dev/wscons/wsemul_vt100_subr.c).
> >>
> >> You can read about the history of pccon in
> >> http://marc.info/?l=ncurses-bug&m=131825802104588&w=2 &
> >> http://marc.info/?l=openbsd-misc&m=132125411729722&w=2.
> >>
> > Thanks Alexei.
> >
> > While I'm not a C hacker (nor very smart...), I've been trying different
> > entries in /etc/ttys for tty00 as per earlier in that misc@ thread.
> >
> >
> > .....