ok ? Index: Makefile =================================================================== RCS file: /local/cvs/ports/wayland/havoc/Makefile,v diff -u -p -u -r1.3 Makefile --- Makefile 9 Dec 2023 22:00:43 -0000 1.3 +++ Makefile 18 Feb 2024 09:35:25 -0000 @@ -2,7 +2,7 @@ COMMENT = minimal terminal emulator for GH_ACCOUNT = ii8 GH_PROJECT = havoc -GH_TAGNAME = 0.4.0 +GH_TAGNAME = 0.5.0 REVISION = 0 CATEGORIES = wayland @@ -16,7 +16,7 @@ PERMIT_PACKAGE = Yes USE_GMAKE = Yes -BUILD_DEPENDS = wayland/wayland-protocols +BUILD_DEPENDS = wayland/wayland-protocols \ LIB_DEPENDS = devel/epoll-shim \ wayland/wayland \ Index: distinfo =================================================================== RCS file: /local/cvs/ports/wayland/havoc/distinfo,v diff -u -p -u -r1.1.1.1 distinfo --- distinfo 13 Aug 2023 09:57:13 -0000 1.1.1.1 +++ distinfo 18 Feb 2024 09:35:25 -0000 @@ -1,2 +1,2 @@ -SHA256 (havoc-0.4.0.tar.gz) = +dO1FnzPAc6SW+hm8qz0z7NyOsh4JXVXx61EGy7f33s= -SIZE (havoc-0.4.0.tar.gz) = 94878 +SHA256 (havoc-0.5.0.tar.gz) = Ow03sT48oh9eIvHmKjL+c2EZzVxgEwfEAAvtX+4Xn3c= +SIZE (havoc-0.5.0.tar.gz) = 95461 Index: patches/patch-Makefile =================================================================== RCS file: /local/cvs/ports/wayland/havoc/patches/patch-Makefile,v diff -u -p -u -r1.1.1.1 patch-Makefile --- patches/patch-Makefile 13 Aug 2023 09:57:13 -0000 1.1.1.1 +++ patches/patch-Makefile 18 Feb 2024 09:35:25 -0000 @@ -3,19 +3,19 @@ Index: Makefile +++ Makefile @@ -6,11 +6,11 @@ BINDIR ?= $(PREFIX)/bin - VERSION="0.4.0" + VERSION="0.5.0" --CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses +-CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-format-overflow +CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -I/usr/local/include -I/usr/local/include/libepoll-shim override CFLAGS += -DVERSION=\"$(VERSION)\" - VPATH=$(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell + VPATH=$(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell:$(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-decoration -LIBS=-lrt -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm +LIBS=-L/usr/local/lib -R/usr/local/lib -lm -lutil -lwayland-client -lwayland-cursor -lxkbcommon -Ltsm -lhtsm -lepoll-shim - OBJ=xdg-shell.o gtk-primary-selection.o glyph.o main.o - GEN=xdg-shell.c xdg-shell.h gtk-primary-selection.c gtk-primary-selection.h - -@@ -18,7 +18,7 @@ havoc: tsm $(OBJ) + OBJ=xdg-shell.o xdg-decoration-unstable-v1.o gtk-primary-selection.o glyph.o main.o + GEN=xdg-shell.c xdg-shell.h xdg-decoration-unstable-v1.c \ + xdg-decoration-unstable-v1.h gtk-primary-selection.c gtk-primary-selection.h +@@ -19,7 +19,7 @@ havoc: tsm $(OBJ) $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) install: havoc Index: patches/patch-havoc_cfg =================================================================== RCS file: /local/cvs/ports/wayland/havoc/patches/patch-havoc_cfg,v diff -u -p -u -r1.2 patch-havoc_cfg --- patches/patch-havoc_cfg 9 Dec 2023 22:00:43 -0000 1.2 +++ patches/patch-havoc_cfg 18 Feb 2024 09:35:25 -0000 @@ -9,7 +9,7 @@ Index: havoc.cfg [window] # opacity of background from 0 (fully transparent) to 255 (fully opaque) -@@ -11,7 +11,7 @@ margin=no +@@ -14,7 +14,7 @@ decorations=auto [terminal] # size of terminal @@ -18,7 +18,7 @@ Index: havoc.cfg columns=140 # number of lines to keep in scrollback -@@ -19,10 +19,10 @@ scrollback=1000 +@@ -22,10 +22,10 @@ scrollback=1000 [font] # height of a single glyph in pixels Index: patches/patch-main_c =================================================================== RCS file: /local/cvs/ports/wayland/havoc/patches/patch-main_c,v diff -u -p -u -r1.2 patch-main_c --- patches/patch-main_c 9 Dec 2023 22:00:43 -0000 1.2 +++ patches/patch-main_c 18 Feb 2024 09:35:25 -0000 @@ -15,7 +15,7 @@ Index: main.c #include <xkbcommon/xkbcommon-compose.h> #include <wayland-client-core.h> -@@ -182,7 +188,7 @@ static struct { +@@ -201,7 +207,7 @@ static struct { [TSM_COLOR_LIGHT_CYAN] = { 0, 255, 255 }, [TSM_COLOR_WHITE] = { 255, 255, 255 }, [TSM_COLOR_FOREGROUND] = { 229, 229, 229 }, @@ -24,7 +24,7 @@ Index: main.c }, .opt.app_id = "havoc" }; -@@ -191,7 +197,7 @@ static void wcb(struct tsm_vte *vte, const char *u8, s +@@ -210,7 +216,7 @@ static void wcb(struct tsm_vte *vte, const char *u8, s { assert(len <= PIPE_BUF); if (term.master_fd >= 0 && write(term.master_fd, u8, len) < 0) { @@ -33,7 +33,7 @@ Index: main.c abort(); } } -@@ -202,7 +208,7 @@ static void handle_display(int ev) +@@ -221,7 +227,7 @@ static void handle_display(int ev) term.die = true; } else if (ev & EPOLLIN) { if (wl_display_dispatch(term.display) < 0) { @@ -42,7 +42,7 @@ Index: main.c abort(); } } -@@ -213,22 +219,22 @@ static void handle_tty(int ev) +@@ -232,22 +238,22 @@ static void handle_tty(int ev) char data[256]; int len; @@ -73,7 +73,16 @@ Index: main.c } } -@@ -508,13 +514,13 @@ static int buffer_init(struct buffer *buf) +@@ -524,20 +530,20 @@ static int buffer_init(struct buffer *buf) + stride = term.width * 4; + buf->size = stride * term.height; + +- srand(time(NULL)); + do { +- sprintf(shm_name, "/havoc-%d", rand() % 1000000); ++ snprintf(shm_name, sizeof(shm_name), "/havoc-%d", ++ arc4random_uniform(1000000)); + fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, 0600); } while (fd < 0 && errno == EEXIST && --max); if (fd < 0) { @@ -89,7 +98,7 @@ Index: main.c close(fd); return -1; } -@@ -523,7 +529,7 @@ static int buffer_init(struct buffer *buf) +@@ -546,7 +552,7 @@ static int buffer_init(struct buffer *buf) fd, 0); if (buf->data == MAP_FAILED) { @@ -98,7 +107,7 @@ Index: main.c close(fd); return -1; } -@@ -1440,7 +1446,7 @@ static void configure(void *d, struct xdg_surface *sur +@@ -1480,7 +1486,7 @@ static void configure(void *d, struct xdg_surface *sur term.row = row; tsm_screen_resize(term.screen, col, row); if (term.master_fd >= 0 && ioctl(term.master_fd, TIOCSWINSZ, &ws) < 0) @@ -107,7 +116,7 @@ Index: main.c term.need_redraw = true; term.resize = 2; -@@ -1507,7 +1513,7 @@ static void setup_pty(char *argv[]) +@@ -1567,7 +1573,7 @@ static void setup_pty(char *argv[]) pid_t pid = forkpty(&term.master_fd, NULL, NULL, NULL); if (pid < 0) { @@ -116,7 +125,7 @@ Index: main.c exit(EXIT_FAILURE); } else if (pid == 0) { char *prog; -@@ -1519,7 +1525,7 @@ static void setup_pty(char *argv[]) +@@ -1579,7 +1585,7 @@ static void setup_pty(char *argv[]) execlp(term.cfg.shell, term.cfg.shell, (char *) NULL); prog = term.cfg.shell; } @@ -125,7 +134,7 @@ Index: main.c pause(); exit(EXIT_FAILURE); } -@@ -1717,9 +1723,9 @@ static FILE *open_config(void) +@@ -1780,9 +1786,9 @@ static FILE *open_config(void) f = fopen(term.opt.config, "r"); if (f == NULL) @@ -137,7 +146,7 @@ Index: main.c return f; } -@@ -1929,9 +1935,10 @@ retry: +@@ -1994,9 +2000,10 @@ retry: term.repeat.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC); Index: patches/patch-tsm_Makefile =================================================================== RCS file: /local/cvs/ports/wayland/havoc/patches/patch-tsm_Makefile,v diff -u -p -u -r1.1.1.1 patch-tsm_Makefile --- patches/patch-tsm_Makefile 13 Aug 2023 09:57:13 -0000 1.1.1.1 +++ patches/patch-tsm_Makefile 18 Feb 2024 09:35:25 -0000 @@ -2,7 +2,7 @@ Index: tsm/Makefile --- tsm/Makefile.orig +++ tsm/Makefile @@ -1,4 +1,5 @@ - CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses + CFLAGS ?= -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-format-overflow +CFLAGS += -I/usr/local/include OBJ=wcwidth.o shl-htable.o\ Index: patches/patch-tsm_tsm-vte_c =================================================================== RCS file: patches/patch-tsm_tsm-vte_c diff -N patches/patch-tsm_tsm-vte_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tsm_tsm-vte_c 18 Feb 2024 09:35:25 -0000 @@ -0,0 +1,15 @@ +Index: tsm/tsm-vte.c +--- tsm/tsm-vte.c.orig ++++ tsm/tsm-vte.c +@@ -439,9 +439,9 @@ static void vte_write_fnkey(struct tsm_vte *vte, bool + if (fnmod > 1) { + if (index <= 0) + index = 1; +- len = sprintf(buf, "\e[%d;%d%c", index, fnmod, c); ++ len = snprintf(buf, sizeof(buf), "\e[%d;%d%c", index, fnmod, c); + } else { +- len = sprintf(buf, "\e%c%.0d%c", ss3 ? 'O' : '[', index, c); ++ len = snprintf(buf, sizeof(buf), "\e%c%.0d%c", ss3 ? 'O' : '[', index, c); + } + vte_write(vte, buf, len); + }
-- Matthieu Herrb