Skip to content

Commit

Permalink
style: Add macro for max input retries
Browse files Browse the repository at this point in the history
  • Loading branch information
itislu authored and LeaYeh committed Aug 13, 2024
1 parent aa67063 commit 61ef9fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
# define PT_ROW_NUM 192
# define UNDEFINED_STATE -1

/* User Input */
# define MAX_INPUT_RETRIES 5

/* Export */
# define EXPORT_PREFIX "export "

Expand Down
2 changes: 1 addition & 1 deletion source/utils/user_input_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static bool limit_retries(t_sh *shell, bool success)
retries = 0;
return (true);
}
else if (++retries > 5)
else if (++retries > MAX_INPUT_RETRIES)
clean_and_exit_shell(shell, GENERAL_ERROR, "read input failed");
print_error("%s: read input failed, trying again...\n", PROGRAM_NAME);
return (false);
Expand Down

0 comments on commit 61ef9fd

Please sign in to comment.