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: 561 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 ecx)
6! Copy string s2 to s1.
7!
8.sect .text
9.define __strncpy
10 .align 16
11__strncpy:
12 mov edi, 12(ebp) ! edi = string s2
13 xorb al, al ! Look for a zero byte
14 mov edx, ecx ! Save maximum count
15 cld
16 repne
17 scasb ! Look for end of s2
18 sub edx, ecx ! Number of bytes in s2 including null
19 xchg ecx, edx
20 mov esi, 12(ebp) ! esi = string s2
21 mov edi, 8(ebp) ! edi = string s1
22 rep
23 movsb ! Copy bytes
24 ret
Note: See TracBrowser for help on using the repository browser.