Skip to content

Commit

Permalink
fix more new line
Browse files Browse the repository at this point in the history
  • Loading branch information
maqamylee0 committed Apr 28, 2023
1 parent c13f554 commit bfe8a47
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
Binary file modified hsh
Binary file not shown.
31 changes: 18 additions & 13 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,27 @@ void run_non_interactive_mode(int argc, char **argv, char **envp)
nchars_read = _getline(&input, &n, stdin);
while (nchars_read != -1)
{
input[nchars_read - 1] = '\0';
input_cpy = allocate(nchars_read);
_strcpy(input_cpy, input);
if (has_space(input) == 1)
if (*input != '\n')
{
input[nchars_read - 1] = '\0';
input_cpy = allocate(nchars_read);
_strcpy(input_cpy, input);
if (has_space(input) == 1)
{
free(input_cpy);
exit(0);
}
argv = parse_input(input, delim, &argc);
argc = num_token(input_cpy, delim);
check_argv(argv, env, input, input_cpy);
execute(argv, env);
free(input_cpy);
exit(0);
free(input);
cleanup(argv);
nchars_read = _getline(&input, &n, stdin);
}
argv = parse_input(input, delim, &argc);
argc = num_token(input_cpy, delim);
check_argv(argv, env, input, input_cpy);
execute(argv, env);
free(input_cpy);
free(input);
cleanup(argv);
nchars_read = _getline(&input, &n, stdin);
else
nchars_read = _getline(&input, &n, stdin);
}
}

Expand Down

0 comments on commit bfe8a47

Please sign in to comment.