3 <<strcpy>>---copy string
10 char *strcpy(char *<[dst]>, const char *<[src]>);
13 <<strcpy>> copies the string pointed to by <[src]>
14 (including the terminating null character) to the array
15 pointed to by <[dst]>.
18 This function returns the initial value of <[dst]>.
23 <<strcpy>> requires no supporting OS subroutines.
35 /* Nonzero if either X or Y is not aligned on a "long" boundary. */
36 #define UNALIGNED(X, Y) \
37 (((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
39 #if LONG_MAX == 2147483647L
40 #define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
42 #if LONG_MAX == 9223372036854775807L
43 /* Nonzero if X (a long int) contains a NULL byte. */
44 #define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080)
46 #error long int is not a 32bit or 64bit type.
51 #error long int is not a 32bit or 64bit byte
58 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
61 while (*dst0
++ = *src0
++)
67 const char *src
= src0
;
69 const long *aligned_src
;
71 /* If SRC or DEST is unaligned, then copy bytes. */
72 if (!UNALIGNED (src
, dst
))
74 aligned_dst
= (long*)dst
;
75 aligned_src
= (long*)src
;
77 /* SRC and DEST are both "long int" aligned, try to do "long int"
79 while (!DETECTNULL(*aligned_src
))
81 *aligned_dst
++ = *aligned_src
++;
84 dst
= (char*)aligned_dst
;
85 src
= (char*)aligned_src
;
88 while ((*dst
++ = *src
++))
91 #endif /* not PREFER_SIZE_OVER_SPEED */