2010-03-03 15:27:30 +01:00
|
|
|
/* strncpy() Author: Kees J. Bot */
|
|
|
|
/* 1 Jan 1994 */
|
|
|
|
|
|
|
|
/* char *strncpy(char *s1, const char *s2, size_t n) */
|
|
|
|
/* Copy string s2 to s1. */
|
|
|
|
/* */
|
2010-08-17 18:44:07 +02:00
|
|
|
#include <machine/asm.h>
|
|
|
|
|
|
|
|
ENTRY(strncpy)
|
2010-03-03 15:27:30 +01:00
|
|
|
push %ebp
|
|
|
|
movl %esp, %ebp
|
|
|
|
push %esi
|
|
|
|
push %edi
|
|
|
|
movl 16(%ebp), %ecx /* Maximum length */
|
2010-08-17 18:44:07 +02:00
|
|
|
call _C_LABEL(_strncpy) /* Common code */
|
2010-03-03 15:27:30 +01:00
|
|
|
movl %edx, %ecx /* Number of bytes not copied */
|
|
|
|
|
|
|
|
rep stosb /* strncpy always copies n bytes by null padding */
|
|
|
|
movl 8(%ebp), %eax /* Return s1 */
|
|
|
|
pop %edi
|
|
|
|
pop %esi
|
|
|
|
pop %ebp
|
|
|
|
ret
|