-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprint_utils.c
56 lines (49 loc) · 1.48 KB
/
print_utils.c
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* :::::::: */
/* print_utils.c :+: :+: */
/* +:+ */
/* By: daniel <[email protected]> +#+ */
/* +#+ */
/* Created: 2021/12/24 10:32:13 by daniel #+# #+# */
/* Updated: 2022/01/24 14:37:45 by dnoom ######## odam.nl */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include "minishell.h"
#include "./Libft/libft.h"
void print_parts(t_part *parts)
{
int i;
i = 0;
while (parts[i].part)
{
printf("-%s- type: %d\n", parts[i].part, parts[i].type);
i++;
}
printf("\n");
}
void print_strs(char **strs)
{
int i;
i = 0;
while (strs[i])
{
perror(strs[i]);
i++;
}
}
void ft_print_line_nr(int line_nr)
{
ft_putstr_fd(": line ", 2);
ft_putnbr_fd(line_nr, 2);
ft_putstr_fd(": ", 2);
}
void ft_print_shell_line(t_env *s_env)
{
ft_putstr_fd(SHELL_NAME, 2);
if (isatty(s_env->term_in))
ft_putstr_fd(": ", 2);
else
ft_print_line_nr(s_env->line_nr);
}