ReactOS  0.4.14-dev-115-g4576127
Strn.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STRN_ZERO_PAD   1
 
#define STRNP_ZERO_PAD   0
 
#define STRNCPY(d, s)   Strncpy((d), (s), (size_t) sizeof(d))
 
#define STRNCAT(d, s)   Strncat((d), (s), (size_t) sizeof(d))
 

Functions

charStrncat (char *const, const char *const, const size_t)
 
charStrncpy (char *const, const char *const, const size_t)
 
charStrnpcat (char *const, const char *const, size_t)
 
charStrnpcpy (char *const, const char *const, size_t)
 
charStrtok (char *, const char *)
 
int Strntok (char *, size_t, char *, const char *)
 
charstrtokc (char *, const char *, char **)
 
int strntokc (char *, size_t, char *, const char *, char **)
 
charDynscat (char **dst,...)
 

Macro Definition Documentation

◆ STRN_ZERO_PAD

#define STRN_ZERO_PAD   1

Definition at line 8 of file Strn.h.

◆ STRNCAT

#define STRNCAT (   d,
  s 
)    Strncat((d), (s), (size_t) sizeof(d))

Definition at line 48 of file Strn.h.

◆ STRNCPY

#define STRNCPY (   d,
  s 
)    Strncpy((d), (s), (size_t) sizeof(d))

Definition at line 47 of file Strn.h.

◆ STRNP_ZERO_PAD

#define STRNP_ZERO_PAD   0

Definition at line 13 of file Strn.h.

Function Documentation

◆ Dynscat()

char* Dynscat ( char **  dst,
  ... 
)

Definition at line 9 of file Dynscat.c.

10 {
11  va_list ap;
12  const char *src;
13  char *newdst, *dcp;
14  size_t curLen, catLen, srcLen;
15 
16  if (dst == (char **) 0)
17  return NULL;
18 
19  catLen = 0;
20  va_start(ap, dst);
21  src = va_arg(ap, char *);
22  while (src != NULL) {
23  catLen += strlen(src);
24  src = va_arg(ap, char *);
25  }
26  va_end(ap);
27 
28  if ((*dst == NULL) || (**dst == '\0'))
29  curLen = 0;
30  else
31  curLen = strlen(*dst);
32 
33  if (*dst == NULL)
34  newdst = malloc(curLen + catLen + 2);
35  else
36  newdst = realloc(*dst, curLen + catLen + 2);
37  if (newdst == NULL)
38  return NULL;
39 
40  dcp = newdst + curLen;
41  va_start(ap, dst);
42  src = va_arg(ap, char *);
43  while (src != NULL) {
44  srcLen = strlen(src);
45  memcpy(dcp, src, srcLen);
46  dcp += srcLen;
47  src = va_arg(ap, char *);
48  }
49  va_end(ap);
50  *dcp = '\0';
51 
52  *dst = newdst;
53  return (newdst);
54 } /* Dynscat */
#define realloc
Definition: debug_ros.c:6
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define va_end(ap)
Definition: acmsvcex.h:90
smooth NULL
Definition: ftsmooth.c:416
char * va_list
Definition: acmsvcex.h:78
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
#define va_arg(ap, T)
Definition: acmsvcex.h:89
GLenum GLenum dst
Definition: glext.h:6340
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define malloc
Definition: debug_ros.c:4

Referenced by ComputeLNames(), ComputeRNames(), and main().

◆ Strncat()

char* Strncat ( char * const  ,
const char * const  ,
const  size_t 
)

Definition at line 13 of file Strncat.c.

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
#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

Referenced by AbbrevStr(), BookmarkToURL(), ExpandTilde(), FileToURL(), GetHomeDir(), GetOurHostName(), main(), MakePrompt(), Path(), SpoolName(), UnDosLine(), and UnLslRLine().

◆ Strncpy()

char* Strncpy ( char * const  ,
const char * const  ,
const  size_t 
)

Definition at line 11 of file Strncpy.c.

