-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalysis_heredoc_utils.c
More file actions
executable file
·36 lines (32 loc) · 1.17 KB
/
analysis_heredoc_utils.c
File metadata and controls
executable file
·36 lines (32 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* analysis_heredoc_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hyeyeom <hyeyeom@42student.gyeongsan.kr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/23 17:08:55 by yuhyoon #+# #+# */
/* Updated: 2025/04/14 00:38:35 by hyeyeom ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void restore_terminal(void)
{
int tty_fd;
char *tty_path;
tty_path = ttyname(0);
if (tty_path)
{
tty_fd = open(tty_path, O_RDWR);
if (tty_fd != -1)
{
dup2(tty_fd, 0);
close(tty_fd);
}
}
}
void close_fd(int fd)
{
if (close(fd) == -1)
exit(EXIT_FAILURE);
}