SWILIB API (SG)    
Loading...
Searching...
No Matches
libc.h File Reference
#include "base.h"
#include <stdarg.h>

Go to the source code of this file.

Macros

#define __JMPBUF_DECL
 

Typedefs

typedef int jmp_buf[11]
 

Functions

Memory
void * malloc (size_t size)
 Allocate memory block.
 
void * calloc (size_t count, size_t size)
 Allocate and zero-initialize array.
 
void * realloc (void *ptr, size_t size)
 Reallocate memory block.
 
void free (void *ptr)
 Deallocate memory block.
 
void mfree (void *ptr)
 Free previously allocated memory.
 
void * malloc_adr (void)
 Pointer to the function malloc().
 
void * mfree_adr (void)
 Pointer to the function free().
 
void * realloc_adr (void)
 Pointer to the function realloc().
 
Memory utils
int memcmp (const void *ptr1, const void *ptr2, size_t num)
 Compare two blocks of memory.
 
void * memchr (const void *str, int c, size_t num)
 Locate character in block of memory.
 
void zeromem (void *ptr, int num)
 Fill block of memory with zero.
 
void bzero (void *ptr, int num)
 Fill block of memory with zero.
 
void * memset (void *ptr, int val, size_t num)
 Fill block of memory with zero.
 
void * memcpy (void *destination, const void *source, size_t num)
 Copy block of memory.
 
void * memmove (void *destination, const void *source, size_t num)
 Move block of memory.
 
Long jump
int setjmp (jmp_buf env)
 Save calling environment for long jump.
 
void longjmp (jmp_buf env, int val)
 Long jump.
 
Random
void srand (uint32_t seed)
 Initialize random number generator.
 
int rand (void)
 Generate random number.
 
Formatting
int snprintf (char *s, size_t n, const char *format,...)
 Write formatted output to sized buffer.
 
int sprintf (char *s, const char *format,...)
 Write formatted output to buffer.
 
int vsprintf (char *s, const char *format, va_list args)
 Write formatted output to buffer using a variable argument list.
 
int vsnprintf (char *s, size_t n, const char *format, va_list args)
 Write formatted output to a sized buffer using a variable argument list.
 
int sscanf (const char *s, const char *format,...)
 Read formatted data from string.
 
String utils
char * strchr (const char *str, int character)
 Locate first occurrence of character in string.
 
int strcmp (const char *str1, const char *str2)
 Compare two strings.
 
int strcasecmp (const char *str1, const char *str2)
 Compare two strings without case sensitivity.
 
int strcmpi (const char *str1, const char *str2)
 Compare two strings without case sensitivity.
 
size_t strlen (const char *str)
 Get string length.
 
size_t strcspn (const char *str1, const char *str2)
 Get span until character in string.
 
char * strcat (char *destination, const char *source)
 Concatenate strings.
 
char * strncat (char *destination, const char *source, size_t num)
 Append characters from string.
 
int strncmp (const char *str1, const char *str2, size_t num)
 Compare characters of two strings.
 
char * strcpy (char *destination, const char *source)
 Copy string.
 
char * strncpy (char *destination, const char *source, size_t num)
 Copy characters from string.
 
char * strrchr (const char *str, int character)
 Locate last occurrence of character in string.
 
char * strstr (const char *str1, const char *str2)
 Locate substring.
 
long int strtol (const char *str, char **endptr, int base)
 Convert string to long integer.
 
unsigned long strtoul (const char *str, char **endptr, int base)
 Convert string to unsigned long integer.
 
Searching & sorting
void qsort (void *first, size_t nitems, size_t size, int(*comparator)(const void *, const void *))
 Sorting array.
 
void * bsearch (const void *key, const void *first, size_t nitems, size_t size, int(*comparator)(const void *, const void *))
 Searchign in array.
 
Environment variables
int setenv (const char *name, const char *value, int replace)
 Set a value for the environment variable.
 
int unsetenv (const char *name)
 Remove environment variable.
 
char * getenv (const char *name)
 Get value for the environment variable.
 
int clearenv (void)
 Remove all environment variables.
 
Shared libs
int dlopen (const char *name)
 Load the dynamic shared object (.so).
 
void * dlsym (int handle, const char *name)
 Get a pointer to the symbol from the previously loaded dynamic object.
 
int dlclose (int handle)
 Close previously loaded dynamic object.
 
const char * dlerror (void)
 Get a string representation of the last error in _dlopen.