PKUOS - Pintos
Pintos source browser for PKU Operating System 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. */
7void *memcpy (void *, const void *, size_t);
8void *memmove (void *, const void *, size_t);
9char *strncat (char *, const char *, size_t);
10int memcmp (const void *, const void *, size_t);
11int strcmp (const char *, const char *);
12void *memchr (const void *, int, size_t);
13char *strchr (const char *, int);
14size_t strcspn (const char *, const char *);
15char *strpbrk (const char *, const char *);
16char *strrchr (const char *, int);
17size_t strspn (const char *, const char *);
18char *strstr (const char *, const char *);
19void *memset (void *, int, size_t);
20size_t strlen (const char *);
21
22/** Extensions. */
23size_t strlcpy (char *, const char *, size_t);
24size_t strlcat (char *, const char *, size_t);
25char *strtok_r (char *, const char *, char **);
26size_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 */
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
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
char * strstr(const char *, const char *)
Returns a pointer to the first occurrence of NEEDLE within HAYSTACK.
Definition: string.c:184
size_t strlen(const char *)
Returns the length of STRING.
Definition: string.c:293
int strcmp(const char *, const char *)
Finds the first differing characters in strings A and B.
Definition: string.c:73
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
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
char * strrchr(const char *, int)
Returns a pointer to the last occurrence of C in STRING.
Definition: string.c:156
char * strpbrk(const char *, const char *)
Returns a pointer to the first character in STRING that is also in STOP.
Definition: string.c:145
void * memcpy(void *, const void *, size_t)
Standard.
Definition: string.c:7
size_t strlcat(char *, const char *, size_t)
Concatenates string SRC to DST.
Definition: string.c:356
size_t strlcpy(char *, const char *, size_t)
Extensions.
Definition: string.c:326
void * memmove(void *, const void *, size_t)
Copies SIZE bytes from SRC to DST, which are allowed to overlap.
Definition: string.c:24
void * memset(void *, int, size_t)
Sets the SIZE bytes in DST to VALUE.
Definition: string.c:279
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
char * strtok_r(char *, const char *, char **)
Breaks a string into tokens separated by DELIMITERS.
Definition: string.c:235
#define strncat
Definition: string.h:32
size_t strnlen(const char *, size_t)
If STRING is less than MAXLEN characters in length, returns its actual length.
Definition: string.c:307