36 lines
1.3 KiB
C
36 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* rush-02.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/12/02 21:01:21 by achubuko #+# #+# */
|
|
/* Updated: 2023/12/03 18:09:34 by achubuko ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "main.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc <= 1 || argc > 3)
|
|
{
|
|
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);
|
|
}
|
|
}
|