int main() { char t1[2]; int fd = open("main.c", O_RDONLY); char buf[9]; ft_bzero(buf, 9); ft_strcat(buf, "Ba"); ft_strcat(buf, "j"); ft_strcat(buf, "our."); printf("%s\n", buf); t1[0] = '1'; t1[1] = '\0'; printf("bzero test : %s\n", t1); printf("strlen test : %zu\n", ft_strlen("asd")); printf("strcat test : %s\n", ft_strcat(t1, "ab")); printf("isalpha test : yes %d no %d yes %d no %d\n", ft_isalpha('z'), ft_isalpha('`'), ft_isalpha('A'), ft_isalpha(125)); printf("isdigit test : yes %d no %d yes %d no %d\n", ft_isdigit('1'), ft_isdigit('/'), ft_isdigit('9'), ft_isdigit(':')); printf("isalnum test : yes %d no %d\n", ft_isalnum('1'), ft_isalnum('~')); printf("isascii test : yes %d no %d yes %d no %d\n", ft_isascii('\0'), ft_isascii(-12), ft_isascii(127), ft_isascii(200)); printf("isprint test : yes %d no %d\n", ft_isprint(32), ft_isprint(127)); printf("tolower test : A %c Z %c a %c ~ %c\n", ft_tolower('A'), ft_tolower('Z'), ft_tolower('a'), ft_tolower('~')); printf("toupper test : a %c z %c A %c ~ %c\n", ft_toupper('a'), ft_toupper('z'), ft_toupper('A'), ft_toupper('~')); ft_puts("Hello World"); ft_puts("aaa\n(null)\n"); ft_puts("aaa"); ft_puts(NULL); ft_cat(fd); return (0); }
int check_spec(const char *format, int *i, t_arg *sarg) { if (ft_strlen(sarg->spec) == 0 && ft_strchr(SPEC, ft_tolower(format[*i]))) { sarg->spec[0] = format[*i]; sarg->spec[1] = '\0'; sarg->action = define_action(SPEC, format[*i]); if (ft_isupper(format[*i]) && format[*i] != 'X') { reini_mod(sarg); sarg->spec[0] = ft_tolower(format[*i]); sarg->action = define_action(SPEC, sarg->spec[0]); } else if (format[*i] == 'p') sarg->mod.j = 1; return (1); } if (format[*i] == 'i') { sarg->spec[0] = 'd'; sarg->action = define_action(SPEC, 'd'); return (1); } return (0); }
static void ft_check_tolower(void) { int i; i = -1; while (++i < 128) printf("Value: %d, Ret: %d, char: %c, tolower: %c\n", i, ft_tolower(i), i, ft_tolower(i)); }
int ft_strcmpi(const char *s1, const char *s2) { unsigned int i; i = 0; while (s1[i] && ft_tolower(s1[i]) == ft_tolower(s2[i])) i++; return ((unsigned char)s1[i] - (unsigned char)s2[i]); }
int ask_put(char **path, int socket) { int ret; char buff[255]; char *line; int fd; struct stat st; char *size; recv(socket, buff, 1, 0); if (path[1]) { if ((fd = open(path[1], O_RDONLY)) != -1) { fstat(fd, &st); size = ft_itoa(st.st_size); send(socket, size, ft_strlen(size), 0); ft_bzero(buff, 255); while (buff[0] != 'K' && buff[0] != 'S') { ret = recv(socket, buff, 1, 0); buff[ret] = '\0'; if (buff[0] == 'Q') { ft_putendl("\033[0;1mFile already exists\033[0m"); ft_putstr("(A)bort, (R)ename, (O)verwrite ?"); get_next_line(0, &line); send(socket, line, ft_strlen(line), 0); if (line[0] == ft_tolower('a')) { close(fd); return (-1); } else if (line[0] == ft_tolower('r')) { ft_putstr("New name :"); get_next_line(0, &line); send(socket, line, ft_strlen(line), 0); } } } if (buff[0] == 'K') { while ((ret = read(fd, buff, 255)) > 0) { send(socket, buff, ret, 0); recv(socket, line, 1, 0); } close(fd); return (1); } } return (client_report(0, socket)); } return (client_report(1, socket)); }
int ft_strcasecmp(const char *s1, const char *s2) { unsigned char s1_; unsigned char s2_; s1_ = 1; s2_ = 1; while (s1_ == s2_ && s1_ != 0) { s1_ = ft_tolower(*s1++); s2_ = ft_tolower(*s2++); } return (s1_ - s2_); }
void check_tolower() { int i = 0; printf( "--------\nTest ft_tolower:\n" ); for ( i = MIN; i < MAX; i++ ) { if ( ft_tolower( i ) != tolower( i ) ) { printf("[%d] -> result: %c, expected result: %c\n", i, ft_tolower( i ), tolower( i ) ); exit( 0 ); } } printf("\033[32mOk\n\033[0m"); }
static int ft_baseconvert(char *str) { int i; int j; int color; i = 0; j = 5; color = 0; while (str[i++]) str[i - 1] = ft_tolower(str[i - 1]); i = 0; if (str[0] == '0' && str[1] == 'x') i = 2; while (j >= 0) { if (str[i] && str[i] >= 'a' && str[i] <= 'f') color += (int)((str[i] - 87) * ft_pow(16, j)); else if (str[i] && str[i] >= 'A' && str[i] <= 'F') color += (int)((str[i] - 55) * ft_pow(16, j)); else if (str[i] && str[i] >= '0' && str[i] <= '9') color += (int)((str[i] - 48) * ft_pow(16, j)); if (str[i]) i++; j--; } return (color); }
static int init_list(int ac, char **av, t_list **lst) { int i; int j; int nb; i = 0; nb = 0; *lst = NULL; while (++i < ac && (j = -1)) { while (av[i][++j]) av[i][j] = (char)ft_tolower(av[i][j]); if (ft_strcmp(av[i], "julia") == 0 && !ft_lstfind(*lst, &i, FOL_JULIA, &my_lstsrch) && !lst_add_elem(lst, FOL_JULIA, &nb)) return (-1); else if (ft_strcmp(av[i], "mandelbrot") == 0 && !ft_lstfind(*lst, &i, FOL_MANDEL, &my_lstsrch) && !lst_add_elem(lst, FOL_MANDEL, &nb)) return (-1); else if (ft_strcmp(av[i], "burning_ship") == 0 && !ft_lstfind(*lst, &i, FOL_BURNI, &my_lstsrch) && !lst_add_elem(lst, FOL_BURNI, &nb)) return (-1); } return (nb); }
int execute_command(char *user_entry, t_env **env_list, char **environ) { char *path; pid_t child; char **command; int i; i = 0; command = ft_strsplit(user_entry, ' '); while (command[i]) { command[i] = ft_strtrim(command[i]); i++; } if (builtin_commands(command[0], command, env_list)) return (1); if (!(*env_list)) return (0); if ((path = find_command(ft_tolower(command[0]), *env_list))) child = fork(); else return (0); if (child == 0) execve(path, command, environ); wait(NULL); return (1); }
int ft_atoi_b(const char *str, int base) { int s; int n; int h; h = 0; s = 1; n = 0; if (str && base > 1 && base < 17) { while ((*str >= 9 && *str <= 13) || *str == ' ') str++; if (((s = (*str == '-' ? -1 : 1)) == -1 || *str == '+') && base == 10) str++; if (base == 16 && (h = ft_ishexa((char *)str))) str += 2; h -= 2; while (ft_isdigit(*str) || h-- > 0) { if (ft_isdigit(*str)) n = n * base + (*str++ - '0'); if (base > 10 && ft_isalpha(*str)) n = n * base + (ft_tolower(*str++) - 'a' + 10); } } return (s * n); }
void ft_strlower(char *str) { while (*str) { *str = ft_tolower(*str); str++; } }
static void ft_str_to_lower_rec(char *str) { if (*str) { *str = ft_tolower(*str); return (ft_str_to_lower_rec(str + 1)); } }
void ft_strtolower(char *s) { while (*s) { *s = ft_tolower(*s); s++; } }
int ft_strlower(char *str) { while (*str) { *str = ft_tolower(*str); str++; } return (1); }
char *lower_case(char *str) { int i; i = -1; while (str[++i]) str[i] = ft_tolower(str[i]); return (str); }
void ft_strlower(char *str) { if (str == NULL) return ; while (*str != '\0') { *str = ft_tolower(*str); str++; } }
void ft_strlower(char **str) { int i; i = 0; while ((*str)[i] != '\0') { (*str)[i] = ft_tolower((*str)[i]); i++; } }
char *str_tolower(char *str) { int i = 0; while (str[i]) { str[i] = ft_tolower(str[i]); i++; } return (str); }
char *ft_convert_min(char *str, t_params *params) { LL i; i = -1; if (SARG == 'x' || SARG == 'p') { while (str[++i]) str[i] = ft_tolower(str[i]); } return (str); }
char *ft_strtolower(char *s) { char *start; start = s; while (s && *s) { *s = ft_tolower(*s); s++; } return (start); }
char *ft_strtolower(char *s) { int i; i = 0; while (s[i] != '\0') { s[i] = ft_tolower(s[i]); i++; } return (s); }
void test_tolower(void) { char str[] = "AZazFf01\n"; char *c; printf("\n\n ==========[tolower]==========\n"); c = str; while (*c) { printf("%c", ft_tolower(*c)); c++; } }
char *ft_tolowstr(char *str) { char *tmp; int i; tmp = (char *)malloc(sizeof(char) * ft_strlen(str)); i = 0; while (str[i] != '\0') { tmp[i] = ft_tolower(str[i]); i++; } return (tmp); }
void process_modifier(t_mod *m) { if (ft_strchr("DOCU", m->convers)) { UNSET(m->modif, MOD_ALL); SET(m->modif, MOD_L); m->convers = ft_tolower(m->convers); } if (m->convers == 's' && GET(m->modif, MOD_L)) { TOGGLE(m->modif, MOD_L); m->convers = 'S'; } }
char *ft_strtolower(char *s) { size_t cpt; if (!s) return (NULL); cpt = 0; while (s[cpt]) { s[cpt] = (char)ft_tolower((int)s[cpt]); cpt++; } return (s); }
char *ft_strtolower_new(const char *str) { int i; char *s; i = 0; if (!(s = ft_strdup(str))) return (NULL); while (str[i]) { s[i] = ft_tolower(str[i]); ++i; } return (s); }
char *ft_strtolower(char *str) { int i; i = 0; if (str) { while (str[i]) { str[i] = ft_tolower(str[i]); i++; } } return (str); }
char *ft_strtodowncase(char *s) { int i; i = 0; if (s) { while (s[i]) { s[i] = ft_tolower(s[i]); i++; } } return (s); }
void test_tolower(void) { char c = 'a'; char d = 'a'; char e = 'A'; char f = 'A'; char *str = "TOLOWER"; printf("\033[1;33m%s\033[0m\n", str); puts("tolower"); printf("Valeur ascii de 'a' -> %d\n", c); int i = tolower(c); printf("tolower de 'a' %d\n", i); printf("'a' vaut toujours -> %d\n", c); printf("a n'est pas devenu majuscule -> %c\n\n", c); printf("Valeur ascii de 'A' -> %d\n", e); i = tolower(e); printf("tolower de 'A' -> %d\n", i); printf("'A' vaut toujours -> %d\n", e); printf("A n'est pas devenu minuscule -> %c\n\n", e); puts("ft_tolower"); printf("Valeur ascii de 'a' -> %d\n", d); i = ft_tolower(d); printf("tolower de 'a' %d\n", i); printf("'a' vaut toujours -> %d\n", d); printf("a n'est pas devenu majuscule -> %c\n\n", d); printf("Valeur ascii de 'A' -> %d\n", f); i = ft_tolower(f); printf("tolower de 'A' -> %d\n", i); printf("'A' vaut toujours -> %d\n", f); printf("A n'est pas devenu minuscule -> %c\n\n", f); printf("tolower de 2 -> %d\n", tolower(2)); printf("ft_toupper de 2 -> %d\n", ft_tolower(2)); printf("\033[1;32m%s passed.\033[0m\n\n", str); }