Rev | Line | |
---|
[9] | 1 | ! strncpy() Author: Kees J. Bot
|
---|
| 2 | ! 27 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 | _strncpy:
|
---|
| 11 | push bp
|
---|
| 12 | mov bp, sp
|
---|
| 13 | push si
|
---|
| 14 | push di
|
---|
| 15 | mov cx, 8(bp) ! Maximum length
|
---|
| 16 | call __strncpy ! Common code
|
---|
| 17 | mov cx, dx ! Number of bytes not copied
|
---|
| 18 | rep stosb ! strncpy always copies n bytes by null padding
|
---|
| 19 | mov ax, 4(bp) ! Return s1
|
---|
| 20 | pop di
|
---|
| 21 | pop si
|
---|
| 22 | pop bp
|
---|
| 23 | ret
|
---|
Note:
See
TracBrowser
for help on using the repository browser.