12 {
13  register char *d;
14  register const char *s;
15  register size_t i;
16 
17  d = dst;
18  *d = 0;
19  if (n != 0) {
20  s = src;
21  /* If they specified a maximum of n characters, use n - 1 chars to
22  * hold the copy, and the last character in the array as a NUL.
23  * This is the difference between the regular strncpy routine.
24  * strncpy doesn't guarantee that your new string will have a
25  * NUL terminator, but this routine does.
26  */
27  for (i=1; i<n; i++) {
28  if ((*d++ = *s++) == 0) {
29 #if (STRN_ZERO_PAD == 1)
30  /* Pad with zeros. */
31  for (; i<n; i++)
32  *d++ = 0;
33 #endif /* STRN_ZERO_PAD */
34  return dst;
35  }
36  }
37  /* If we get here, then we have a full string, with n - 1 characters,
38  * so now we NUL terminate it and go home.
39  */
40  *d = 0;
41  }
42  return (dst);
43 } /* Strncpy */
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
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by AbbrevStr(), AbsoluteToRelative(), BookmarkToURL(), Chdirs(), DefaultBookmarkName(), ExpandTilde(), FileToURL(), FTPChdir3(), FTPChdirAndGetCWD(), FTPGetCWD(), FTPGetLocalCWD(), GetHomeDir(), GetHostByName(), GetOurHostName(), GetUsrName(), GmTimeStr(), main(), MakePrompt(), MyInetAddr(), nFTPChdirAndGetCWD(), Path(), RunBookmarkEditor(), SetXtermTitle(), SpoolName(), UnDosLine(), and UnLslRLine().

◆ Strnpcat()

char* Strnpcat ( char * const  ,
const char * const  ,
size_t   
)

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().

◆ Strnpcpy()

char* Strnpcpy ( char * const  ,
const char * const  ,
size_t   
)

Definition at line 12 of file Strnpcpy.c.

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

◆ Strntok()

int Strntok ( char ,
size_t  ,
char ,
const char  
)

Definition at line 80 of file Strntok.c.

81 {
82  static char *p = NULL;
83  char *end;
84  char *lim;
85  char *dst;
86  int len;
87 
88  dst = dstTokenStart;
89  lim = dst + tokenSize - 1; /* Leave room for nul byte. */
90 
91  if (buf != NULL) {
92  p = buf;
93  } else {
94  if (p == NULL) {
95  *dst = '\0';
96  return (-1); /* No more tokens. */
97  }
98  }
99 
100  for (end = p; ; end++) {
101  if (*end == '\0') {
102  p = NULL; /* This is the last token. */
103  break;
104  }
105  if (strchr(delims, (int) *end) != NULL) {
106  ++end;
107  p = end;
108  break;
109  }
110  if (dst < lim) /* Don't overrun token size. */
111  *dst++ = *end;
112  }
113  *dst = '\0';
114  len = (int) (dst - dstTokenStart); /* Return length of token. */
115 
116 #if (STRN_ZERO_PAD == 1)
117  /* Pad with zeros. */
118  for (++dst; dst <= lim; )
119  *dst++ = 0;
120 #endif /* STRN_ZERO_PAD */
121 
122  return (len);
123 } /* Strntok */
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint end
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum dst
Definition: glext.h:6340
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GLfloat GLfloat p
Definition: glext.h:8902
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ strntokc()

int strntokc ( char ,
size_t  ,
char ,
const char ,
char **   
)

Definition at line 92 of file strtokc.c.

