|
| int | snprintf (char *s, size_t n, const char *fmt,...) |
| | Formats a string into a buffer.
|
| static void * | memmove (void *dest, const void *src, size_t n) |
| | Copies n bytes from src to dest; the two may overlap.
|
| static void * | memcpy (void *dest, const void *src, size_t n) |
| | Copies n bytes from src to dest, which must not overlap.
|
| static void * | memset (void *s, int c, size_t n) |
| | Sets n bytes at s to c.
|
| static int | memcmp (const void *s1, const void *s2, size_t n) |
| | Compares n bytes: 0 if they're the same, else the difference of the first bytes that differ.
|
| static int | strcmp (const char *s1, const char *s2) |
| | Compares two strings, as the C library's strcmp().
|
| static int | strncmp (const char *s1, const char *s2, size_t n) |
| | Compares at most n characters of two strings.
|
| static int | strlen (const char *s) |
| | Returns the length of a string.
|
| static size_t | strnlen (const char *s, size_t max) |
| | Returns the length of a string, or max if there is no NUL in its first max bytes.
|
| static char * | strdup (const char *s) |
| | Returns a copy of a string, from kmalloc(), or NULL if there's no memory for it.
|
| static char * | strcpy (char *dst, const char *src) |
| | Copies a string, with its NUL, and returns dst.
|
| static char * | stpcpy (char *dst, const char *src) |
| | Copies a string, as strcpy(), but returns the end of dst (its NUL).
|
| static char ** | tokenize (const char *s, char c) |
| | Splits a string at each c, leading ones skipped.
|
| static void | free_tokens (char **ptr) |
| | Frees what tokenize() returned.
|
| int snprintf |
( |
char * | s, |
|
|
size_t | n, |
|
|
const char * | fmt, |
|
|
| ... ) |
Formats a string into a buffer.
- Parameters
-
| s | the buffer |
| n | its size: at most n - 1 characters are written, and a NUL after them (nothing at all if n is 0) |
| fmt | the format (see the top of this file for what it supports) |
- Returns
- how many characters were written, not counting the NUL
Definition at line 226 of file snprintf.c.
References snprintf(), va_end, va_list, va_start, and vsnprintf().
Referenced by apic_describe(), arch_interrupts_info(), csi(), netif_register(), procfs_buddyinfo(), procfs_cmdline(), procfs_devices(), procfs_filesystems(), procfs_finddir(), procfs_kvmem(), procfs_meminfo(), procfs_mounts(), procfs_proc_maps(), procfs_proc_status(), procfs_proc_vmstats(), procfs_rdcmdline(), procfs_readdir(), procfs_uptime(), procfs_version(), pts_new(), pty_free(), and snprintf().
| char ** tokenize |
( |
const char * | s, |
|
|
char | c ) |
|
inlinestatic |
Splits a string at each c, leading ones skipped.
Returns an array of the pieces, ended by NULL, which free_tokens() frees, or NULL if s is NULL or empty, or if there's no memory. The pieces all live in one copy of s.
Definition at line 147 of file string.h.
References kfree(), kmalloc(), NULL, strdup(), and strlen().