mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 11:04:52 +00:00

Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
/***
|
|
*strnset.c - set first n characters to single character
|
|
*
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
*Purpose:
|
|
* defines _strnset() - sets at most the first n characters of a string
|
|
* to a given character.
|
|
*
|
|
*******************************************************************************/
|
|
|
|
#include <string.h>
|
|
|
|
/***
|
|
*char *_strnset(string, val, count) - set at most count characters to val
|
|
*
|
|
*Purpose:
|
|
* Sets the first count characters of string the character value.
|
|
* If the length of string is less than count, the length of
|
|
* string is used in place of n.
|
|
*
|
|
*Entry:
|
|
* char *string - string to set characters in
|
|
* char val - character to fill with
|
|
* unsigned count - count of characters to fill
|
|
*
|
|
*Exit:
|
|
* returns string, now filled with count copies of val.
|
|
*
|
|
*Exceptions:
|
|
*
|
|
*******************************************************************************/
|
|
|
|
char * __cdecl _strnset (
|
|
char * string,
|
|
int val,
|
|
size_t count
|
|
)
|
|
{
|
|
char *start = string;
|
|
|
|
while (count-- && *string)
|
|
*string++ = (char)val;
|
|
|
|
return(start);
|
|
}
|