2000-02-17 19:39:52 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
<<strcpy>>---copy string
|
|
|
|
|
|
|
|
INDEX
|
|
|
|
strcpy
|
|
|
|
|
2017-11-30 02:20:06 -06:00
|
|
|
SYNOPSIS
|
2000-02-17 19:39:52 +00:00
|
|
|
#include <string.h>
|
|
|
|
char *strcpy(char *<[dst]>, const char *<[src]>);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
<<strcpy>> copies the string pointed to by <[src]>
|
|
|
|
(including the terminating null character) to the array
|
|
|
|
pointed to by <[dst]>.
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
This function returns the initial value of <[dst]>.
|
|
|
|
|
|
|
|
PORTABILITY
|
|
|
|
<<strcpy>> is ANSI C.
|
|
|
|
|
|
|
|
<<strcpy>> requires no supporting OS subroutines.
|
|
|
|
|
|
|
|
QUICKREF
|
|
|
|
strcpy ansi pure
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
2025-02-10 13:01:45 +00:00
|
|
|
#include "local.h"
|
2000-02-17 19:39:52 +00:00
|
|
|
|
|
|
|
/*SUPPRESS 560*/
|
|
|
|
/*SUPPRESS 530*/
|
|
|
|
|
|
|
|
char*
|
2017-12-03 21:43:30 -06:00
|
|
|
strcpy (char *dst0,
|
2017-12-03 20:25:16 -06:00
|
|
|
const char *src0)
|
2000-02-17 19:39:52 +00:00
|
|
|
{
|
|
|
|
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
|
|
|
|
char *s = dst0;
|
|
|
|
|
|
|
|
while (*dst0++ = *src0++)
|
|
|
|
;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
#else
|
|
|
|
char *dst = dst0;
|
2017-12-03 20:25:16 -06:00
|
|
|
const char *src = src0;
|
2000-02-17 19:39:52 +00:00
|
|
|
long *aligned_dst;
|
2017-12-03 20:25:16 -06:00
|
|
|
const long *aligned_src;
|
2000-02-17 19:39:52 +00:00
|
|
|
|
|
|
|
/* If SRC or DEST is unaligned, then copy bytes. */
|
2025-02-10 13:01:45 +00:00
|
|
|
if (!UNALIGNED_X_Y(src, dst))
|
2000-02-17 19:39:52 +00:00
|
|
|
{
|
|
|
|
aligned_dst = (long*)dst;
|
|
|
|
aligned_src = (long*)src;
|
|
|
|
|
|
|
|
/* SRC and DEST are both "long int" aligned, try to do "long int"
|
|
|
|
sized copies. */
|
2025-02-10 13:01:45 +00:00
|
|
|
while (!DETECT_NULL(*aligned_src))
|
2000-02-17 19:39:52 +00:00
|
|
|
{
|
|
|
|
*aligned_dst++ = *aligned_src++;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst = (char*)aligned_dst;
|
|
|
|
src = (char*)aligned_src;
|
|
|
|
}
|
|
|
|
|
2007-05-29 21:26:59 +00:00
|
|
|
while ((*dst++ = *src++))
|
2000-02-17 19:39:52 +00:00
|
|
|
;
|
|
|
|
return dst0;
|
|
|
|
#endif /* not PREFER_SIZE_OVER_SPEED */
|
|
|
|
}
|