|
|
1.1 root 1: /* $Header: /usr/src/lib/libcurses/RCS/bcopy.c,v 1.1 89/04/07 13:20:34 src Exp $
2: *
3: * The information contained herein is a trade secret of INETCO
4: * Systems, and is confidential information. It is provided under
5: * a license agreement, and may be copied or disclosed only under
6: * the terms of that agreement. Any reproduction or disclosure of
7: * this material without the express written authorization of
8: * INETCO Systems or persuant to the license agreement is unlawful.
9: *
10: * Copyright (c) 1989
11: * An unpublished work by INETCO Systems, Ltd.
12: * All rights reserved.
13: */
14:
15: /**
16: *
17: * void
18: * bcopy( src, dst, len ) -- byte copy routine (Berkeley)
19: * char * src, *dst;
20: * int len;
21: *
22: * Input: src = source location.
23: * dst = destination location.
24: * len = number of bytes to be transferred.
25: *
26: * Action: Copy 'len' bytes from location 'src' to location 'dst'.
27: *
28: * Return: None.
29: *
30: * Notes: The 'bcopy' routine takes parameters backwards from
31: * the 'strcpy' and 'memcpy' routines.
32: */
33:
34: void
35: bcopy( src, dst, len )
36: register char * src, *dst;
37: int len;
38: {
39: /*
40: * Copy right to left in case insertion is taking place.
41: */
42: if ( dst > src ) {
43:
44: /*
45: * Advance just past the end of source/destination buffers.
46: */
47: dst += len;
48: src += len;
49:
50: /*
51: * Copy right to left.
52: */
53: while ( --len >= 0 )
54: *--dst = *--src;
55: }
56:
57: /*
58: * Copy left to right.
59: */
60: else {
61: for ( ; --len >= 0; src++, dst++ )
62: *dst = *src;
63: }
64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.