a bunch of stuff i never committed

Signed-off-by: Riccardo Iaconelli <riccardo@kde.org>
fix some main, move a statRun mechanism into EsBase (not everything is ported yet)

Signed-off-by: Riccardo Iaconelli <riccardo@kde.org>