Unification of branches, updated llibmagic, etc.

Hi!

I have unified all the interesting branches I could find, updated llibmagic to 5.11 and applied a few fixes of my own.

Tell me what you think!
Jan