Login Main site Create account

24.07.2006 22:59

1337 programming by Matrox (Part 1)


Currently I'm rewriting the whole install script for the Parhelia drivers and while looking at the sourcecode, I found a very nice code snippet by some 1337 hacker @Matrox, here we go:

# parse data
DATA=`ldd confapp.bin`
LENGTH=${#DATA}
let LENGTH-=14
for ((LOOP=1; LOOP <= LENGTH; LOOP++))
do
    VALUE=${DATA:LOOP:14}
    if [ "$VALUE" == "libstdc++.so.6" ]; then
        STDCPPVERSION="6"
    fi
done

What is this code supposed to do?
Let me help you: It evaluates the `ldd` output of a previously compiled binary to see wheter the system links to libstdc++.so.6 or any previous version by starting at the first byte and looking for the 14 bytes long string "libstdc++.so.6" from this position on until the end of data (-14, of course, the length of the string "libstdc++.so.6".

How can I help making life easier? Well, let's try this one:

if ldd $CONFAPP_BIN | grep -q libstdc++\.so\.6; then
  STDCPPVERSION="6"
fi

To be continued...
Comments added earlier to http://tuxx-home.at/archives/2006/07/24/T22_59_28/index.html:
mOjO on 2006-07-31 00:29:13 wrote:
how much longer on the rewrite? 8-)

Your comment (HTML tags will be stripped !!):

To verify You are not a bot, type down text from this image.

Your try: