diff --git a/editors/mg/Makefile b/editors/mg/Makefile index 8b34f3985b7d..d9991f00f550 100644 --- a/editors/mg/Makefile +++ b/editors/mg/Makefile @@ -1,45 +1,46 @@ PORTNAME= mg -DISTVERSION= 20241008 +DISTVERSION= 20260519 PORTEPOCH= 1 CATEGORIES= editors MASTER_SITES= https://hydrus.org.uk/downloads/ MAINTAINER= cdr.nil@gmail.com COMMENT= Small, fast Emacs-like editor WWW= https://man.openbsd.org/mg LICENSE= PD FLAVORS= dynamic static FLAVOR?= ${FLAVORS:[1]} static_PKGNAMESUFFIX= -static USES= ncurses uidfix .if ${FLAVOR} == static COMMENT+= (rescue(8) version) MAKE_ARGS+= NO_SHARED=yes PLIST_FILES= /rescue/mg .else PLIST_FILES= bin/mg \ share/man/man1/mg.1.gz PORTDOCS= README tutorial OPTIONS_DEFINE= DOCS .endif MAKE_ARGS+= BINDIR=${PREFIX}/bin \ + DISTVERSION=${DISTVERSION} \ MANDIR=${PREFIX}/share/man/man \ NCURSESINC=${NCURSESINC} \ NCURSESLIB=${NCURSESLIB} .if ${FLAVOR} == static do-install: @${MKDIR} ${STAGEDIR}/rescue ${INSTALL_PROGRAM} ${WRKSRC}/mg ${STAGEDIR}/rescue .else post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR} .endif .include diff --git a/editors/mg/distinfo b/editors/mg/distinfo index cc1097eb12b9..84da42a83a77 100644 --- a/editors/mg/distinfo +++ b/editors/mg/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1728587995 -SHA256 (mg-20241008.tar.gz) = 56a1caf883ab968dd4c6a2d13cf56232d392e834b9cfaf2dd2f4d3b6cf26db75 -SIZE (mg-20241008.tar.gz) = 154865 +TIMESTAMP = 1779272952 +SHA256 (mg-20260519.tar.gz) = adf632f9e5009a29114122266b8c78350692e31a162476584c2ee043568e5da7 +SIZE (mg-20260519.tar.gz) = 154901 diff --git a/editors/mg/files/patch-Makefile b/editors/mg/files/patch-Makefile index 2b36c667ada6..7c31d30d9149 100644 --- a/editors/mg/files/patch-Makefile +++ b/editors/mg/files/patch-Makefile @@ -1,12 +1,22 @@ ---- Makefile.orig 2023-10-22 13:42:02 UTC +--- Makefile.orig 2019-07-18 05:57:48 UTC +++ Makefile -@@ -29,9 +29,4 @@ SRCS+= cmode.c cscope.c dired.c grep.c interpreter.c t +@@ -11,7 +11,7 @@ DPADD+= ${LIBCURSES} ${LIBUTIL} + # STARTUPFILE -- look for and handle initialization file. + # MGLOG -- debug mg internals to a log file. # - #SRCS+= log.c +-CFLAGS+=-Wall -DREGEX ++CFLAGS+=-Wall -DREGEX -DVERSION=\"${DISTVERSION}\" + SRCS= autoexec.c basic.c bell.c buffer.c cinfo.c dir.c display.c \ + echo.c extend.c file.c fileio.c funmap.c help.c kbd.c keymap.c \ +@@ -28,10 +28,5 @@ SRCS+= cmode.c cscope.c dired.c grep.c interpreter.c t + # -DMGLOG source file. + # + #SRCS+= log.c +- -afterinstall: - ${INSTALL} -d -o root -g wheel ${DESTDIR}${DOCDIR}/mg - ${INSTALL} ${INSTALL_COPY} -o ${DOCOWN} -g ${DOCGRP} -m ${DOCMODE} \ - ${.CURDIR}/tutorial ${DESTDIR}${DOCDIR}/mg -- + .include diff --git a/editors/mg/files/patch-fileio.c b/editors/mg/files/patch-fileio.c index 94d8a5ba0ac5..f04cab0d1a27 100644 --- a/editors/mg/files/patch-fileio.c +++ b/editors/mg/files/patch-fileio.c @@ -1,19 +1,19 @@ ---- fileio.c.orig 2023-10-22 13:42:02 UTC +--- fileio.c.orig 2026-05-19 14:58:49 UTC +++ fileio.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "def.h" #include "kbd.h" -@@ -705,7 +706,7 @@ expandtilde(const char *fn) +@@ -703,7 +704,7 @@ expandtilde(const char *fn) struct passwd *pw; struct stat statbuf; const char *cp; - char user[LOGIN_NAME_MAX], path[NFILEN]; + char user[MAXLOGNAME], path[NFILEN]; char *ret; size_t ulen, plen; diff --git a/editors/mg/files/patch-re__search.c b/editors/mg/files/patch-re__search.c new file mode 100644 index 000000000000..fe4b9cc34d43 --- /dev/null +++ b/editors/mg/files/patch-re__search.c @@ -0,0 +1,33 @@ +--- re_search.c.orig 2026-05-20 10:30:42 UTC ++++ re_search.c +@@ -146,6 +146,10 @@ re_queryrepl(int f, int n) + return (ABORT); + ewprintf("Query replacing %s with %s:", re_pat, news); + ++ /* If dot on empty line, suppress line forward in re_forwsrch */ ++ if (curwp->w_doto == 0 && curwp->w_dotp->l_used == 0) ++ curwp->w_doto = -1; ++ + /* + * Search forward repeatedly, checking each time whether to insert + * or not. The "!" case makes the check always true, so it gets put +@@ -222,6 +226,9 @@ re_repl(int f, int n) + EFNUL | EFNEW | EFCR, re_pat) == NULL) + return (ABORT); + ++ /* If dot on empty line, suppress line forward in re_forwsrch */ ++ if (curwp->w_doto == 0 && curwp->w_dotp->l_used == 0) ++ curwp->w_doto = -1; + while (re_forwsrch() == TRUE) { + plen = regex_match[0].rm_eo - regex_match[0].rm_so; + if (re_doreplace((RSIZE)plen, news) == FALSE) +@@ -353,6 +360,9 @@ re_forwsrch(void) + tdotline++; + tbo = 0; + } ++ if (tbo < 0) ++ /* line forward was suppressed */ ++ tbo = 0; + /* + * Note this loop does not process the last line, but this editor + * always makes the last line empty so this is good. diff --git a/editors/mg/files/patch-re_search.c b/editors/mg/files/patch-re_search.c deleted file mode 100644 index a37c830b014a..000000000000 --- a/editors/mg/files/patch-re_search.c +++ /dev/null @@ -1,15 +0,0 @@ ---- re_search.c.orig 2024-04-06 09:29:51 UTC -+++ re_search.c -@@ -342,10 +342,9 @@ re_forwsrch(void) - if (tbo == clp->l_used) - /* - * Don't start matching past end of line -- must move to -- * beginning of next line, unless line is empty or at -- * end of file. -+ * beginning of next line, unless at end of file. - */ -- if (clp != curbp->b_headp && llength(clp) != 0) { -+ if (clp != curbp->b_headp) { - clp = lforw(clp); - tdotline++; - tbo = 0; diff --git a/editors/mg/files/patch-version.c b/editors/mg/files/patch-version.c index 9c4d4ca3136d..a17922d7eac1 100644 --- a/editors/mg/files/patch-version.c +++ b/editors/mg/files/patch-version.c @@ -1,11 +1,14 @@ ---- version.c.orig 2024-10-10 16:12:07 UTC +--- version.c.orig 2023-03-08 04:43:11 UTC +++ version.c -@@ -13,7 +13,7 @@ +@@ -13,7 +13,11 @@ #include "def.h" --const char version[] = "Mg 2a"; -+const char version[] = "Mg 2a (20241008)"; ++#ifdef VERSION ++const char version[] = "Mg 2a (" VERSION ")"; ++#else + const char version[] = "Mg 2a"; ++#endif /* * Display the version. All this does diff --git a/editors/mg/files/patch-word.c b/editors/mg/files/patch-word.c new file mode 100644 index 000000000000..6853441519c7 --- /dev/null +++ b/editors/mg/files/patch-word.c @@ -0,0 +1,17 @@ +--- word.c.orig 2026-05-20 15:03:11 UTC ++++ word.c +@@ -209,12 +209,13 @@ grabword(char **word) + + while (inword() == TRUE) { + if (cap == 0 || len == cap - 1) { +- t = recallocarray(*word, cap, cap + 8, 1); ++ t = realloc(*word, cap + 8); + if (t == NULL) { + free(*word); + *word = NULL; + return (errno); + } ++ memset(t + cap, 0, 8); + cap += 8; + *word = t; + }