ports/editors/mg/files/patch-main.c
Mark Willson b47b76304c editors/mg: Update to OpenBSD 7.4 version; modify location of source tarball
Changes in this release:

  * New command set-tab-width to change the tabulator width on a per-buffer
    basis.
  * Let the space-to-tabstop command move to the right position even if
    the line contains tabs, control characters, or non-ASCII bytes.
  * Fall back to /bin/sh if $SHELL is undefined.
  * Fix parsing of tag files with duplicate entries. Instead of erroring
    out, ignore duplicates. Fixes using /var/db/libc.tags again.
  * Change the visit-tags-table command to immediately load the tag
    file, and drop the lazy mechanics.
  * Do not leak memory in pop-tag-mark if it fails to switch buffers.
  * Fix a read buffer overrun caused by -u arguments longer than 1023 bytes.
  * Fix a write buffer overrun on the stack caused by blink-and-insert
    matching a very long line that is not currently visible in the
    window.
  * Skip checking permissions of conffile with access(2).
  * Resurrect no-tab-mode and add it to the list of modes that can be
    set with set-default-mode.

From: https://www.openbsd.org/74.html

PR:		274611
2023-10-27 02:32:10 -04:00

47 lines
1.1 KiB
C

--- main.c.orig 2023-10-20 07:56:18 UTC
+++ main.c
@@ -16,7 +16,7 @@
#include <string.h>
#include <termios.h>
#include <unistd.h>
-#include <util.h>
+#include <libutil.h>
#include "def.h"
#include "kbd.h"
@@ -43,6 +43,10 @@ struct mgwin *wheadp; /* MGWIN listhead */
struct vhead varhead; /* Variable list head */
char pat[NPAT]; /* pattern */
+#ifndef __dead
+#define __dead __attribute__ ((__noreturn__))
+#endif
+
static void edinit(struct buffer *);
static void pty_init(void);
static __dead void usage(void);
@@ -71,10 +75,6 @@ main(int argc, char **argv)
int nobackups = 0;
struct buffer *bp = NULL;
- if (pledge("stdio rpath wpath cpath fattr chown getpw tty proc exec",
- NULL) == -1)
- err(1, "pledge");
-
while ((o = getopt(argc, argv, "nRb:f:u:")) != -1)
switch (o) {
case 'b':
@@ -167,9 +167,11 @@ main(int argc, char **argv)
ffclose(ffp, NULL);
}
- if (batch)
+ if (batch) {
+ vttidy();
return (0);
-
+ }
+
/*
* Now ensure any default buffer modes from the startup file are
* given to any files opened when parsing the startup file.