Portability

ASCII ESC character changed to \033 to allow compiling on compilers without GCC extensions (I was compiling using the SunStudio cc compiler).
limits.h included to fix broken compile on Solaris, I think other platforms have this included indirectly through the other includes.
char* cast added to avoid compiler warning.