Line | |
---|
1 | ! strncpy() Author: Kees J. Bot
|
---|
2 | ! 1 Jan 1994
|
---|
3 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
4 |
|
---|
5 | ! char *strncpy(char *s1, const char *s2, size_t n)
|
---|
6 | ! Copy string s2 to s1.
|
---|
7 | !
|
---|
8 | .sect .text
|
---|
9 | .define _strncpy
|
---|
10 | .align 16
|
---|
11 | _strncpy:
|
---|
12 | push ebp
|
---|
13 | mov ebp, esp
|
---|
14 | push esi
|
---|
15 | push edi
|
---|
16 | mov ecx, 16(ebp) ! Maximum length
|
---|
17 | call __strncpy ! Common code
|
---|
18 | mov ecx, edx ! Number of bytes not copied
|
---|
19 | rep
|
---|
20 | stosb ! strncpy always copies n bytes by null padding
|
---|
21 | mov eax, 8(ebp) ! Return s1
|
---|
22 | pop edi
|
---|
23 | pop esi
|
---|
24 | pop ebp
|
---|
25 | ret
|
---|
Note:
See
TracBrowser
for help on using the repository browser.