#!/bin/bash # # $Id$ # # Script to start joe editor as external editor for MBSE BBS # Written by Redy Rodriguez. ### Function to kill the editor when no time left function alarma { sleep $1m killall $2 >/dev/null 2>&1 } ## Set term environmment export JOETERM=ansi.sys ## Read variables from data.msg . ~/data.msg ## Read time left from door.sys TIME=`head -n19 ~/door.sys |tail -n1 |tr -d "[:cntrl:]"` ## Set preferred editor and parameters EDITOR=/usr/bin/bbsjoe PARAM="~/edit.msg" # Using joe with emacs keys: # You can make a bbsjmacsrc file with emacs keys and put it # in /usr/lib/joe, and then a symlink to joe called bbsjmacs # in /usr/bin (dirs can change in other distros), and then # uncomment next line. If user select Emacs keys then this # editor was selected. if [ "BBSFSEDKEYS" = "1" ]; then EDITOR=/usr/bin/bbsjmacs; fi ## Setting Language environmment for msg header case $BBSLANGUAGE in ## Spanish S) LANGAREA='AREA' LANGFROM='De ' LANGTO='Para ' LANGRE='Asunto ' ;; ## Galician G) LANGAREA='AREA' LANGFROM='De ' LANGTO='Para ' LANGRE='Asunto ' ;; ## Italian I) LANGAREA='AREA' LANGFROM='Da ' LANGTO='A ' LANGRE='Oggetto ' ;; ## German D) LANGAREA='BEREICH' LANGFROM='Von ' LANGTO='An ' LANGRE='Betreff ' ;; ## Dutch N) LANGAREA='Gebied' LANGFROM='Van ' LANGTO='Aan ' LANGRE='Onderwerp' ;; ## Languages not set defaults to english. *) LANGAREA='AREA' LANGFROM='FROM ' LANGTO='TO ' LANGRE='SUBJECT ' ;; esac ## Set Alarm to kill editor when no time left alarma $TIME $EDITOR & ## Draw header and call editor clear echo "[2J[1;1H[0m[1;44m [1;1H[0m[1;44m$LANGAREA: [31m$AREANUM[37m [33m$AREA [0;37;40m[A[79C [1;33m$LANGFROM: [32m$MSGFROM[0;37m [A[79C [1;33m$LANGTO: [0;32m$MSGTO [36m$MSGTOADDR[37m [A[79C [1;33m$LANGRE: [0;32m$MSGSUBJECT[37m [A[79C [0m" $EDITOR $PARAM ## kill alarm killall sleep >/dev/null 2>&1 clear