Skip to content

Commit 61ef9fd

Browse files
itisluLeaYeh
authored andcommitted
style: Add macro for max input retries
1 parent aa67063 commit 61ef9fd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/defines.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@
115115
# define PT_ROW_NUM 192
116116
# define UNDEFINED_STATE -1
117117

118+
/* User Input */
119+
# define MAX_INPUT_RETRIES 5
120+
118121
/* Export */
119122
# define EXPORT_PREFIX "export "
120123

source/utils/user_input_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static bool limit_retries(t_sh *shell, bool success)
5555
retries = 0;
5656
return (true);
5757
}
58-
else if (++retries > 5)
58+
else if (++retries > MAX_INPUT_RETRIES)
5959
clean_and_exit_shell(shell, GENERAL_ERROR, "read input failed");
6060
print_error("%s: read input failed, trying again...\n", PROGRAM_NAME);
6161
return (false);

0 commit comments

Comments
 (0)