home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 January / Chip_2001-01_cd1.bin / tema / mysql / mysql-3.23.28g-win-source.exe / strings / strmov.c < prev    next >
C/C++ Source or Header  |  2000-08-31  |  2KB  |  60 lines

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.    
  3.    This library is free software; you can redistribute it and/or
  4.    modify it under the terms of the GNU Library General Public
  5.    License as published by the Free Software Foundation; either
  6.    version 2 of the License, or (at your option) any later version.
  7.    
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU Library General Public
  14.    License along with this library; if not, write to the Free
  15.    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  16.    MA 02111-1307, USA */
  17.  
  18. /*
  19.   strmov(dst, src) moves all the  characters  of  src  (including  the
  20.   closing NUL) to dst, and returns a pointer to the new closing NUL in
  21.   dst.     The similar UNIX routine strcpy returns the old value of dst,
  22.   which I have never found useful.  strmov(strmov(dst,a),b) moves a//b
  23.   into dst, which seems useful.
  24. */
  25.  
  26. #include <global.h>
  27. #include "m_string.h"
  28.  
  29. #ifdef BAD_STRING_COMPILER
  30. #undef strmov
  31. #define strmov strmov_overlapp
  32. #endif
  33.  
  34. #ifndef strmov
  35.  
  36. #if !defined(MC68000) && !defined(DS90)
  37.  
  38. char *strmov(register char *dst, register const char *src)
  39. {
  40.   while ((*dst++ = *src++)) ;
  41.   return dst-1;
  42. }
  43.  
  44. #else
  45.  
  46. char *strmov(dst, src)
  47.      char *dst, *src;
  48. {
  49.   asm("        movl    4(a7),a1    ");
  50.   asm("        movl    8(a7),a0    ");
  51.   asm(".L4:    movb    (a0)+,(a1)+    ");
  52.   asm("        jne    .L4        ");
  53.   asm("        movl    a1,d0        ");
  54.   asm("        subql    #1,d0        ");
  55. }
  56.  
  57. #endif
  58.  
  59. #endif /* strmov */
  60.