I meant to mention that to compile the above nsreturnz under 40r10 you need to modify the Makefile to read:
CFLAGS = -I$(NSHOME)/nsd
instead of:
CFLAGS =
and add the line:
AOLSERVER=$(NSHOME)
after NSHOME is set.
and then build with:
make install INST=/usr/local/aolserver40r10
substituting your relevant install directory