ReactOS  0.4.13-dev-544-gede3fdd
Strncat.c
Go to the documentation of this file.
1 #include <sys/types.h>
2 #include <string.h>
3 #include "Strn.h"
4 
5 /*
6  * Concatenate src on the end of dst. The resulting string will have at most
7  * n-1 characters, not counting the NUL terminator which is always appended
8  * unlike strncat. The other big difference is that strncpy uses n as the
9  * max number of characters _appended_, while this routine uses n to limit
10  * the overall length of dst.
11  */
12 char *
13 Strncat(char *const dst, const char *const src, const size_t n)
14 {
15  register size_t i;
16  register char *d;
17  register const char *s;
18 
19  if (n != 0 && ((i = strlen(dst)) < (n - 1))) {
20  d = dst + i;
21  s = src;
22  /* If they specified a maximum of n characters, use n - 1 chars to
23  * hold the copy, and the last character in the array as a NUL.
24  * This is the difference between the regular strncpy routine.
25  * strncpy doesn't guarantee that your new string will have a
26  * NUL terminator, but this routine does.
27  */
28  for (++i; i<n; i++) {
29  if ((*d++ = *s++) == 0) {
30 #if (STRN_ZERO_PAD == 1)
31  /* Pad with zeros. */
32  for (; i<n; i++)
33  *d++ = 0;
34 #endif /* STRN_ZERO_PAD */
35  return dst;
36  }
37  }
38  /* If we get here, then we have a full string, with n - 1 characters,
39  * so now we NUL terminate it and go home.
40  */
41  *d = 0;
42  }
43  return (dst);
44 } /* Strncat */
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char * Strncat(char *const dst, const char *const src, const size_t n)
Definition: Strncat.c:13
#define d
Definition: ke_i.h:81
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340