getchroot: rewrite using functions and case clause

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
Merge pull request #1 from thliebig/master

getchroot: rewrite using functions and case clause