Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef SRC_S21_STRING_H_
- #define SRC_S21_STRING_H_
- #ifndef s21_NULL
- #define s21_NULL ((void *)0)
- #endif // s21_NULL
- #include <stdio.h>
- #include <stdarg.h>
- typedef unsigned long s21_size_t;
- typedef struct parcer_params {
- char flag[6];
- int width;
- int accur;
- char lenght;
- char specif;
- int width_arg_flag;
- int accur_arg_flag;
- int size_format;
- int spec_pos;
- } parcer_t;
- typedef struct int_types {
- long *ld;
- int *d;
- short *h;
- unsigned long *lu;
- unsigned *u;
- unsigned short *hu;
- } int_type;
- typedef struct double_types {
- float *f;
- double *doub;
- long double *l_doub;
- } double_type;
- void *s21_memchr(const void *str, int c, s21_size_t n);
- int s21_memcmp(const void *str1, const void *str2, s21_size_t n);
- void *s21_memcpy(void *dest, const void *src, s21_size_t n);
- void *s21_memmove(void *dest, const void *src, s21_size_t n);
- void *s21_memset(void *str, int c, s21_size_t n);
- char *s21_strcat(char *dest, const char *src);
- char *s21_strncat(char *dest, const char *src, s21_size_t n);
- char* s21_strchr(const char *str, int c);
- int s21_strcmp(const char *str1, const char *str2);
- int s21_strncmp(const char *str1, const char *str2, s21_size_t n);
- char *s21_strcpy(char *dest, const char *src);
- char *s21_strncpy(char *dest, const char *src, s21_size_t n);
- s21_size_t s21_strcspn(const char *str1, const char *str2);
- s21_size_t s21_strlen(const char *str);
- char *s21_strpbrk(const char *str1, const char *str2);
- char *s21_strrchr(const char *str, int c);
- s21_size_t s21_strspn(const char *str1, const char *str2);
- char *s21_strstr(const char *haystack, const char *needle);
- char *s21_strtok(char *str, const char *delim);
- void *s21_to_upper(const char *str);
- void *s21_to_lower(const char *str);
- void *s21_insert(const char *src, const char *str, s21_size_t start_index);
- int s21_sscanf(const char *str, const char *format, ...);
- int s21_sprintf(char *str, const char *format, ...);
- void check_ch(parcer_t *spec, char *str, int ch);
- int int_to_str(char *str, long int d);
- int str_to_int(char *str, int size);
- void test_output(int counter, int counter_buff, const char *format, char *str);
- int check(int counter, const char *str, const char *refer, int ref_point_p);
- int parcer(const char *format, parcer_t *spec);
- void search_spec(int *counter_buff,
- int *counter,
- const char *format,
- char *refer,
- char *str,
- int ref_point_p);
- int float_e_to_str(parcer_t *spec, long double e, char *str, char specif);
- void g_to_str(parcer_t *spec, char *str, va_list temp);
- void d_to_str(char *out1, parcer_t *spec, long int d);
- long int stepen(long int b);
- int dig_counter(long int d);
- void get_zero(char *out, int *ii, int stop);
- void int_to_oct_hex_str(parcer_t *spec, long long int d, char *str, int n);
- void pnt_to_str(parcer_t *spec, long long int int_p, char *str);
- void str_to_res_str(parcer_t *spec, char *arg_str, char *str);
- void clean_str(char *str, int size_str);
- void sscanf_str_to_res(parcer_t *spec, char *src, va_list list_args);
- void hex_oct_str_to_int(parcer_t *spec, char *buff, va_list list_args);
- void hex_oct_dec_convert(char* buff, int size, parcer_t *spec, va_list list_args, int s_s);
- void str_to_float(char *buff, int size, long double *f_arg);
- void str_to_ch(char *buff, parcer_t *spec, va_list list_arg);
- int check_sign(char **str, int* size);
- void double_arg_to_str(char* buff, int size, parcer_t *spec, va_list list_args);
- char *s21_strerror(int errnum);
- static char *ErrorNames1[] = {
- "Undefined error: 0",
- "Operation not permitted",
- "No such file or directory",
- "No such process",
- "Interrupted system call",
- "Input/output error",
- "Device not configured",
- "Argument list too long",
- "Exec format error",
- "Bad file descriptor",
- "No child processes",
- "Resource deadlock avoided",
- "Cannot allocate memory",
- "Permission denied",
- "Bad address",
- "Block device required",
- "Resource busy",
- "File exists",
- "Cross-device link",
- "Operation not supported by device",
- "Not a directory",
- "Is a directory",
- "Invalid argument",
- "Too many open files in system",
- "Too many open files",
- "Inappropriate ioctl for device",
- "Text file busy",
- "File too large",
- "No space left on device",
- "Illegal seek",
- "Read-only file system",
- "Too many links",
- "Broken pipe",
- "Numerical argument out of domain",
- "Result too large",
- "Resource temporarily unavailable",
- "Operation now in progress",
- "Operation already in progress",
- "Socket operation on non-socket",
- "Destination address required",
- "Message too long",
- "Protocol wrong type for socket",
- "Protocol not available",
- "Protocol not supported",
- "Socket type not supported",
- "Operation not supported",
- "Protocol family not supported",
- "Address family not supported by protocol family",
- "Address already in use",
- "Can't assign requested address",
- "Network is down",
- "Network is unreachable",
- "Network dropped connection on reset",
- "Software caused connection abort",
- "Connection reset by peer",
- "No buffer space available",
- "Socket is already connected",
- "Socket is not connected",
- "Can't send after socket shutdown",
- "Too many references: can't splice",
- "Operation timed out",
- "Connection refused",
- "Too many levels of symbolic links",
- "File name too long",
- "Host is down",
- "No route to host",
- "Directory not empty",
- "Too many processes",
- "Too many users",
- "Disc quota exceeded",
- "Stale NFS file handle",
- "Too many levels of remote in path",
- "RPC struct is bad",
- "RPC version wrong",
- "RPC prog. not avail",
- "Program version wrong",
- "Bad procedure for program",
- "No locks available",
- "Function not implemented",
- "Inappropriate file type or format",
- "Authentication error",
- "Need authenticator",
- "Device power is off",
- "Device error",
- "Value too large to be stored in data type",
- "Bad executable (or shared library)",
- "Bad CPU type in executable",
- "Shared library version mismatch",
- "Malformed Mach-o file",
- "Operation canceled",
- "Identifier removed",
- "No message of desired type",
- "Illegal byte sequence",
- "Attribute not found",
- "Bad message",
- "EMULTIHOP (Reserved)",
- "No message available on STREAM",
- "ENOLINK (Reserved)",
- "No STREAM resources",
- "Not a STREAM",
- "Protocol error",
- "STREAM ioctl timeout",
- "Operation not supported on socket",
- "Policy not found",
- "State not recoverable",
- "Previous owner died",
- "Interface output queue is full",
- "Unknown error: 107"
- };
- char *s21_strerror(int errnum);
- static char *ErrorNames[] = {
- "No error information",
- "Operation not permitted",
- "No such file or directory",
- "No such process",
- "Interrupted system call",
- "I/O error",
- "No such device or address",
- "Argument list too long",
- "Exec format error",
- "Bad file descriptor",
- "No child process",
- "Resource temporarily unavailable",
- "Out of memory",
- "Permission denied",
- "Bad address",
- "Block device required",
- "Resource busy",
- "File exists",
- "Cross-device link",
- "No such device",
- "Not a directory",
- "Is a directory",
- "Invalid argument",
- "Too many open files in system",
- "No file descriptors available",
- "Not a tty",
- "Text file busy",
- "File too large",
- "No space left on device",
- "Invalid seek",
- "Read-only file system",
- "Too many links",
- "Broken pipe",
- "Domain error",
- "Result not representable",
- "Resource deadlock would occur",
- "Filename too long",
- "No locks available",
- "Function not implemented",
- "Directory not empty",
- "Symbolic link loop",
- "No error information",
- "No message of desired type",
- "Identifier removed",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "Device not a stream",
- "No data available",
- "Device timeout",
- "Out of streams resources",
- "No error information",
- "No error information",
- "No error information",
- "Link has been severed",
- "No error information",
- "No error information",
- "No error information",
- "Protocol error",
- "Multihop attempted",
- "No error information",
- "Bad message",
- "Value too large for data type",
- "No error information",
- "File descriptor in bad state",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "Illegal byte sequence",
- "No error information",
- "No error information",
- "No error information",
- "Not a socket",
- "Destination address required",
- "Message too large",
- "Protocol wrong type for socket",
- "Protocol not available",
- "Protocol not supported",
- "Socket type not supported",
- "Not supported",
- "Protocol family not supported",
- "Address family not supported by protocol",
- "Address in use",
- "Address not available",
- "Network is down",
- "Network unreachable",
- "Connection reset by network",
- "Connection aborted",
- "Connection reset by peer",
- "No buffer space available",
- "Socket is connected",
- "Socket not connected",
- "Cannot send after socket shutdown",
- "No error information",
- "Operation timed out",
- "Connection refused",
- "Host is down",
- "Host is unreachable",
- "Operation already in progress",
- "Operation in progress",
- "Stale file handle",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "Remote I/O error",
- "Quota exceeded",
- "No medium found",
- "Wrong medium type",
- "Operation canceled",
- "No error information",
- "No error information",
- "No error information",
- "No error information",
- "Previous owner died",
- "State not recoverable",
- "No error information",
- };
- #endif // SRC_S21_STRING_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement