Memcpy definition wanted

Andy Behrens andyb at coat.uucp
Fri Feb 3 09:44:43 AEST 1989


In article <801 at psc90.UUCP> netnews at psc90.UUCP writes:
>  I am looking for the definition for memcpy. For example, strchr in
>  BSD is rindex, and strrchr is rrindex. What is the term that BSD uses?

This table shows the correspondences between the SYS V and the Berkeley
byte-string operations.  Note the parameters to bcopy: they're
backwards from what you'd expect!

		SYS V				BSD
	---------------------------	-------------------------
	memcpy(dst,src,length)		bcopy(src,dst,length)

	memset(dst,0,length)		bzero(dst,length)		

	memcmp(str1,str2,length)==0	bcmp(str1,str2,length)==0	

There are a few small differences between the two sets of functions.

- The BSD routines want "length" to be an unsigned int.  
- Memcpy and memset return a pointer to dst, while bcopy and bzero do
	not return a value.  
- Memcmp can be used for "greater than" and "less than" comparisons, 
	while bcmp only tells you if two strings are identical, without 
	telling which is greater.  
- Memset can be used to set bytes to a value other than zero.

See the memory(3C) or bstring(3) man pages for all the details.

--
Live justly, love gently, walk humbly.
					Andy Behrens
					andyb at coat.uucp

internet: andyb%coat at dartmouth.edu
uucp:     {harvard,decvax}!dartvax!coat!andyb
Burlington Coat, PO Box 729, Lebanon, N.H. 03766	(603) 448-5000



More information about the Comp.unix.questions mailing list