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.

65 lines
1.7 KiB

  1. /***
  2. *strset.c - sets all characters of string to given character
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines _strset() - sets all of the characters in a string (except
  8. * the '\0') equal to a given character.
  9. *
  10. *Revision History:
  11. * 02-27-90 GJF Fixed calling type, #include <cruntime.h>, fixed
  12. * copyright.
  13. * 08-14-90 SBM Compiles cleanly with -W3
  14. * 10-02-90 GJF New-style function declarator.
  15. * 01-18-91 GJF ANSI naming.
  16. * 09-03-93 GJF Replaced _CALLTYPE1 with __cdecl.
  17. * 12-03-93 GJF _strset is an intrinsic in Alpha compiler!
  18. * 03-01-94 GJF Evidently on MIPS too (change taken from crt32, made
  19. * there by Jeff Havens).
  20. * 10-02-94 BWT Add PPC support.
  21. * 10-07-97 RDL Added IA64.
  22. * 05-17-99 PML Remove all Macintosh support.
  23. *
  24. *******************************************************************************/
  25. #include <cruntime.h>
  26. #include <string.h>
  27. #if defined(_M_IA64) || defined(_M_AMD64)
  28. #pragma function(_strset)
  29. #endif
  30. /***
  31. *char *_strset(string, val) - sets all of string to val
  32. *
  33. *Purpose:
  34. * Sets all of characters in string (except the terminating '/0'
  35. * character) equal to val.
  36. *
  37. *
  38. *Entry:
  39. * char *string - string to modify
  40. * char val - value to fill string with
  41. *
  42. *Exit:
  43. * returns string -- now filled with val's
  44. *
  45. *Uses:
  46. *
  47. *Exceptions:
  48. *
  49. *******************************************************************************/
  50. char * __cdecl _strset (
  51. char * string,
  52. int val
  53. )
  54. {
  55. char *start = string;
  56. while (*string)
  57. *string++ = (char)val;
  58. return(start);
  59. }