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:     Yes         # blinking
md: Yes # emboldened
mh: tput: Unknown terminfo capability `mh'
mr: Yes # reversed
so: Yes # reversed/stood out
se: Yes
us: Yes # not underlined, cyan colour
ue: Yes




$SHELL: /bin/sh
$TERM:  pccon
tty:    /dev/ttyC1
mb:     tput: Unknown terminfo capability `mb'
md: tput: Unknown terminfo capability `md'
mh: tput: Unknown terminfo capability `mh'
mr: Yes # reversed
so: Yes # reversed/stood out
se: Yes
us: tput: Unknown terminfo capability `us'
ue: tput: Unknown terminfo capability `ue'
clr0:       colour
clr1:       colour
clr2:       colour
clr3:       colour
clr4:       colour
clr5:       colour
clr6:       colour
clr7:       colour




$SHELL: /bin/sh
$TERM:  wsvt25m
tty:    /dev/ttyC2
mb:     Yes         # blinking
md: Yes # emboldened
mh: tput: Unknown terminfo capability `mh'
mr: Yes # reversed
so: Yes # reversed/stood out
se: Yes
us: Yes # no underline, cyan colour
ue: Yes
clr0:       colour
clr1:       colour
clr2:       colour
clr3:       colour
clr4:       colour
clr5:       colour
clr6:       colour
clr7:       colour




$SHELL: /bin/sh
$TERM:  pcvt25-color
tty:    /dev/ttyC3
mb:     Yes # blinking
md:  Yes # emboldened
mh:  tput: Unknown terminfo capability `mh'
mr:  Yes # reversed
so:  Yes # reversed/stood out
se:  Yes
us:  Yes # no underline, cyan colour
ue:  Yes
clr0:        colour
clr1:        colour
clr2:        colour
clr3:        colour
clr4:        colour
clr5:        colour
clr6:        colour
clr7:        colour




# ssh session:
$SHELL: /bin/sh
$TERM:  xterm+sl
tty:    /dev/ttyp6
mb:     Yes         # blinking
(Bmd:       Yes # emboldened
(Bmh:       tput: Unknown terminfo capability `mh'
(Bmr:       Yes # reversed
(Bso:       Yes # reveresd/stood out
(Bse:       Yes
(Bus:       Yes # underlined, no colour
(Bue:       Yes
(Bclr0:     colour
(Bclr1:     colour
(Bclr2:     colour
(Bclr3:     colour
(Bclr4:     colour
(Bclr5:     colour
(Bclr6:     colour
(Bclr7:     colour
(B



# tmux session:
$SHELL: /bin/sh
$TERM:  screen
tty:    /dev/ttyp5
mb:     Yes         # blinking
md: Yes # emboldened
mh: tput: Unknown terminfo capability `mh'
mr: Yes # reversed
so: Yes # reversed/stood out
se: Yes
us: Yes # underlined, no colour
ue: Yes
clr0:       colour
clr1:       colour
clr2:       colour
clr3:       colour
clr4:       colour
clr5:       colour
clr6:       colour
clr7:       colour




$ 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 <j...@wxcvbn.org>'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.
> >
> >
> > .....

Reply via email to