source: trunk/minix/lib/i86/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: 487 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 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.