head 1.2; access; symbols SHTOOL_1_0_0:1.1.1.1 RSE:1.1.1; locks; strict; comment @# @; 1.2 date 99.04.29.11.21.05; author rse; state dead; branches; next 1.1; 1.1 date 99.04.29.11.19.34; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.04.29.11.19.34; author rse; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @#!/bin/sh ## ## becho -- echo command using terminal bold mode ## Copyright (c) 1999 Ralf S. Engelschall, All Rights Reserved. ## Usage: becho [-n] [-b] [-e] [...] ## begin=no end=no nl="\n" text='' while [ ".$1" != . ]; do case $1 in -b) begin=yes; shift; continue ;; -e) end=yes; shift; continue ;; -n) nl=""; shift; continue ;; *) break; esac done text="$*" # start with nothing T_MD='' T_ME='' # some hard-coded terminal sequences case $TERM in xterm|xterm*|vt220|vt220*) T_MD=`echo dummy | awk '{ printf("%c%c%c%c", 27, 91, 49, 109); }'` T_ME=`echo dummy | awk '{ printf("%c%c%c", 27, 91, 109); }'` ;; vt100|vt100*) T_MD=`echo dummy | awk '{ printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }'` T_ME=`echo dummy | awk '{ printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }'` ;; esac # additionally try a vendor's tput program if [ ".$T_MD" = . -o ".$T_ME" = . ]; then MD="`tput md 2>/dev/null`" ME="`tput me 2>/dev/null`" if [ ".$MD" != . -a ".$ME" != . ]; then T_MD="$MD" T_ME="$ME" fi fi # result if [ ".$T_MD" = . -o ".$T_ME" = . ]; then echo "bold:Error: unable to determine terminal sequence for bold mode" 1>&2 exit 1 else if [ ".$begin" = .yes ]; then echo dummy |\ awk '{ printf("%s", T_MD); }' \ T_MD="$T_MD" fi if [ ".$end" = .yes ]; then echo dummy |\ awk '{ printf("%s", T_ME); }' \ T_ME="$T_ME" fi if [ ".$text" != . ]; then echo dummy |\ awk '{ printf("%s%s%s%s", T_MD, TEXT, T_ME, NL); }' \ T_MD="$T_MD" TEXT="$text" T_ME="$T_ME" NL="$nl" fi fi @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Import of shtool 1.0.0 @ text @@