Subversion Repositories Kolibri OS

Rev

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

  1. /* strxfrm( char *, const char *, size_t )
  2.  
  3.    This file is part of the Public Domain C Library (PDCLib).
  4.    Permission is granted to use, modify, and / or redistribute at will.
  5. */
  6.  
  7. #include <string.h>
  8.  
  9. size_t strxfrm( char * s1, const char * s2, size_t n )
  10. {
  11.     size_t len = strlen( s2 );
  12.  
  13.     if ( len < n )
  14.     {
  15.         /* Cannot use strncpy() here as the filling of s1 with '\0' is not part
  16.            of the spec.
  17.         */
  18.         /* FIXME: This should access _PDCLIB_lc_collate. */
  19.         while ( n-- && ( *s1++ = ( unsigned char )*s2++ ) )
  20.         {
  21.             /* EMPTY */
  22.         }
  23.     }
  24.  
  25.     return len;
  26. }