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...
Posted by Alexander Griesser
| Categories:
Matrox Parhelia Drivers
| Comments:
--> New comment