2002-03-06 22:37:01 +00:00
|
|
|
|
#!/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
|
2007-03-03 16:10:20 +00:00
|
|
|
|
if [ -f /usr/share/terminfo/a/ansi.sys ]; then
|
|
|
|
|
export JOETERM=ansi.sys
|
|
|
|
|
else
|
|
|
|
|
export JOETERM=nansi.sys
|
|
|
|
|
fi
|
2002-03-06 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
## Read variables from data.msg
|
2006-10-08 12:18:04 +00:00
|
|
|
|
. $HOME/data.msg
|
2002-03-06 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
## Read time left from door.sys
|
2006-10-08 12:33:53 +00:00
|
|
|
|
TIME=`head -n19 $HOME/door.sys |tail -n1 |tr -d "[:cntrl:]"`
|
2002-03-06 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
## Set preferred editor and parameters
|
2002-07-27 20:15:07 +00:00
|
|
|
|
EDITOR=@joebin@/bbsjoe
|
2007-03-03 16:10:20 +00:00
|
|
|
|
PARAM="$HOME/edit.msg"
|
2002-03-06 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
2004-08-18 15:22:11 +00:00
|
|
|
|
if [ "BBSFSEDKEYS" = "1" ]; then EDITOR=@joebin@/bbsjmacs; fi
|
2002-03-06 22:37:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Setting Language environmment for msg header
|
|
|
|
|
case $BBSLANGUAGE in
|
|
|
|
|
## Spanish
|
|
|
|
|
S)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='AREA '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
LANGFROM='De '
|
|
|
|
|
LANGTO='Para '
|
|
|
|
|
LANGRE='Asunto '
|
|
|
|
|
;;
|
|
|
|
|
## Galician
|
|
|
|
|
G)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='AREA '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
LANGFROM='De '
|
|
|
|
|
LANGTO='Para '
|
|
|
|
|
LANGRE='Asunto '
|
|
|
|
|
;;
|
|
|
|
|
## Italian
|
|
|
|
|
I)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='AREA '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
LANGFROM='Da '
|
|
|
|
|
LANGTO='A '
|
|
|
|
|
LANGRE='Oggetto '
|
|
|
|
|
;;
|
|
|
|
|
## German
|
|
|
|
|
D)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='BEREICH '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
LANGFROM='Von '
|
|
|
|
|
LANGTO='An '
|
|
|
|
|
LANGRE='Betreff '
|
|
|
|
|
;;
|
|
|
|
|
## Dutch
|
|
|
|
|
N)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='GEBIED '
|
|
|
|
|
LANGFROM='Van '
|
|
|
|
|
LANGTO='Aan '
|
|
|
|
|
LANGRE='Betrefd '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
## Languages not set defaults to english.
|
2002-03-12 22:09:05 +00:00
|
|
|
|
*)
|
2004-11-05 13:08:33 +00:00
|
|
|
|
LANGAREA='AREA '
|
2004-08-18 15:22:11 +00:00
|
|
|
|
LANGFROM='From '
|
|
|
|
|
LANGTO='To '
|
|
|
|
|
LANGRE='Subject '
|
2002-03-06 22:37:01 +00:00
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
## Set Alarm to kill editor when no time left
|
|
|
|
|
alarma $TIME $EDITOR &
|
|
|
|
|
|
|
|
|
|
## Draw header and call editor
|
2004-11-05 13:08:33 +00:00
|
|
|
|
echo -e "[2J[1;1H[0m[1;44m "
|
2007-03-03 16:10:21 +00:00
|
|
|
|
echo -e "[1;1H[0m[1;44m$LANGAREA: [31m$AREANUM[37m [33m$AREA $UTF8 $TERM $JOETERM"
|
2004-11-05 13:08:33 +00:00
|
|
|
|
echo -e "[2;1H[0m[1;33m$LANGFROM: [32m$MSGFROM [36m$MSGFROMADDR"
|
|
|
|
|
echo -e "[3;1H[0m[1;33m$LANGTO: [0;32m$MSGTO [36m$MSGTOADDR"
|
|
|
|
|
echo -e "[4;1H[0m[1;33m$LANGRE: [0;32m$MSGSUBJECT"
|
|
|
|
|
echo -e "[5;1H[0m"
|
2002-03-06 22:37:01 +00:00
|
|
|
|
$EDITOR $PARAM
|
|
|
|
|
## kill alarm
|
|
|
|
|
killall sleep >/dev/null 2>&1
|
|
|
|
|
clear
|