FreeBSD and OpenBSD are forks of NetBSD. NetBSD re-wrote SRV2 sh under a BSD license in 1993.

Here's the `main.c`: http://cvsweb.netbsd.org/bsdweb.cgi/src/bin/sh/main.c?rev=1.1&content-type=text/x-cvsweb-markup