CS318 - Pintos
Pintos source browser for JHU CS318 course
string.h
Go to the documentation of this file.
1 #ifndef __LIB_STRING_H
2 #define __LIB_STRING_H
3 
4 #include <stddef.h>
5 
6 /** Standard. */
7 void *memcpy (void *, const void *, size_t);
8 void *memmove (void *, const void *, size_t);
9 char *strncat (char *, const char *, size_t);
10 int memcmp (const void *, const void *, size_t);
11 int strcmp (const char *, const char *);
12 void *memchr (const void *, int, size_t);
13 char *strchr (const char *, int);
14 size_t strcspn (const char *, const char *);
15 char *strpbrk (const char *, const char *);
16 char *strrchr (const char *, int);
17 size_t strspn (const char *, const char *);
18 char *strstr (const char *, const char *);
19 void *memset (void *, int, size_t);
20 size_t strlen (const char *);
21 
22 /** Extensions. */
23 size_t strlcpy (char *, const char *, size_t);
24 size_t strlcat (char *, const char *, size_t);
25 char *strtok_r (char *, const char *, char **);
26 size_t strnlen (const char *, size_t);
27 
28 /** Try to be helpful. */
29 #define strcpy dont_use_strcpy_use_strlcpy
30 #define strncpy dont_use_strncpy_use_strlcpy
31 #define strcat dont_use_strcat_use_strlcat
32 #define strncat dont_use_strncat_use_strlcat
33 #define strtok dont_use_strtok_use_strtok_r
34 
35 #endif /**< lib/string.h */
memcmp
int memcmp(const void *, const void *, size_t)
Find the first differing byte in the two blocks of SIZE bytes at A and B.
Definition: string.c:53
strtok_r
char * strtok_r(char *, const char *, char **)
Breaks a string into tokens separated by DELIMITERS.
Definition: string.c:235
strlen
size_t strlen(const char *)
Returns the length of STRING.
Definition: string.c:293
memcpy
void * memcpy(void *, const void *, size_t)
Standard.
Definition: string.c:7
strlcat
size_t strlcat(char *, const char *, size_t)
Concatenates string SRC to DST.
Definition: string.c:356
strchr
char * strchr(const char *, int)
Finds and returns the first occurrence of C in STRING, or a null pointer if C does not appear in STRI...
Definition: string.c:113
strnlen
size_t strnlen(const char *, size_t)
If STRING is less than MAXLEN characters in length, returns its actual length.
Definition: string.c:307
strstr
char * strstr(const char *, const char *)
Returns a pointer to the first occurrence of NEEDLE within HAYSTACK.
Definition: string.c:184
memchr
void * memchr(const void *, int, size_t)
Returns a pointer to the first occurrence of CH in the first SIZE bytes starting at BLOCK.
Definition: string.c:94
strcmp
int strcmp(const char *, const char *)
Finds the first differing characters in strings A and B.
Definition: string.c:73
strpbrk
char * strpbrk(const char *, const char *)
Returns a pointer to the first character in STRING that is also in STOP.
Definition: string.c:145
strlcpy
size_t strlcpy(char *, const char *, size_t)
Extensions.
Definition: string.c:326
strncat
#define strncat
Definition: string.h:32
strcspn
size_t strcspn(const char *, const char *)
Returns the length of the initial substring of STRING that consists of characters that are not in STO...
Definition: string.c:131
strrchr
char * strrchr(const char *, int)
Returns a pointer to the last occurrence of C in STRING.
Definition: string.c:156
memmove
void * memmove(void *, const void *, size_t)
Copies SIZE bytes from SRC to DST, which are allowed to overlap.
Definition: string.c:24
strspn
size_t strspn(const char *, const char *)
Returns the length of the initial substring of STRING that consists of characters in SKIP.
Definition: string.c:170
stddef.h
memset
void * memset(void *, int, size_t)
Sets the SIZE bytes in DST to VALUE.
Definition: string.c:279