93 {
94  char *cp;
95  const char *cp2;
96  char c, c2;
97  char *start;
98  int len;
99  char *dst, *lim;
100 
101  dst = dstTokenStart;
102  lim = dst + tokenSize - 1; /* Leave room for nul byte. */
103 
104  if (parsestr == NULL)
105  start = *context;
106  else
107  start = parsestr;
108 
109  if ((start == NULL) || (delims == NULL)) {
110  *context = NULL;
111  goto done;
112  }
113 
114  /* Eat leading delimiters. */
115  for (cp = start; ; ) {
116 next1:
117  c = *cp++;
118  if (c == '\0') {
119  /* No more tokens. */
120  *context = NULL;
121  goto done;
122  }
123  for (cp2 = delims; ; ) {
124  c2 = (char) *cp2++;
125  if (c2 == '\0') {
126  /* This character was not a delimiter.
127  * The token starts here.
128  */
129  start = cp - 1;
130  if (dst < lim)
131  *dst++ = c;
132  goto starttok;
133  }
134  if (c2 == c) {
135  /* This char was a delimiter. */
136  /* Skip it, look at next character. */
137  goto next1;
138  }
139  }
140  /*NOTREACHED*/
141  }
142 
143 starttok:
144  for ( ; ; cp++) {
145  c = *cp;
146  if (c == '\0') {
147  /* Token is finished. */
148  *context = cp;
149  break;
150  }
151  for (cp2 = delims; ; ) {
152  c2 = (char) *cp2++;
153  if (c2 == '\0') {
154  /* This character was not a delimiter.
155  * Keep it as part of current token.
156  */
157  break;
158  }
159  if (c2 == c) {
160  /* This char was a delimiter. */
161  /* End of token. */
162  *cp++ = '\0';
163  *context = cp;
164  goto done;
165  }
166  }
167  if (dst < lim) /* Don't overrun token size. */
168  *dst++ = c;
169  }
170 
171 done:
172  *dst = '\0';
173  len = (int) (dst - dstTokenStart); /* Return length of token. */
174 
175 #if (STRN_ZERO_PAD == 1)
176  /* Pad with zeros. */
177  for (++dst; dst <= lim; )
178  *dst++ = 0;
179 #endif /* STRN_ZERO_PAD */
180 
181  return (len);
182 } /* strntokc */
Definition: http.c:6587
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
const GLubyte * c
Definition: glext.h:8905
GLenum GLsizei len
Definition: glext.h:6722
GLuint start
Definition: gl.h:1545
GLenum GLenum dst
Definition: glext.h:6340
POINT cp
Definition: magnifier.c:59
#define c
Definition: ke_i.h:80
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ Strtok()

char* Strtok ( char ,
const char  
)

Definition at line 35 of file Strntok.c.

36 {
37  static char *p = NULL;
38  char *start, *end;
39 
40  if (buf != NULL) {
41  p = buf;
42  } else {
43  if (p == NULL)
44  return (NULL); /* No more tokens. */
45  }
46  for (start = p, end = p; ; end++) {
47  if (*end == '\0') {
48  p = NULL; /* This is the last token. */
49  break;
50  }
51  if (strchr(delims, (int) *end) != NULL) {
52  *end++ = '\0';
53  p = end;
54  break;
55  }
56  }
57  return (start);
58 } /* Strtok */
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint end
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
GLuint start
Definition: gl.h:1545
char * strchr(const char *String, int ch)
Definition: utclib.c:501
GLfloat GLfloat p
Definition: glext.h:8902

◆ strtokc()

char* strtokc ( char ,
const char ,
char **   
)

Definition at line 7 of file strtokc.c.

8 {
9  char *cp;
10  const char *cp2;
11  char c, c2;
12  char *start;
13 
14  if (parsestr == NULL)
15  start = *context;
16  else
17  start = parsestr;
18 
19  if ((start == NULL) || (delims == NULL)) {
20  *context = NULL;
21  return NULL;
22  }
23 
24  /* Eat leading delimiters. */
25  for (cp = start; ; ) {
26 next1:
27  c = *cp++;
28  if (c == '\0') {
29  /* No more tokens. */
30  *context = NULL;
31  return (NULL);
32  }
33  for (cp2 = delims; ; ) {
34  c2 = (char) *cp2++;
35  if (c2 == '\0') {
36  /* This character was not a delimiter.
37  * The token starts here.
38  */
39  start = cp - 1;
40  goto starttok;
41  }
42  if (c2 == c) {
43  /* This char was a delimiter. */
44  /* Skip it, look at next character. */
45  goto next1;
46  }
47  }
48  /*NOTREACHED*/
49  }
50 
51 starttok:
52  for ( ; ; cp++) {
53  c = *cp;
54  if (c == '\0') {
55  /* Token is finished. */
56  *context = cp;
57  break;
58  }
59  for (cp2 = delims; ; ) {
60  c2 = (char) *cp2++;
61  if (c2 == '\0') {
62  /* This character was not a delimiter.
63  * Keep it as part of current token.
64  */
65  break;
66  }
67  if (c2 == c) {
68  /* This char was a delimiter. */
69  /* End of token. */
70  *cp++ = '\0';
71  *context = cp;
72  return (start);
73  }
74  }
75  }
76  return (start);
77 } /* strtokc */
Definition: http.c:6587
smooth NULL
Definition: ftsmooth.c:416
unsigned char
Definition: typeof.h:29
const GLubyte * c
Definition: glext.h:8905
GLuint start
Definition: gl.h:1545
POINT cp
Definition: magnifier.c:59
#define c
Definition: ke_i.h:80