Subversion Repositories Kolibri OS

Rev

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

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3.  
  4. char * strncpy(char *dst, const char *src, size_t n)
  5. {
  6. int d0, d1, d2, d3;
  7. __asm__ __volatile__(
  8.         "1:\tdecl %2\n\t"
  9.         "js 2f\n\t"
  10.         "lodsb\n\t"
  11.         "stosb\n\t"
  12.         "testb %%al,%%al\n\t"
  13.         "jne 1b\n\t"
  14.         "rep\n\t"
  15.         "stosb\n"
  16.         "2:"
  17.         : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3)
  18.         :"0" (src),"1" (dst),"2" (n) : "memory");
  19. return dst;
  20. }
  21.