fixed parsing

fixed parsing and moved to its own function, replaced all instances of bcopy() and bzero() with memcpy() and memset.  bcopy() and bzero() are deprecated as of POSIX1-2001.