#! /bin/sh # ne3c: clone of nvi script of avm fritzbox!fon; C. Ostheimer 2005; http://www.spblinux.de/fbox/ # usage: ne3c config file, e.g. ne3c /var/flash/debug.cfg if [ ${0%%ne3c} = ${0} ]; then if [ -f ne3c ]; then [ -x ne3c ] || chmod 755 ne3c elif [ -f /var/ne3c ]; then [ -x /var/ne3c] || chmod 755 /var/ne3c fi if ! [ -x ne3c -o -x /var/ne3c ]; then echo -e "use chmod 755 /your_path/n3ec to make ne3c executable\nThen " else echo -n "Now " fi echo "run ./n3ec or /your_path/n3ec" else [ x$1 = x-q ] && e3c_quiet=1 && shift if [ -z "$1" -o ! -e "$1" ] ; then echo "usage: $0 [-q] (quit editor with keys: ctrl+k and then q)" exit 1 fi if which e3c; then E3C=`which e3c`; else E3C=/var/e3c; fi if ! [ -x $E3C ]; then echo "information: e3c not found, trying to download e3c" oldpwd=`pwd` cd /var wget http://www.spblinux.de/fbox/e3c chmod 755 e3c E3C=/var/e3c cd $oldpwd fi if ! [ -x $E3C ]; then echo "error: editor e3c not found" else # uncomment the next line or use ne3c -q config_file if you do not need the reminder if ! [ "$e3c_quiet" ]; then echo "To quit e3c use: ctrl+k and then q" sleep 5 fi # e3c crashes if TERM is not set [ "$TERM" ] || export TERM=xterm cat $1 >/var/ne3c.tmp.$PPID && $E3C /var/ne3c.tmp.$PPID && cat /var/ne3c.tmp.$PPID >$1 rm -f /var/ne3c.tmp.$PPID [ -f /var/ne3c.tmp.${PPID}~ ] && rm /var/ne3c.tmp.${PPID}~ fi fi