hbbs

[archived] bbs.hlirc.net
git clone https://hhvn.uk/hbbs
git clone git://hhvn.uk/hbbs
Log | Files | Refs | README | LICENSE

common.sh (593B)


      1 #!/bin/sh
      2 
      3 bin(){
      4 	f=$1
      5 	. $cwd/bin/$f.sh
      6 	shift
      7 	$f $@
      8 }
      9 
     10 die(){
     11 	unlock_all
     12 	error "$@"
     13 	add_log "logout" "$user"
     14 	add_log "disconnection" "${REMOTE_HOST:-localhost}"
     15 	exit 1
     16 }
     17 
     18 error(){
     19 	echo "[$(tput setaf $error_colour)ERROR$(tput sgr0)]: $1"
     20 }
     21 
     22 ok(){
     23 	echo "[$(tput setaf $ok____colour)OK   $(tput sgr0)]: $1"
     24 }
     25 
     26 info(){
     27 	echo "[$(tput setaf $info__colour)INFO $(tput sgr0)]: $1"
     28 }
     29 
     30 prompt(){
     31 	printf "$1: "
     32 	read $2
     33 }
     34 
     35 oldprompt(){
     36 	tput cuu 1
     37 	tput el
     38 	printf "%s %s\n" "$old_prompt_style" "$1"
     39 }
     40 
     41 anykey(){
     42 	tput sc
     43 	printf "Press enter to continue..."
     44 	read null
     45 	tput rc; tput el
     46 }