Leaked source code of windows server 2003
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.

66 lines
1.9 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. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  24. *
  25. *******************************************************************************/
  26. #include <cruntime.h>
  27. #include <string.h>
  28. #if defined(_M_IA64) || defined(_M_AMD64)
  29. #pragma function(_strset)
  30. #endif
  31. /***
  32. *char *_strset(string, val) - sets all of string to val
  33. *
  34. *Purpose:
  35. * Sets all of characters in string (except the terminating '/0'
  36. * character) equal to val.
  37. *
  38. *
  39. *Entry:
  40. * char *string - string to modify
  41. * char val - value to fill string with
  42. *
  43. *Exit:
  44. * returns string -- now filled with val's
  45. *
  46. *Uses:
  47. *
  48. *Exceptions:
  49. *
  50. *******************************************************************************/
  51. char * __cdecl _strset (
  52. char * string,
  53. int val
  54. )
  55. {
  56. char *start = string;
  57. while (*string)
  58. *string++ = (char)val;
  59. return(start);
  60. }