Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #      strncpy()                                       Author: Kees J. Bot
  2. #                                                              1 Jan 1994
  3. # char *strncpy(char *s1, const char *s2, size_t n)
  4. #       Copy string s2 to s1.
  5. #
  6.  
  7. .intel_syntax
  8.  
  9. .text
  10.  
  11. .globl _strncpy
  12.  
  13. .align  16
  14. _strncpy:
  15.         push    ebp
  16.         mov     ebp, esp
  17.         push    esi
  18.         push    edi
  19.         mov     ecx, [ebp+16]   # Maximum length
  20.         call    __strncpy       # Common code
  21.         mov     ecx, edx        # Number of bytes not copied
  22.         rep
  23.         stosb                   # strncpy always copies n bytes by null padding
  24.         mov     eax, [ebp+8]     # Return s1
  25.         pop     edi
  26.         pop     esi
  27.         pop     ebp
  28.         ret
  29.