ReactOS  0.4.15-dev-492-ga1108f6
Strnpcat.c File Reference
#include <sys/types.h>
#include <string.h>
#include "Strn.h"
Include dependency graph for Strnpcat.c:

Go to the source code of this file.

Functions

charStrnpcat (char *const dst, const char *const src, size_t n)
 

Function Documentation

◆ Strnpcat()

char* Strnpcat ( char *const  dst,
const char *const  src,
size_t  n 
)

Definition at line 16 of file Strnpcat.c.

17 {
18  register size_t i;
19  register char *d;
20  register const char *s;
21  register char c;
22  char *ret;
23 
24  if (n != 0 && ((i = strlen(dst)) < (n - 1))) {
25  d = dst + i;
26  s = src;
27  /* If they specified a maximum of n characters, use n - 1 chars to
28  * hold the copy, and the last character in the array as a NUL.
29  * This is the difference between the regular strncpy routine.
30  * strncpy doesn't guarantee that your new string will have a
31  * NUL terminator, but this routine does.
32  */
33  for (++i; i<n; i++) {
34  c = *s++;
35  if (c == '\0') {
36  ret = d; /* Return ptr to end byte. */
37  *d++ = c;
38 #if (STRNP_ZERO_PAD == 1)
39  /* Pad with zeros. */
40  for (; i<n; i++)
41  *d++ = 0;
42 #endif /* STRNP_ZERO_PAD */
43  return ret;
44  }
45  *d++ = c;
46  }
47  /* If we get here, then we have a full string, with n - 1 characters,
48  * so now we NUL terminate it and go home.
49  */
50  *d = 0;
51  return (d); /* Return ptr to end byte. */
52  }
53  return (dst);
54 } /* Strnpcat */
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
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
int ret
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define c
Definition: ke_i.h:80

Referenced by FTPFtwL2(), main(), and PathCat().