Revive tclapi.c from r1650: