Codebase list mg / cec9edf8-2bd2-4c0b-bbe9-38549a5ad8a2/upstream
Import upstream version 20220212+git20220331.1.b3c0b47 Debian Janitor 2 years ago
14 changed file(s) with 169 addition(s) and 76 deletion(s). Raw diff Collapse all Expand all
00 packages
11 *.o
22 mg
3 mg-static/mg-*
0 /tags.c/1.16/Result of merge//
10 /undo.c/1.58/Tue Apr 10 04:57:08 2018//
21 /Makefile/1.35/Result of merge//
32 /fileio.c/1.108/Result of merge//
43 /region.c/1.39/Result of merge//
5 /README/1.14/Wed Apr 14 01:24:37 2021//
6 /basic.c/1.50/Wed Apr 14 01:24:37 2021//
7 /buffer.c/1.112/Wed Apr 14 01:24:42 2021//
8 /chrdef.h/1.10/Wed Apr 14 01:24:37 2021//
9 /cinfo.c/1.18/Wed Apr 14 01:24:37 2021//
10 /cmode.c/1.17/Wed Apr 14 01:24:37 2021//
11 /cscope.c/1.20/Wed Apr 14 01:24:37 2021//
12 /dir.c/1.31/Wed Apr 14 01:24:37 2021//
13 /display.c/1.48/Wed Apr 14 01:24:37 2021//
14 /echo.c/1.68/Wed Apr 14 01:24:37 2021//
15 /file.c/1.102/Wed Apr 14 01:24:37 2021//
16 /funmap.h/1.8/Wed Apr 14 01:24:37 2021//
17 /grep.c/1.49/Wed Apr 14 01:24:37 2021//
18 /help.c/1.35/Wed Apr 14 01:24:37 2021//
19 /kbd.c/1.35/Wed Apr 14 01:24:37 2021//
20 /kbd.h/1.19/Wed Apr 14 01:24:37 2021//
21 /key.h/1.6/Wed Apr 14 01:24:37 2021//
22 /line.c/1.63/Wed Apr 14 01:24:37 2021//
23 /log.c/1.12/Wed Apr 14 01:24:37 2021//
24 /log.h/1.6/Wed Apr 14 01:24:37 2021//
25 /macro.c/1.16/Wed Apr 14 01:24:37 2021//
26 /macro.h/1.7/Wed Apr 14 01:24:37 2021//
27 /match.c/1.22/Wed Apr 14 01:24:37 2021//
28 /modes.c/1.21/Wed Apr 14 01:24:37 2021//
29 /paragraph.c/1.46/Wed Apr 14 01:24:37 2021//
30 /pathnames.h/1.1/Wed Apr 14 01:24:37 2021//
31 /search.c/1.47/Wed Apr 14 01:24:37 2021//
32 /spawn.c/1.12/Wed Apr 14 01:24:37 2021//
33 /tty.c/1.39/Wed Apr 14 01:24:42 2021//
344 /ttyio.c/1.40/Result of merge//
35 /ttykbd.c/1.20/Wed Apr 14 01:24:37 2021//
36 /tutorial/1.18/Wed Apr 14 01:24:37 2021//
37 /util.c/1.43/Wed Apr 14 01:24:37 2021//
38 /version.c/1.10/Wed Apr 14 01:24:37 2021//
39 /window.c/1.36/Wed Apr 14 01:24:37 2021//
40 /word.c/1.19/Wed Apr 14 01:24:37 2021//
41 /yank.c/1.15/Wed Apr 14 01:24:37 2021//
42 /autoexec.c/1.18/Sun May 16 16:01:23 2021//
43 /bell.c/1.6/Sun May 16 16:01:23 2021//
445 /def.h/1.176/Result of merge//
456 /dired.c/1.100/Result of merge//
46 /extend.c/1.75/Sun May 16 16:01:23 2021//
47 /funmap.c/1.63/Sun May 16 16:01:23 2021//
48 /interpreter.c/1.32/Sun May 16 16:01:23 2021//
49 /keymap.c/1.59/Sun May 16 16:01:23 2021//
507 /main.c/1.90/Result of merge//
51 /mg.1/1.125/Sun May 16 16:01:24 2021//
528 /re_search.c/1.36/Result of merge//
9 /README/1.14/Sun Aug 1 20:42:15 2021//
10 /chrdef.h/1.10/Sun Aug 1 20:42:15 2021//
11 /cinfo.c/1.18/Sun Aug 1 20:42:15 2021//
12 /cmode.c/1.17/Sun Aug 1 20:42:15 2021//
13 /display.c/1.48/Sun Aug 1 20:42:15 2021//
14 /extend.c/1.75/Sun Aug 1 20:42:15 2021//
15 /file.c/1.102/Sun Aug 1 20:42:15 2021//
16 /funmap.h/1.8/Sun Aug 1 20:42:15 2021//
17 /kbd.h/1.19/Sun Aug 1 20:42:15 2021//
18 /key.h/1.6/Sun Aug 1 20:42:15 2021//
19 /macro.c/1.16/Sun Aug 1 20:42:15 2021//
20 /macro.h/1.7/Sun Aug 1 20:42:15 2021//
21 /modes.c/1.21/Sun Aug 1 20:42:15 2021//
22 /paragraph.c/1.46/Sun Aug 1 20:42:15 2021//
23 /pathnames.h/1.1/Sun Aug 1 20:42:15 2021//
24 /search.c/1.47/Sun Aug 1 20:42:15 2021//
25 /spawn.c/1.12/Sun Aug 1 20:42:15 2021//
26 /tutorial/1.18/Sun Aug 1 20:42:15 2021//
27 /version.c/1.10/Sun Aug 1 20:42:15 2021//
28 /window.c/1.36/Sun Aug 1 20:42:15 2021//
29 /word.c/1.19/Sun Aug 1 20:42:15 2021//
30 /autoexec.c/1.18/Sun Nov 21 22:19:09 2021//
31 /basic.c/1.50/Sun Nov 21 22:19:09 2021//
32 /bell.c/1.6/Sun Nov 21 22:19:09 2021//
33 /buffer.c/1.112/Sun Nov 21 22:19:09 2021//
34 /cscope.c/1.20/Sun Nov 21 22:19:09 2021//
35 /dir.c/1.32/Sat Feb 12 21:09:39 2022//
36 /echo.c/1.68/Sun Nov 21 22:19:09 2021//
37 /funmap.c/1.63/Sun Nov 21 22:19:09 2021//
38 /grep.c/1.49/Sun Nov 21 22:19:09 2021//
39 /help.c/1.36/Sat Feb 12 21:09:39 2022//
40 /interpreter.c/1.34/Result of merge+Sat Feb 12 21:09:39 2022//
41 /kbd.c/1.35/Sun Nov 21 22:19:09 2021//
42 /keymap.c/1.59/Sun Nov 21 22:19:09 2021//
43 /line.c/1.63/Sun Nov 21 22:19:09 2021//
44 /log.c/1.12/Sun Nov 21 22:19:09 2021//
45 /log.h/1.6/Sun Nov 21 22:19:09 2021//
46 /match.c/1.22/Sun Nov 21 22:19:09 2021//
47 /tags.c/1.17/Result of merge//
48 /tty.c/1.39/Sun Nov 21 22:19:09 2021//
49 /ttykbd.c/1.20/Sun Nov 21 22:19:09 2021//
50 /util.c/1.43/Sun Nov 21 22:19:09 2021//
51 /yank.c/1.15/Sun Nov 21 22:19:09 2021//
52 /mg.1/1.126/Thu Mar 31 20:05:13 2022//
5353 D
00 # PORTING MG AND USING LIBBSD
11
22 I've maintained and ported mg for quite some time now and at first it
3 was easy recently it got harder and harder since it was a moving
3 was easy recently it got harder and harder, since it was a moving
44 target. Especially the inclusion of some system specific libraries since
55 about 2 years ago made it too much of an effort for my humble coding
66 skills.
77
88 So recently Jasper Lievisse Adriaanse asked me to try it again and I
99 restarted working on the project and ran into exactly the same problems
10 again. While googling for solutions I ran into libbsd:
10 again. While googling for solutions, I ran into libbsd:
1111
1212 http://libbsd.freedesktop.org/wiki/
1313
14 It's a porting library for OpenBSD code! And after installing that it
14 It's a porting library for OpenBSD code! And after installing that, it
1515 was a piece of pie to get mg ported again.
1616
1717 ## PORTING TO ALL OTHER PLATFORMS
1818
19 Okay, that was debian. Now I have to get the rest of all the previously
19 Okay, that was Debian. Now I have to get the rest of all the previously
2020 supported platforms working again. All help is welcome and as always:
21 Please provide patches that do not break stuff for other platforms.
21 Please provide patches, that do not break stuff for other platforms.
2222
2323 ## BUILDING MG
2424
4949
5050 *Kudos to Leonid Bobrov(@mazocomp) for adding CMAKE support.*
5151
52 ## STATIC BUILDS
52 ## STATIC BUILDS (on Linux)
5353
5454 I recently figured out how to make really portable static builds: On an
5555 alpine linux system, build with the command:
5959 glibc does not really support static binaries. https://www.musl-libc.org/
6060 does not have this problem.
6161
62 To make building static binaries more easy, check the mg-static directory, there
63 is a script which can build static binaries with support of podman and buildah.
64
6265
6366 ## USING CVS
6467
65 This code is the cvs checkout from the OpenBSD project so if you install
68 This code is the cvs checkout from the OpenBSD project, so if you install
6669 cvs you can see what I changed to port mg. Like this:
6770
6871 ```
69 cvs diff -uw
72 CVS_RSH=ssh cvs diff -uw
7073 ```
0 /* $OpenBSD: dir.c,v 1.31 2019/06/28 13:35:02 deraadt Exp $ */
0 /* $OpenBSD: dir.c,v 1.32 2022/01/28 06:18:41 guenther Exp $ */
11
22 /* This file is in the public domain. */
33
8585 return (TRUE);
8686 }
8787
88 /* Create the directory and it's parents. */
88 /* Create the directory and its parents. */
8989 /* ARGSUSED */
9090 int
9191 makedir(int f, int n)
694694 char *argp = NULL;
695695 long nl;
696696 int bind;
697 KEYMAP *curmap;
697 KEYMAP *curmap = NULL;
698698 #define BINDARG 0 /* this arg is key to bind (local/global set key) */
699699 #define BINDNO 1 /* not binding or non-quoted BINDARG */
700700 #define BINDNEXT 2 /* next arg " (define-key) */
349349 goto nohome;
350350
351351 if (conffile != NULL) {
352 (void)strncpy(file, conffile, NFILEN);
352 (void)strncpy(file, conffile, NFILEN - 1);
353353 } else if (suffix == NULL) {
354354 ret = snprintf(file, sizeof(file), _PATH_MG_STARTUP, home);
355355 if (ret < 0 || ret >= sizeof(file))
0 /* $OpenBSD: help.c,v 1.35 2015/03/19 21:22:15 bcallah Exp $ */
0 /* $OpenBSD: help.c,v 1.36 2022/01/28 06:18:41 guenther Exp $ */
11
22 /* This file is in the public domain. */
33
9696 /*
9797 * This function creates a table, listing all of the command
9898 * keys and their current bindings, and stores the table in the
99 * *help* pop-up buffer. This lets Mg produce it's own wall chart.
99 * *help* pop-up buffer. This lets Mg produce its own wall chart.
100100 */
101101 /* ARGSUSED */
102102 int
0 /* $OpenBSD: interpreter.c,v 1.32 2021/05/12 11:13:23 lum Exp $ */
0 /* $OpenBSD: interpreter.c,v 1.34 2022/01/28 06:18:41 guenther Exp $ */
11 /*
22 * This file is in the public domain.
33 *
77 /*
88 * This file attempts to add some 'scripting' functionality into mg.
99 *
10 * The initial goal is to give mg the ability to use it's existing functions
10 * The initial goal is to give mg the ability to use its existing functions
1111 * and structures in a linked-up way. Hopefully resulting in user definable
1212 * functions. The syntax is 'scheme' like but currently it is not a scheme
1313 * interpreter.
124124 foundparen(char *funstr, int llen, int lnum)
125125 {
126126 const char *lrp = NULL;
127 char *p, *begp = NULL, *endp = NULL, *prechr;
127 char *p, *begp = NULL, *endp = NULL, *prechr = NULL;
128128 char *lastchr = NULL;
129 int i, ret, pctr, expctr, blkid, inquote, esc;
129 int i, ret = 255, pctr, expctr, blkid, inquote, esc;
130130 int elen, spc, ns;
131131
132132 pctr = expctr = inquote = esc = elen = spc = ns = 0;
491491
492492 if (!doregex(regs, argp)) {
493493 const char *errstr;
494 int iters;
495
496 iters = strtonum(argp, 0, INT_MAX, &errstr);
494
495 strtonum(argp, 0, INT_MAX, &errstr);
497496 if (errstr != NULL)
498497 return (dobeep_msgs("Var not found:",
499498 argp));
627626 char *argp, *endp, *p, *v, *s = " ";
628627 char *regs;
629628 int spc, cnt;
630 int inlist, sizof, fin, inquote;
629 int sizof, fin, inquote;
631630
632631 /* now find the first argument */
633632 p = skipwhite(valp);
636635 return (dobeep_msg("strlcpy error"));
637636 argp = argbuf;
638637 spc = 1; /* initially fake a space so we find first argument */
639 inlist = fin = inquote = cnt = spc = 0;
638 fin = inquote = cnt = spc = 0;
640639
641640 for (p = argbuf; *p != '\0'; p++) {
642641 if (*(p + 1) == '\0')
692691 continue;
693692 } else {
694693 const char *errstr;
695 int iters;
696
697 iters = strtonum(argp, 0, INT_MAX, &errstr);
694
695 strtonum(argp, 0, INT_MAX, &errstr);
698696 if (errstr != NULL)
699697 return (dobeep_msgs("Var not found:",
700698 argp));
1818
1919 #if HAVE_PTY_H
2020 #include <pty.h>
21 #include <utmp.h>
2122 #elif HAVE_UTIL_H
2223 #include <util.h>
2324 #endif
0 generate-mg-static is a little helper script with which I generate static binararies for mg.
1
2 Alas, it only works on Linux.
0 #!/bin/sh
1
2 # This Makefile has been written by Han Boetes
3 # <hboetes@gmail.com> and is released in Public Domain.
4
5 isinpath () {
6 command -v $1 >&/dev/null
7 }
8
9 for i in podman buildah; do
10 if ! isinpath $i; then
11 echo "$0: $i is a required dependency for this script" >&2
12 EXIT=true
13 fi
14 done
15
16 if [ "$EXIT" = true ]; then
17 exit 1
18 fi
19
20 usage() {
21 name=${0##*/}
22 cat << EOF >&2
23 This script can build a static binary for mg, like this:
24 ./$name tag -- build the latest tagged 64-bit version
25 ./$name latest -- build the latest 64-bit version
26 ./$name tag32 -- build the latest tagged 32-bit version
27 ./$name latest32 -- build the latest 32-bit version
28 EOF
29 exit 1
30 }
31
32 case $1 in
33 latest|latest64)
34 ext=_64
35 TCMD=':'
36 IMPTH=library
37 ;;
38 tag|tag64)
39 ext=_64
40 TCMD='git tag|tail -n 1'
41 IMPTH=library
42 ;;
43 latest32)
44 ext=
45 TCMD=':'
46 IMPTH=i386
47 ;;
48 tag32)
49 ext=
50 TCMD='git tag|tail -n 1'
51 IMPTH=i386
52 ;;
53 *)
54 usage
55 ;;
56 esac
57
58 # Create the Containerfile
59 cat << EOF > Containerfile
60 FROM docker.io/$IMPTH/alpine
61 RUN apk update
62 RUN apk add git libbsd-dev ncurses-dev musl-dev ncurses-static gcc make
63 RUN git clone https://github.com/hboetes/mg.git
64 WORKDIR mg
65 RUN TAG=\$($TCMD); \
66 git checkout \$TAG; \
67 make STATIC=1; \
68 strip mg; \
69 ln mg mg-\$TAG-static-x86$ext
70 EOF
71
72
73 cat << EOF > ./helper-script
74 #!/bin/sh
75 mnt=\$(podman image mount localhost/mg-static)
76 cp \$mnt/mg/mg-*static-x86* .
77 EOF
78 chmod 755 ./helper-script
79
80 podman image rm localhost/mg-static
81 buildah build -f Containerfile -t mg-static
82 podman unshare ./helper-script
83
84 # Clean up the mess
85 rm -f Containerfile helper-script
86 podman image rm localhost/mg-static
0 .\" $OpenBSD: mg.1,v 1.125 2021/05/02 14:13:17 lum Exp $
0 .\" $OpenBSD: mg.1,v 1.126 2022/03/31 17:27:25 naddy Exp $
11 .\" This file is in the public domain.
22 .\"
3 .Dd $Mdocdate: May 2 2021 $
3 .Dd $Mdocdate: March 31 2022 $
44 .Dt MG 1
55 .Os
66 .Sh NAME
10431043 by the position of the cursor in the dired buffer.
10441044 .It dired-find-file
10451045 Open the file on the current line of the dired buffer.
1046 If the cursor is on a directory it will be opened in dired mode.
1046 If the cursor is on a directory, it will be opened in dired mode.
10471047 .It dired-flag-file-deletion
10481048 Flag the file listed on the current line for deletion.
10491049 This is indicated in the buffer by putting a D at the left margin.
0 /* $OpenBSD: tags.c,v 1.16 2017/08/06 04:39:45 bcallah Exp $ */
0 /* $OpenBSD: tags.c,v 1.17 2022/01/28 06:18:41 guenther Exp $ */
11
22 /*
33 * This file is in the public domain.
459459
460460 /* Underscore character is to be treated as "inword" while
461461 * processing tokens unlike mg's default word traversal. Save
462 * and restore it's cinfo value so that tag matching works for
462 * and restore its cinfo value so that tag matching works for
463463 * identifier with underscore.
464464 */
465465 c = cinfo['_'];
1212
1313 #include "def.h"
1414
15 const char version[] = "Mg 2a";
15 const char version[] = "Mg 2a (hboetes-20220212)";
1616
1717 /*
1818 * Display the version. All this does