Andreas Volz <[EMAIL PROTECTED]> words
        on 11.11.2006 - 14:53 (+0100 Zulu-Time):
> Am Sat, 11 Nov 2006 13:56:00 +0100 schrieb J. Erik Heinz:
> > Andreas Volz <[EMAIL PROTECTED]> words
> >     on 11.11.2006 - 11:45 (+0100 Zulu-Time):
> > 

[ leo script ]

> Not bad. But I imagined a EFL app or a module. Does your script work
> with UTF-8 input? I used here "steak" in the past, but it I couldn't
> longer translate umlauts since I changed my system to UTF-8.

I think. We adapted it for a friend of mine to his system. I think it
was UTF-8. I would say... try it out. I attached it. 

Its a bash script. try to run: 'leo -c' it tries to check if all
requirements are fullfilled. 
        * urlencode
        * w3m 

If you are lucky it works. ;) 


Cheers -- Erik 

-- 
J. Erik Heinz
Keyboard-samuraing in process

:: All non-mailinglist mail to this emailadress will be deleted.

OpenBC: https://www.openbc.com/hp/JErik_Heinz
Blog: http://jerik.blogspot.com
#!/bin/bash 
# Created: am: 2005.08.18-16:11:33
# Autor: J. Erik Heinz <[EMAIL PROTECTED]>
#
# Usage: leo [Word]

function fUsage () {
echo -e "USAGE: $(basename $0) [Word]
        Get the translation for an word in  german <-> english.

        -c      Check if requirements are fullfield
        --help  Prints this menu

        Requirements: urlencode and w3m"
}

bCheck=0
while getopts "c-" options; do
    #a ) a=$OPTARG;;
        case $options in
    c ) bCheck=1;;
    * ) fUsage
        exit 1;;
  esac
done

sColorGreen=""
sColorRed=""
sColorClear=""

if test "$1" == ""; then
        fUsage
        exit
fi

sBaseaUrl="http://pda.leo.org/?lp=ende&lang=de&searchLoc=0&cmpType=relaxed&relink=on&sectHdr=on&spellToler=std&search=";
sTmpFile=/tmp/search.$(date +%s).tmp

function check() {
        sError=0
        sThrirdParty="urlencode w3m"
        echo -e "Check if all requirements are fulfilled:\n"
        for sTool in $sThrirdParty; do 
                echo -n " * $sTool in Path: "
        sExists=$(which $sTool)
        if test "$sExists" != ""; then
                echo $sExists
        else
                echo No.

                urlencode="You can get it from: 
http://www.shelldorado.com/scripts/cmds/urlencode.";
                w3m="You have to install w3m for your distribution."
                eval echo \$$sTool      
                echo ""
                ((sError++))
        fi
        done
        if test "$sError" != "0"; then
                echo "$sColorRed There is/are requirements missing.$sColorClear"
        else 
                echo -e "\n$sColorGreen All requirements 
fullfield.$sColorClear"        
        fi
        exit 2
}

function urlEncode() {
        sEncodedString=$(echo $1 | urlencode)
}

function getTranslation() {
        urlEncode $1
        w3m -dump $sBaseaUrl$sEncodedString > $sTmpFile
}

function printOutput() {

#sOldIFS=$IFS
IFS="
"
bFlag=-1
cat $sTmpFile | while read sLine; do
        if echo $sLine | grep "^+-"; then
                ((bFlag*=-1))
        fi

        if test $bFlag == 1; then
                echo $sLine
        fi
done
}

if test $bCheck -eq 1; then
        check
else
        getTranslation $1
        printOutput | less
        rm $sTmpFile
fi


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users

Reply via email to