cgi's: Fix group resolution for cgi programs

This should make cgi's usable out of the box again.

Changes from Ton's patch includes:
 - Make global variables into macros inside #ifdef NSCGI
 - Also macro away test_scheduling and get rid of a ton of #ifdef's

Patched-by: Ton Voon <tonvoon@gmail.com>
Signed-off-by: Andreas Ericsson <ae@op5.se>