Compare commits
No commits in common. "f0bc88b8ecb1c6c01c6404cb4bdaf17b8a6373ca" and "a31f44d55294d105a74294f57f1e70d830be2ec6" have entirely different histories.
f0bc88b8ec
...
a31f44d552
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_utils.c :+: :+: :+: */
|
||||
/* utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/02 21:56:30 by achubuko #+# #+# */
|
||||
/* Updated: 2023/12/03 18:07:15 by achubuko ### ########.fr */
|
||||
/* Updated: 2023/12/02 23:45:23 by achubuko ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "ft_utils.h"
|
||||
@ -25,21 +25,3 @@ size_t ft_strlen(char *s)
|
||||
l++;
|
||||
return (l);
|
||||
}
|
||||
|
||||
int ft_str_is_numeric(char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (str[i] == '\0')
|
||||
return (0);
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
if (str[i] < '0' || str[i] > '9')
|
||||
return (0);
|
||||
i++;
|
||||
}
|
||||
if (str[0] == '-')
|
||||
return (-1);
|
||||
return (1);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/02 21:57:06 by achubuko #+# #+# */
|
||||
/* Updated: 2023/12/03 18:08:38 by achubuko ### ########.fr */
|
||||
/* Updated: 2023/12/02 23:04:09 by achubuko ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#ifndef FT_UTILS_H
|
||||
@ -16,5 +16,4 @@
|
||||
|
||||
uint32_t ft_atoui32(char *str);
|
||||
size_t ft_strlen(char *s);
|
||||
int ft_str_is_numeric(char *str);
|
||||
#endif
|
||||
|
17
ex00/main.c
17
ex00/main.c
@ -6,7 +6,7 @@
|
||||
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/12/02 21:01:21 by achubuko #+# #+# */
|
||||
/* Updated: 2023/12/03 18:09:34 by achubuko ### ########.fr */
|
||||
/* Updated: 2023/12/02 23:45:57 by achubuko ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
#include "main.h"
|
||||
@ -18,18 +18,5 @@ int main(int argc, char **argv)
|
||||
write(1, "Error: program requires 1 or 2 arguments passed!", 48);
|
||||
return (1);
|
||||
}
|
||||
if (ft_str_is_numeric(argv[1]) == 1)
|
||||
{
|
||||
print_digit_words(argv[1]);
|
||||
}
|
||||
else if (ft_str_is_numeric(argv[1]) == -1)
|
||||
{
|
||||
write(1, "Argument #1 must be positive!", 28);
|
||||
return (2);
|
||||
}
|
||||
else
|
||||
{
|
||||
write(1, "Argument #1 must be a number!", 28);
|
||||
return (3);
|
||||
}
|
||||
write(1, argv[1], ft_strlen(argv[1]));
|
||||
}
|
||||
|
Reference in New Issue
Block a user