Skip to content

Commit

Permalink
fixing all negative numbers at list
Browse files Browse the repository at this point in the history
  • Loading branch information
biralavor committed Jul 1, 2024
1 parent 632ecb5 commit ab37f21
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions program_to_test/src/ft_argv_validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/03 11:43:20 by umeneses #+# #+# */
/* Updated: 2024/06/28 19:05:04 by umeneses ### ########.fr */
/* Updated: 2024/07/01 10:39:25 by umeneses ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -39,12 +39,13 @@ bool ft_argv_only_nbrs_per_string(char **argv)
index = 0;
while (argv[++index] != NULL)
{
if (ft_is_sign(*(argv[index])) || ft_is_space(*(argv[index])))
continue ;
if (ft_isdigit(*(argv[index])))
{
if (ft_is_sign(*(argv[index])))
c_counter = 1;
else
c_counter = 0;
while (argv[index] && ft_isdigit(*(argv[index])))
if (ft_isdigit(*(argv[index] + c_counter)))
{
while (argv[index])
{
if (ft_is_space(*(argv[index] + c_counter))
|| (*(argv[index] + c_counter) == '\0'))
Expand Down Expand Up @@ -105,7 +106,7 @@ bool ft_argv_validation(char **argv)
{
if (!ft_argv_valid_sign_and_not_alpha(argv))
{
ft_error_msg("2..User's input must be numbers only\n");
ft_error_msg("2.User's input must be numbers only\n");
return (false);
}
if (!ft_argv_only_nbrs_per_string(argv))
Expand Down

0 comments on commit ab37f21

Please sign in to comment.