Merge up from branch.
[shibboleth/cpp-sp.git] / oncrpc / bcopy.c
1 /*********************************************************************
2  * RPC for the Windows NT Operating System
3  * 1993 by Martin F. Gergeleit
4  * Users may use, copy or modify Sun RPC for the Windows NT Operating 
5  * System according to the Sun copyright below.
6  *
7  * RPC for the Windows NT Operating System COMES WITH ABSOLUTELY NO 
8  * WARRANTY, NOR WILL I BE LIABLE FOR ANY DAMAGES INCURRED FROM THE 
9  * USE OF. USE ENTIRELY AT YOUR OWN RISK!!!
10  *********************************************************************/
11
12 /*
13  *  bcopy.c --
14  *      Implements bcopy(2) and bzero(2) byte operations.
15  *
16  *  Author:
17  *      See-Mong Tan, 6/26/88
18  */
19
20 #include <stdio.h>
21
22 /*
23  *  bcopy(char *s1, char *s2, int len) --
24  *      Copies len bytes from s1 to s2
25  */
26 void
27 bcopy(s1, s2, len)
28         char *s1, *s2;
29         int len;
30 {
31         for(; len > 0; len--)
32                 *s2++ = *s1++;
33 }
34
35 /*
36  *  bzero(char *s, int len) --
37  *      Places len zero byes in s
38  */
39 void
40 bzero(s, len)
41         char *s;
42         int len;
43 {
44         for(; len > 0; len--)
45                 *s++ = (char) 0;
46 }
47
48 /*
49  *  bcmp() compares byte  string  b1  against  byte  string  b2, 
50  *  returning  zero  if  they are identical, non-zero otherwise. 
51  *  Both strings are assumed to be length bytes long.  bcmp() of 
52  *  length zero bytes always returns zero.                       
53 */
54 int
55 bcmp(s1, s2, len)
56         char *s1, *s2;
57         int len;
58 {
59         for(; len > 0; len--, s1++, s2++)
60                 if (*s1 != *s2)
61                         return 1;
62         return 0;
63 }
64