source: trunk/minix/lib/i386/string/strncpy.s@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 509 bytes
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.