~nloomans/ft_select

ref: 61246d56e1967072f9b87a1aa022798468dbba50 ft_select/src/error.c -rw-r--r-- 446 bytes
61246d56Noah Loomans always leave terminal in a clean state after receiving signal. 1 year, 10 months 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');
}