source: trunk/minix/lib/i86/string/_strncpy.s@ 20

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

Minix 3.1.2a

File size: 537 bytes
Line 
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 cx)
6! Copy string s2 to s1.
7!
8.sect .text
9.define __strncpy
10__strncpy:
11 mov di, 6(bp) ! di = string s2
12 xorb al, al ! Look for a zero byte
13 mov dx, cx ! Save maximum count
14 cld
15 repne scasb ! Look for end of s2
16 sub dx, cx ! Number of bytes in s2 including null
17 xchg cx, dx
18 mov si, 6(bp) ! si = string s2
19 mov di, 4(bp) ! di = string s1
20 rep movsb ! Copy bytes
21 ret
Note: See TracBrowser for help on using the repository browser.