Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.2 KiB

  1. /***
  2. *strcat.c - contains strcat() and strcpy()
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Strcpy() copies one string onto another.
  8. *
  9. * Strcat() concatenates (appends) a copy of the source string to the
  10. * end of the destination string, returning the destination string.
  11. *
  12. *Revision History:
  13. * 05-31-89 JCR C version created.
  14. * 02-27-90 GJF Fixed calling type, #include <cruntime.h>, fixed
  15. * copyright.
  16. * 10-01-90 GJF New-style function declarator.
  17. * 04-01-91 SRW Add #pragma function for i386 _WIN32_ and _CRUISER_
  18. * builds
  19. * 04-05-91 GJF Speed up strcat() a bit (got rid of call to strcpy()).
  20. * 09-01-93 GJF Replaced _CALLTYPE1 with __cdecl.
  21. * 12-03-93 GJF Turn on #pragma function for all MS front-ends (esp.,
  22. * Alpha compiler).
  23. * 12-30-94 JCF Turn off #pragma function for MAC.
  24. * 02-30-95 JCF Add _MBSCAT check.
  25. *
  26. *******************************************************************************/
  27. #include <cruntime.h>
  28. #include <string.h>
  29. #ifndef _MBSCAT
  30. #ifdef _MSC_VER
  31. #pragma function(strcat,strcpy)
  32. #endif
  33. #endif
  34. /***
  35. *char *strcat(dst, src) - concatenate (append) one string to another
  36. *
  37. *Purpose:
  38. * Concatenates src onto the end of dest. Assumes enough
  39. * space in dest.
  40. *
  41. *Entry:
  42. * char *dst - string to which "src" is to be appended
  43. * const char *src - string to be appended to the end of "dst"
  44. *
  45. *Exit:
  46. * The address of "dst"
  47. *
  48. *Exceptions:
  49. *
  50. *******************************************************************************/
  51. char * __cdecl strcat (
  52. char * dst,
  53. const char * src
  54. )
  55. {
  56. char * cp = dst;
  57. while( *cp )
  58. cp++; /* find end of dst */
  59. while( *cp++ = *src++ ) ; /* Copy src to end of dst */
  60. return( dst ); /* return dst */
  61. }
  62. /***
  63. *char *strcpy(dst, src) - copy one string over another
  64. *
  65. *Purpose:
  66. * Copies the string src into the spot specified by
  67. * dest; assumes enough room.
  68. *
  69. *Entry:
  70. * char * dst - string over which "src" is to be copied
  71. * const char * src - string to be copied over "dst"
  72. *
  73. *Exit:
  74. * The address of "dst"
  75. *
  76. *Exceptions:
  77. *******************************************************************************/
  78. char * __cdecl strcpy(char * dst, const char * src)
  79. {
  80. char * cp = dst;
  81. while( *cp++ = *src++ )
  82. ; /* Copy src over dst */
  83. return( dst );
  84. }