~nloomans/ft_select

ref: 1d90313037b5c7d0545be79e58d8f50a102501ff ft_select/src/error.c -rw-r--r-- 446 bytes
1d903130Noah Loomans handle CTRL+Z and fg 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <ft_printf.h>
#include "error.h"

t_error         errorf(char *fmt, ...)
{
	va_list		vlist;
	ssize_t		ret;
    t_error     dest;

	va_start(vlist, fmt);
	ret = ft_vsnprintf(dest.msg, sizeof(dest.msg), fmt, vlist);
	va_end(vlist);
    if (ret == -1)
        return ((t_error){
			.msg = "an error occoured during the generation of this errror" });
    return (dest);
}

bool			is_error(t_error error)
{
		return (error.msg[0] != '\0');
}