Rev 1408 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1627 | serge | 1 | /* strncpy() Author: Kees J. Bot */ |
2 | /* 1 Jan 1994 */ |
||
1408 | serge | 3 | |
1627 | serge | 4 | /* char *strncpy(char *s1, const char *s2, size_t n) */ |
5 | /* Copy string s2 to s1. */ |
||
6 | /* */ |
||
7 | #include "asm.h" |
||
1408 | serge | 8 | |
1627 | serge | 9 | ENTRY(strncpy) |
10 | push %ebp |
||
11 | movl %esp, %ebp |
||
12 | push %esi |
||
13 | push %edi |
||
14 | movl 16(%ebp), %ecx /* Maximum length */ |
||
15 | call _C_LABEL(_strncpy) /* Common code */ |
||
16 | movl %edx, %ecx /* Number of bytes not copied */ |
||
1408 | serge | 17 | |
1627 | serge | 18 | rep stosb /* strncpy always copies n bytes by null padding */ |
19 | movl 8(%ebp), %eax /* Return s1 */ |
||
20 | pop %edi |
||
21 | pop %esi |
||
22 | pop %ebp |
||
1408 | serge | 23 | ret |