Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1408 → Rev 1627

/drivers/ddk/string/strncpy.S
1,28 → 1,23
# strncpy() Author: Kees J. Bot
# 1 Jan 1994
# char *strncpy(char *s1, const char *s2, size_t n)
# Copy string s2 to s1.
#
/* strncpy() Author: Kees J. Bot */
/* 1 Jan 1994 */
 
.intel_syntax
/* char *strncpy(char *s1, const char *s2, size_t n) */
/* Copy string s2 to s1. */
/* */
#include "asm.h"
 
.text
ENTRY(strncpy)
push %ebp
movl %esp, %ebp
push %esi
push %edi
movl 16(%ebp), %ecx /* Maximum length */
call _C_LABEL(_strncpy) /* Common code */
movl %edx, %ecx /* Number of bytes not copied */
 
.globl _strncpy
 
.align 16
_strncpy:
push ebp
mov ebp, esp
push esi
push edi
mov ecx, [ebp+16] # Maximum length
call __strncpy # Common code
mov ecx, edx # Number of bytes not copied
rep
stosb # strncpy always copies n bytes by null padding
mov eax, [ebp+8] # Return s1
pop edi
pop esi
pop ebp
rep stosb /* strncpy always copies n bytes by null padding */
movl 8(%ebp), %eax /* Return s1 */
pop %edi
pop %esi
pop %ebp
ret