comparison src/util.c @ 0:f0372d3356b4 default tip

initial import
author Yasuri <linuxoverwindows@charliesmp.net>
date Sun, 30 Aug 2026 12:47:10 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0372d3356b4
1 #include <stdlib.h>
2
3 #include <swc.h>
4
5 #include "util.h"
6 #include "yawc.h"
7
8 void die(int ret, const char* fmt, ...)
9 {
10 va_list ap;
11
12 fprintf(stderr, "tohu: ");
13
14 va_start(ap, fmt);
15 vfprintf(stderr, fmt, ap);
16 va_end(ap);
17
18 fputc('\n', stderr);
19 fflush(stderr);
20
21 exit(ret);
22 }
23
24 void _log(FILE* fd, const char* fmt, ...)
25 {
26 va_list ap;
27
28 fprintf(fd, "tohu: ");
29
30 va_start(ap, fmt);
31 vfprintf(fd, fmt, ap);
32 va_end(ap);
33
34 fputc('\n', fd);
35 fflush(fd);
36 }
37
38 void sig_handler(int s)
39 {
40 (void)s;
41
42 if (wm.dpy)
43 wl_display_terminate(wm.dpy);
44 }