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