Subversion Repositories Kolibri OS

Rev

Rev 1408 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*      strncpy()                                       Author: Kees J. Bot */
  2. /*                                                              1 Jan 1994 */
  3.  
  4. /* char *strncpy(char *s1, const char *s2, size_t n) */
  5. /*      Copy string s2 to s1. */
  6. /* */
  7. #include "asm.h"
  8.  
  9. ENTRY(strncpy)
  10.         push    %ebp
  11.         movl    %esp, %ebp
  12.         push    %esi
  13.         push    %edi
  14.         movl    16(%ebp), %ecx  /* Maximum length */
  15.         call    _C_LABEL(_strncpy) /* Common code */
  16.         movl    %edx, %ecx      /* Number of bytes not copied */
  17.  
  18.         rep stosb       /* strncpy always copies n bytes by null padding */
  19.         movl    8(%ebp), %eax   /* Return s1 */
  20.         pop     %edi
  21.         pop     %esi
  22.         pop     %ebp
  23.         ret
  24.