Corewar documentation 1.0.0
|
The header file of the libmy. More...
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <ctype.h>
#include <math.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <dirent.h>
#include <signal.h>
#include <glob.h>
Go to the source code of this file.
Data Structures | |
struct | info_param |
struct | number_settings_s |
Macros | |
#define | MAX_INT 2147483647 |
#define | MIN_INT -2147483648 |
#define | MAX_LONG 9223372036854775807 |
#define | MIN_LONG -9223372036854775808 |
#define | MAX_SHORT 32767 |
#define | MIN_SHORT -32768 |
#define | MAX_SHORT_SHORT 127 |
#define | MIN_SHORT_SHORT -128 |
#define | MAX_SIZE_T 18446744073709551615 |
#define | ABS(value) ((value < 0) ? - value : value) |
#define | MAX(a, b) ((a > b) ? a : b) |
#define | MIN(a, b) ((a < b) ? a : b) |
#define | STR_CONTAINS(str, find) (my_strstr(str, find) != NULL) ? 1 : 0 |
#define | NB number_settings_t |
#define | STR2ARRAY(str) my_str_to_word_array(str) |
#define | STR2ARRAY_SEP(str, sep) my_str_to_word_array_select(str, sep) |
#define | STR2ARRAY_STR(str, sep) my_str_to_word_array_string(str, sep) |
#define | FREE(ptr) ptr = my_free_ptr(ptr) |
#define | FREE_WORD_ARRAY(ptr) my_free_array((void **)ptr) |
#define | NB number_settings_t |
Typedefs | |
typedef enum my_bool | my_bool_t |
typedef struct number_settings_s | number_settings_t |
Enumerations | |
enum | my_bool { FALSE = 0 , TRUE = 1 } |
Functions | |
void | my_putchar (char c) |
Prints a char (c) in the stdout. | |
void | my_isneg (int nb) |
Prints 'P' if the number (n) is positive or 'N' if the number (n) is negative. | |
void | my_putnbr (int nb) |
Prints a number (nb) in stdout. | |
int | my_putstr (char const *str) |
Writes a string (str) in stdout and returns the length of the printed string. | |
void | my_showstr (char const *str) |
Prints a string (str) but replaces non-printable characters with their hexadecimal number. | |
void | my_showmem (char const *str, int size) |
Prints a memory dump of a string (str) with a defined size. | |
void | my_print_combn (int n) |
Prints all the numbers composed by (n) different digits numbers All digits in the number are different and only the smallest number composed by those digits are display. | |
void | my_putnbr_base (int nbr, char const *base) |
Prints a number (nb) in the requested base (base) in stdout. | |
void | my_show_word_array (char *const *tab) |
Prints all word in an array (tab) | |
void | my_print_params (int argc, char **argv) |
Prints all the parameters of the program. | |
int | my_putstr_error (char const *str) |
Prints a string (str) in stderr. | |
int | my_putstr_sized (char const *str, int size) |
Prints a string (str) in stdout with a defined size (size) and returns the length of the printed string. | |
int | my_putstr_fd (char const *str, int fd) |
Writes a string (str) in a file descriptor (fd) and returns the length of the printed string. | |
int | my_putstr_fd_free (char *str, int fd) |
Writes a string (str) in a file descriptor (fd), free it and returns the length of the printed string. | |
int | my_printf (char const *format,...) |
Prints a string (format) with possible flags and format in stdout and returns the length the printed string. | |
int | my_fprintf (int fd, char const *format,...) |
Writes a string (format) with possible flags and format in a file descriptor (fd) and returns the length the printed string. | |
int | my_char_is_alpha (char const c) |
Checks if a char (c) is a letter. | |
int | my_char_is_num (char const c) |
Checks if a char (c) is a number. | |
int | my_char_is_printable (char const c) |
Checks if a char (c) is printable. | |
int | my_char_is (char c, const char *char_list) |
Checks if a char (c) is in a list of chars (char_list) | |
char * | my_add_chr (char *str, char chr) |
Adds a char (chr) at the end of a string (str) | |
char | my_get_last_char (char *str) |
Returns the last char of a string (str) | |
int | my_str_isalpha (char const *str) |
Checks if a string (str) is alphabetical. | |
int | my_str_isnum (char const *str) |
Checks if a string (str) is a number. | |
int | my_str_islower (char const *str) |
Checks if a string (str) is lowercase. | |
int | my_str_isupper (char const *str) |
Checks if a string (str) is uppercase. | |
int | my_str_isprintable (char const *str) |
Checks if a string (str) is printable. | |
int | my_str_is (char *str, const char *char_list) |
Checks if a string (str) is composed of characters in the characters list (char_list) or 0 if not. | |
int | my_str_contains (char *str, char *char_list) |
Checks if a string (str) contains a character in a list of characters (char_list) | |
int | my_strlen (char const *str) |
Returns the length of a string (str) | |
char * | my_strcpy (char *dest, char const *src) |
Copies a string (src) and paste it on another string (dest) | |
char * | my_strncpy (char *dest, char const *src, int n) |
Copies a string (src) and paste it on another string (dest) with a defined size (n) | |
char * | my_revstr (char *str) |
Reverses the characters in a string (str) and returns the string (str) | |
char * | my_strstr (char *str, char const *to_find) |
Search a string (to_find) on another (str) and returns the address of the first occurrence. | |
int | my_strcmp (char const *s1, char const *s2) |
Compares two strings (s1) and (s2) | |
int | my_strncmp (char const *s1, char const *s2, int n) |
Compares two strings (s1) and (s2) with a defined size (n) | |
char * | my_strupcase (char *str) |
Replaces lowcase by upcase of a string (str) | |
char * | my_strlowcase (char *str) |
Replaces upcase by lowcase of a string (str) | |
char * | my_strcapitalize (char *str) |
Capitalizes the first letter of each word in a string (str) and lowercase the other letters. | |
char * | my_strcat (char *dest, char const *src) |
Concatenates two strings (dest) and (src) | |
char * | my_strncat (char *dest, char const *src, int nb) |
Concatenates two strings (dest) and (src) with a defined size (nb) | |
char * | my_strdup (const char *src) |
Duplicates a string (src) and returns the new string. | |
char * | my_strndup (const char *src, int n) |
Duplicates a string (src) with a defined size (n) and returns the new string. | |
char ** | my_strdup_word_array (char **array) |
Duplicates a word array (array) and returns the new array. | |
const char * | my_strerror (int error) |
Returns the error message of the error number (error) | |
int | my_count_letter (char const *str, char c) |
Counts the number of times a letter (c) is in a string (str) | |
int | my_get_char_index (char *str, char c, int occurrence) |
Get the index of a char in a str according to its occurrence. | |
void | my_replace_char (char *str, char to_replace, char replace_by) |
Replace a char in a string by another char. | |
int | my_nbrlen (int nb) |
Returns the length of a number (nb) | |
void | my_swap (int *a, int *b) |
Swaps two integers (a) and (b) | |
void | my_sort_int_array (int *tab, int size) |
Sorts an array (array) with a defined size (size) of integers in ascending order. | |
char * | my_convert_base (char const *nbr, char const *base_from, char const *base_to) |
Returns the result of the conversion of a number (nbr) in a specific base (base_from) to another base (base_to) | |
char * | my_convert_base_unsigned (char const *nbr, char const *base_from, char const *base_to) |
Returns the result of the conversion of a unsigned number (nbr) in a specific base (base_from) to another base (base_to) | |
char * | my_convert_base_size_t (char const *nbr, char const *base_from, char const *base_to) |
Returns the result of the conversion of a size_t number (nbr) in a specific base (base_from) to another base (base_to) | |
void | my_round_float_str (char *float_nb, char last_char, int i, int enable) |
Modify a string (float) and round it. | |
int | my_array_len (void **array) |
Returns the length of an array (array) | |
char ** | my_str_to_word_array (char const *str) |
Returns an array of words from a string (str) | |
char ** | my_str_to_word_array_select (char const *str, char const *separator) |
Returns an array of words delimited by a list of separator (separator) from a string (str) | |
char ** | my_str_to_word_array_string (char const *str, char const *separator) |
Returns an array of words delimited by a separator (separator) from a string (str) | |
char ** | my_super_array (char *str, char *sep) |
Returns an array of words delimited by a list of separator (separator) from a string (str) | |
void | my_free_array (void **array) |
Frees an array (array) | |
void * | my_free_ptr (void *ptr) |
Frees a pointer (ptr) | |
int | my_getnbr (char const *str) |
Returns an int number starting from a string number (str) | |
int | my_find_nbr (char const *str) |
Find the first number (number) found in a string. | |
float | my_getnbr_float (char const *str) |
Returns a float number starting from a string number (str) | |
int | my_getnbr_base (char const *str, char const *base) |
Returns a number starting from a string number (str) in the requested base (base) | |
int | my_strict_getnbr (char const *str) |
Returns an int number starting from a string number (str) | |
float | my_strict_getnbr_float (char const *str) |
Returns a float number starting from a string number (str) | |
int | my_strict_find_nbr (char const *str) |
Find the first number (number) found in a string. | |
int | my_super_number (char *number, number_settings_t settings) |
Returns an int number starting from a string number (number) and change my_errno if an error occurs depending on the settings (settings) | |
int | my_compute_power_rec (int nb, int power) |
Returns the power (p) of the number (nb) | |
size_t | my_compute_power_rec_size_t (int nb, int p) |
Returns the power (p) of the number (nb) | |
int | my_compute_square_root (int nb) |
Returns the square root of a number (nb) | |
int | my_compute_factorial_rec (int nb) |
Returns the factorial of a number (nb) | |
int | my_is_prime (int nb) |
Returns 1 if the number (nb) is prime and 0 otherwise. | |
int | my_find_prime_sup (int nb) |
Returns the next prime number after a number (nb) | |
int | my_find_prime_inf (int nb) |
Returns the previous prime number before a number (nb) | |
struct info_param * | my_params_to_array (int ac, char **av) |
Returns a info_params struct of the argc (ac) and the argv (av) | |
void | my_show_param_array (struct info_param const *par) |
Prints the information of a parameter array (par) | |
void | my_rev_params (int argc, char **argv) |
Prints all the arguments (argc and argv) in reverse order. | |
void | my_sort_params (int argc, char **argv) |
Sorts the parameters (argc and argv) in ascending order. | |
char * | my_concat_params (int argc, char **argv) |
Returns a string with all the arguments (argc and argv) concatenated. | |
char * | my_str_nbr (int nb) |
Returns the string conversion of a number (nb) | |
char * | my_str_nbr_short (short int nb) |
Returns the string conversion of a short number (nb) | |
char * | my_str_nbr_short_short (signed char nb) |
Returns the string conversion of a short short number (nb) | |
char * | my_str_nbr_base_unsigned (unsigned int nbr, char const *base) |
Returns the string conversion of an unsigned number (nbr) in specific base (base) | |
char * | my_str_nbr_base_unsigned_short (unsigned short nbr, char const *base) |
Returns the string conversion of an unsigned short number (nbr) in specific base (base) | |
char * | my_str_nbr_base_unsigned_short_short (unsigned char nbr, char const *base) |
Returns the string conversion of an unsigned short short number (nbr) in specific base (base) | |
char * | my_str_nbr_base_unsigned_size_t (size_t nbr, char const *base) |
Returns the string conversion of an size_t number (nbr) in specific base (base) | |
char * | my_str_nbr_base_unsigned_long (unsigned long nbr, char const *base) |
Returns the string conversion of an unsigned long number (nbr) in specific base (base) | |
char * | my_str_nbr_base_long_long_int (long long int nbr, char const *base) |
Returns the string conversion of an long long number (nbr) in specific base (base) | |
char * | my_str_nbr_unsigned (unsigned int nb) |
Returns the string conversion of an unsigned number (nb) | |
char * | my_str_nbr_unsigned_long (unsigned long int nb) |
Returns the string conversion of an unsigned long number (nb) | |
char * | my_str_nbr_long_long (long long nb) |
Returns the string conversion of an long long number (nb) | |
char * | my_str_nbr_size_t (size_t nb) |
Returns the string conversion of an size_t number (nb) | |
Variables | |
int | my_errno |
The header file of the libmy.
char * my_add_chr | ( | char * | str, |
char | chr ) |
Adds a char (chr) at the end of a string (str)
str | The string to modify |
chr | The char to add |
int my_array_len | ( | void ** | array | ) |
Returns the length of an array (array)
array | The array to check |
int my_char_is | ( | char | c, |
const char * | char_list ) |
Checks if a char (c) is in a list of chars (char_list)
c | The char to check |
char_list | The list of chars to check |
int my_char_is_alpha | ( | char const | c | ) |
Checks if a char (c) is a letter.
c | The char to check |
int my_char_is_num | ( | char const | c | ) |
Checks if a char (c) is a number.
c | The char to check |
int my_char_is_printable | ( | char const | c | ) |
Checks if a char (c) is printable.
c | The char to check |
int my_compute_factorial_rec | ( | int | nb | ) |
Returns the factorial of a number (nb)
nb | The number to calculate |
int my_compute_power_rec | ( | int | nb, |
int | power ) |
Returns the power (p) of the number (nb)
nb | The number to calculate |
power | The power of the number |
size_t my_compute_power_rec_size_t | ( | int | nb, |
int | p ) |
Returns the power (p) of the number (nb)
nb | The number to calculate |
power | The power of the number |
int my_compute_square_root | ( | int | nb | ) |
Returns the square root of a number (nb)
nb | The number to calculate |
char * my_concat_params | ( | int | argc, |
char ** | argv ) |
Returns a string with all the arguments (argc and argv) concatenated.
argc | The number of parameters |
argv | The array of parameters |
char * my_convert_base | ( | char const * | nbr, |
char const * | base_from, | ||
char const * | base_to ) |
Returns the result of the conversion of a number (nbr) in a specific base (base_from) to another base (base_to)
nbr | The number to convert |
base_from | The base of the number |
base_to | The base to convert the number |
char * my_convert_base_size_t | ( | char const * | nbr, |
char const * | base_from, | ||
char const * | base_to ) |
Returns the result of the conversion of a size_t number (nbr) in a specific base (base_from) to another base (base_to)
nbr | The number to convert |
base_from | The base of the number |
base_to | The base to convert the number |
char * my_convert_base_unsigned | ( | char const * | nbr, |
char const * | base_from, | ||
char const * | base_to ) |
Returns the result of the conversion of a unsigned number (nbr) in a specific base (base_from) to another base (base_to)
nbr | The number to convert |
base_from | The base of the number |
base_to | The base to convert the number |
int my_count_letter | ( | char const * | str, |
char | c ) |
Counts the number of times a letter (c) is in a string (str)
str | The string to check |
c | The letter to count |
int my_find_nbr | ( | char const * | str | ) |
Find the first number (number) found in a string.
str | The string to convert |
int my_find_prime_inf | ( | int | nb | ) |
Returns the previous prime number before a number (nb)
nb | The number to check |
int my_find_prime_sup | ( | int | nb | ) |
Returns the next prime number after a number (nb)
nb | The number to check |
int my_fprintf | ( | int | fd, |
char const * | format, | ||
... ) |
Writes a string (format) with possible flags and format in a file descriptor (fd) and returns the length the printed string.
format | The string to print |
... | The arguments to use with flags and format |
void my_free_array | ( | void ** | array | ) |
Frees an array (array)
array | The array to free |
void * my_free_ptr | ( | void * | ptr | ) |
Frees a pointer (ptr)
ptr | The pointer to free |
int my_get_char_index | ( | char * | str, |
char | c, | ||
int | occurrence ) |
Get the index of a char in a str according to its occurrence.
str | The string to check |
c | The letter to find |
occurrence | The occurrence of the letter to find |
char my_get_last_char | ( | char * | str | ) |
Returns the last char of a string (str)
str | The string to check |
int my_getnbr | ( | char const * | str | ) |
Returns an int number starting from a string number (str)
str | The string to convert |
int my_getnbr_base | ( | char const * | str, |
char const * | base ) |
Returns a number starting from a string number (str) in the requested base (base)
str | The string to convert |
base | The base of the number |
float my_getnbr_float | ( | char const * | str | ) |
Returns a float number starting from a string number (str)
str | The string to convert |
int my_is_prime | ( | int | nb | ) |
Returns 1 if the number (nb) is prime and 0 otherwise.
nb | The number to check |
void my_isneg | ( | int | nb | ) |
Prints 'P' if the number (n) is positive or 'N' if the number (n) is negative.
nb | The number to check |
int my_nbrlen | ( | int | nb | ) |
Returns the length of a number (nb)
nb | The number to check |
struct info_param * my_params_to_array | ( | int | ac, |
char ** | av ) |
Returns a info_params struct of the argc (ac) and the argv (av)
ac | The number of parameters |
av | The array of parameters |
void my_print_combn | ( | int | n | ) |
Prints all the numbers composed by (n) different digits numbers All digits in the number are different and only the smallest number composed by those digits are display.
n | The number of digits in the number |
void my_print_params | ( | int | argc, |
char ** | argv ) |
Prints all the parameters of the program.
argc | The number of parameters |
argv | The array of parameters |
int my_printf | ( | char const * | format, |
... ) |
Prints a string (format) with possible flags and format in stdout and returns the length the printed string.
format | The string to print |
... | The arguments to use with flags and format |
void my_putchar | ( | char | c | ) |
Prints a char (c) in the stdout.
c | The char to print |
void my_putnbr | ( | int | nb | ) |
Prints a number (nb) in stdout.
nb | The number to print |
void my_putnbr_base | ( | int | nbr, |
char const * | base ) |
Prints a number (nb) in the requested base (base) in stdout.
nbr | The number to print |
base | The base to use |
int my_putstr | ( | char const * | str | ) |
Writes a string (str) in stdout and returns the length of the printed string.
str | The string to print |
int my_putstr_error | ( | char const * | str | ) |
Prints a string (str) in stderr.
str | The string to print |
int my_putstr_fd | ( | char const * | str, |
int | fd ) |
Writes a string (str) in a file descriptor (fd) and returns the length of the printed string.
str | The string to print |
fd | The file descriptor to write in |
int my_putstr_fd_free | ( | char * | str, |
int | fd ) |
Writes a string (str) in a file descriptor (fd), free it and returns the length of the printed string.
str | The string to print |
fd | The file descriptor to write in |
int my_putstr_sized | ( | char const * | str, |
int | size ) |
Prints a string (str) in stdout with a defined size (size) and returns the length of the printed string.
str | The string to print |
size | The size of the string |
void my_replace_char | ( | char * | str, |
char | to_replace, | ||
char | replace_by ) |
Replace a char in a string by another char.
str | The string to modify |
to_replace | The char to replace |
replace_by | The char to replace by |
void my_rev_params | ( | int | argc, |
char ** | argv ) |
Prints all the arguments (argc and argv) in reverse order.
par | The information of the parameters |
char * my_revstr | ( | char * | str | ) |
Reverses the characters in a string (str) and returns the string (str)
str | The string to reverse |
void my_round_float_str | ( | char * | float_nb, |
char | last_char, | ||
int | i, | ||
int | enable ) |
Modify a string (float) and round it.
float_nb | The float number to round |
last_char | The last character of the float number |
i | The index of the float number |
enable | The enable of the round |
void my_show_param_array | ( | struct info_param const * | par | ) |
Prints the information of a parameter array (par)
par | The information of the parameters |
void my_show_word_array | ( | char *const * | tab | ) |
Prints all word in an array (tab)
tab | The array of words to print |
void my_showmem | ( | char const * | str, |
int | size ) |
Prints a memory dump of a string (str) with a defined size.
str | The string to print |
size | The size of the string |
void my_showstr | ( | char const * | str | ) |
Prints a string (str) but replaces non-printable characters with their hexadecimal number.
str | The string to print |
void my_sort_int_array | ( | int * | tab, |
int | size ) |
Sorts an array (array) with a defined size (size) of integers in ascending order.
tab | The array to sort |
size | The size of the tab |
void my_sort_params | ( | int | argc, |
char ** | argv ) |
Sorts the parameters (argc and argv) in ascending order.
argc | The number of parameters |
argv | The array of parameters |
int my_str_contains | ( | char * | str, |
char * | char_list ) |
Checks if a string (str) contains a character in a list of characters (char_list)
str | The string to check |
char_list | The list of characters to check |
int my_str_is | ( | char * | str, |
const char * | char_list ) |
Checks if a string (str) is composed of characters in the characters list (char_list) or 0 if not.
str | The string to check |
int my_str_isalpha | ( | char const * | str | ) |
Checks if a string (str) is alphabetical.
str | The string to check |
int my_str_islower | ( | char const * | str | ) |
Checks if a string (str) is lowercase.
str | The string to check |
int my_str_isnum | ( | char const * | str | ) |
Checks if a string (str) is a number.
str | The string to check |
int my_str_isprintable | ( | char const * | str | ) |
Checks if a string (str) is printable.
str | The string to check |
int my_str_isupper | ( | char const * | str | ) |
Checks if a string (str) is uppercase.
str | The string to check |
char * my_str_nbr | ( | int | nb | ) |
Returns the string conversion of a number (nb)
nb | The number to convert |
char * my_str_nbr_base_long_long_int | ( | long long int | nbr, |
char const * | base ) |
Returns the string conversion of an long long number (nbr) in specific base (base)
nb | The number to convert |
base | The base to use |
char * my_str_nbr_base_unsigned | ( | unsigned int | nbr, |
char const * | base ) |
Returns the string conversion of an unsigned number (nbr) in specific base (base)
nbr | The number to convert |
base | The base to use |
char * my_str_nbr_base_unsigned_long | ( | unsigned long | nbr, |
char const * | base ) |
Returns the string conversion of an unsigned long number (nbr) in specific base (base)
nb | The number to convert |
base | The base to use |
char * my_str_nbr_base_unsigned_short | ( | unsigned short | nbr, |
char const * | base ) |
Returns the string conversion of an unsigned short number (nbr) in specific base (base)
nb | The number to convert |
base | The base to use |
char * my_str_nbr_base_unsigned_short_short | ( | unsigned char | nbr, |
char const * | base ) |
Returns the string conversion of an unsigned short short number (nbr) in specific base (base)
nb | The number to convert |
base | The base to use |
char * my_str_nbr_base_unsigned_size_t | ( | size_t | nbr, |
char const * | base ) |
Returns the string conversion of an size_t number (nbr) in specific base (base)
nb | The number to convert |
base | The base to use |
char * my_str_nbr_long_long | ( | long long | nb | ) |
Returns the string conversion of an long long number (nb)
nb | The number to convert |
char * my_str_nbr_short | ( | short int | nb | ) |
Returns the string conversion of a short number (nb)
nb | The number to convert |
char * my_str_nbr_short_short | ( | signed char | nb | ) |
Returns the string conversion of a short short number (nb)
nb | The number to convert |
char * my_str_nbr_size_t | ( | size_t | nb | ) |
Returns the string conversion of an size_t number (nb)
nb | The number to convert |
char * my_str_nbr_unsigned | ( | unsigned int | nb | ) |
Returns the string conversion of an unsigned number (nb)
nb | The number to convert |
char * my_str_nbr_unsigned_long | ( | unsigned long int | nb | ) |
Returns the string conversion of an unsigned long number (nb)
nb | The number to convert |
char ** my_str_to_word_array | ( | char const * | str | ) |
Returns an array of words from a string (str)
str | The string to convert |
char ** my_str_to_word_array_select | ( | char const * | str, |
char const * | separator ) |
Returns an array of words delimited by a list of separator (separator) from a string (str)
str | The string to convert |
separator | The separator to use |
char ** my_str_to_word_array_string | ( | char const * | str, |
char const * | separator ) |
Returns an array of words delimited by a separator (separator) from a string (str)
str | The string to convert |
separator | The separator to use |
char * my_strcapitalize | ( | char * | str | ) |
Capitalizes the first letter of each word in a string (str) and lowercase the other letters.
str | The string to modify |
char * my_strcat | ( | char * | dest, |
char const * | src ) |
Concatenates two strings (dest) and (src)
dest | The destination string |
src | The source string |
int my_strcmp | ( | char const * | s1, |
char const * | s2 ) |
Compares two strings (s1) and (s2)
s1 | The first string to compare |
s2 | The second string to compare |
char * my_strcpy | ( | char * | dest, |
char const * | src ) |
Copies a string (src) and paste it on another string (dest)
dest | The destination string |
src | The source string |
n | The size of the string |
char * my_strdup | ( | const char * | src | ) |
Duplicates a string (src) and returns the new string.
src | The string to duplicate |
char ** my_strdup_word_array | ( | char ** | array | ) |
Duplicates a word array (array) and returns the new array.
array | The word array to duplicate |
const char * my_strerror | ( | int | error | ) |
Returns the error message of the error number (error)
error | The error number (errno) |
int my_strict_find_nbr | ( | char const * | str | ) |
Find the first number (number) found in a string.
str | The string to convert |
int my_strict_getnbr | ( | char const * | str | ) |
Returns an int number starting from a string number (str)
str | The string to convert |
float my_strict_getnbr_float | ( | char const * | str | ) |
Returns a float number starting from a string number (str)
str | The string to convert |
int my_strlen | ( | char const * | str | ) |
Returns the length of a string (str)
str | The string to check |
char * my_strlowcase | ( | char * | str | ) |
Replaces upcase by lowcase of a string (str)
str | The string to modify |
char * my_strncat | ( | char * | dest, |
char const * | src, | ||
int | nb ) |
Concatenates two strings (dest) and (src) with a defined size (nb)
dest | The destination string |
src | The source string |
nb | The size of the string |
int my_strncmp | ( | char const * | s1, |
char const * | s2, | ||
int | n ) |
Compares two strings (s1) and (s2) with a defined size (n)
s1 | The first string to compare |
s2 | The second string to compare |
n | The size of the strings to compare |
char * my_strncpy | ( | char * | dest, |
char const * | src, | ||
int | n ) |
Copies a string (src) and paste it on another string (dest) with a defined size (n)
dest | The destination string |
src | The source string |
n | The size of the string |
char * my_strndup | ( | const char * | src, |
int | n ) |
Duplicates a string (src) with a defined size (n) and returns the new string.
src | The string to duplicate |
n | The size of the string |
char * my_strstr | ( | char * | str, |
char const * | to_find ) |
Search a string (to_find) on another (str) and returns the address of the first occurrence.
str | The string to be scanned |
to_find | The string to search in |
char * my_strupcase | ( | char * | str | ) |
Replaces lowcase by upcase of a string (str)
str | The string to modify |
char ** my_super_array | ( | char * | str, |
char * | sep ) |
Returns an array of words delimited by a list of separator (separator) from a string (str)
str | The string to convert |
sep | The separator to use |
int my_super_number | ( | char * | number, |
number_settings_t | settings ) |
Returns an int number starting from a string number (number) and change my_errno if an error occurs depending on the settings (settings)
number | The string to convert |
settings | The settings of the function |
void my_swap | ( | int * | a, |
int * | b ) |
Swaps two integers (a) and (b)
a | The first integer |
b | The second integer |