Import upstream version 20220212+git20220331.1.b3c0b47
Debian Janitor
2 years ago
0 | /tags.c/1.16/Result of merge// | |
1 | 0 | /undo.c/1.58/Tue Apr 10 04:57:08 2018// |
2 | 1 | /Makefile/1.35/Result of merge// |
3 | 2 | /fileio.c/1.108/Result of merge// |
4 | 3 | /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// | |
34 | 4 | /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// | |
44 | 5 | /def.h/1.176/Result of merge// |
45 | 6 | /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// | |
50 | 7 | /main.c/1.90/Result of merge// |
51 | /mg.1/1.125/Sun May 16 16:01:24 2021// | |
52 | 8 | /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// | |
53 | 53 | D |
0 | 0 | # PORTING MG AND USING LIBBSD |
1 | 1 | |
2 | 2 | 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 | |
4 | 4 | target. Especially the inclusion of some system specific libraries since |
5 | 5 | about 2 years ago made it too much of an effort for my humble coding |
6 | 6 | skills. |
7 | 7 | |
8 | 8 | So recently Jasper Lievisse Adriaanse asked me to try it again and I |
9 | 9 | 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: | |
11 | 11 | |
12 | 12 | http://libbsd.freedesktop.org/wiki/ |
13 | 13 | |
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 | |
15 | 15 | was a piece of pie to get mg ported again. |
16 | 16 | |
17 | 17 | ## PORTING TO ALL OTHER PLATFORMS |
18 | 18 | |
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 | |
20 | 20 | 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. | |
22 | 22 | |
23 | 23 | ## BUILDING MG |
24 | 24 | |
49 | 49 | |
50 | 50 | *Kudos to Leonid Bobrov(@mazocomp) for adding CMAKE support.* |
51 | 51 | |
52 | ## STATIC BUILDS | |
52 | ## STATIC BUILDS (on Linux) | |
53 | 53 | |
54 | 54 | I recently figured out how to make really portable static builds: On an |
55 | 55 | alpine linux system, build with the command: |
59 | 59 | glibc does not really support static binaries. https://www.musl-libc.org/ |
60 | 60 | does not have this problem. |
61 | 61 | |
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 | ||
62 | 65 | |
63 | 66 | ## USING CVS |
64 | 67 | |
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 | |
66 | 69 | cvs you can see what I changed to port mg. Like this: |
67 | 70 | |
68 | 71 | ``` |
69 | cvs diff -uw | |
72 | CVS_RSH=ssh cvs diff -uw | |
70 | 73 | ``` |
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 $ */ | |
1 | 1 | |
2 | 2 | /* This file is in the public domain. */ |
3 | 3 | |
85 | 85 | return (TRUE); |
86 | 86 | } |
87 | 87 | |
88 | /* Create the directory and it's parents. */ | |
88 | /* Create the directory and its parents. */ | |
89 | 89 | /* ARGSUSED */ |
90 | 90 | int |
91 | 91 | makedir(int f, int n) |
694 | 694 | char *argp = NULL; |
695 | 695 | long nl; |
696 | 696 | int bind; |
697 | KEYMAP *curmap; | |
697 | KEYMAP *curmap = NULL; | |
698 | 698 | #define BINDARG 0 /* this arg is key to bind (local/global set key) */ |
699 | 699 | #define BINDNO 1 /* not binding or non-quoted BINDARG */ |
700 | 700 | #define BINDNEXT 2 /* next arg " (define-key) */ |
349 | 349 | goto nohome; |
350 | 350 | |
351 | 351 | if (conffile != NULL) { |
352 | (void)strncpy(file, conffile, NFILEN); | |
352 | (void)strncpy(file, conffile, NFILEN - 1); | |
353 | 353 | } else if (suffix == NULL) { |
354 | 354 | ret = snprintf(file, sizeof(file), _PATH_MG_STARTUP, home); |
355 | 355 | 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 $ */ | |
1 | 1 | |
2 | 2 | /* This file is in the public domain. */ |
3 | 3 | |
96 | 96 | /* |
97 | 97 | * This function creates a table, listing all of the command |
98 | 98 | * 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. | |
100 | 100 | */ |
101 | 101 | /* ARGSUSED */ |
102 | 102 | 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 $ */ | |
1 | 1 | /* |
2 | 2 | * This file is in the public domain. |
3 | 3 | * |
7 | 7 | /* |
8 | 8 | * This file attempts to add some 'scripting' functionality into mg. |
9 | 9 | * |
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 | |
11 | 11 | * and structures in a linked-up way. Hopefully resulting in user definable |
12 | 12 | * functions. The syntax is 'scheme' like but currently it is not a scheme |
13 | 13 | * interpreter. |
124 | 124 | foundparen(char *funstr, int llen, int lnum) |
125 | 125 | { |
126 | 126 | const char *lrp = NULL; |
127 | char *p, *begp = NULL, *endp = NULL, *prechr; | |
127 | char *p, *begp = NULL, *endp = NULL, *prechr = NULL; | |
128 | 128 | char *lastchr = NULL; |
129 | int i, ret, pctr, expctr, blkid, inquote, esc; | |
129 | int i, ret = 255, pctr, expctr, blkid, inquote, esc; | |
130 | 130 | int elen, spc, ns; |
131 | 131 | |
132 | 132 | pctr = expctr = inquote = esc = elen = spc = ns = 0; |
491 | 491 | |
492 | 492 | if (!doregex(regs, argp)) { |
493 | 493 | const char *errstr; |
494 | int iters; | |
495 | ||
496 | iters = strtonum(argp, 0, INT_MAX, &errstr); | |
494 | ||
495 | strtonum(argp, 0, INT_MAX, &errstr); | |
497 | 496 | if (errstr != NULL) |
498 | 497 | return (dobeep_msgs("Var not found:", |
499 | 498 | argp)); |
627 | 626 | char *argp, *endp, *p, *v, *s = " "; |
628 | 627 | char *regs; |
629 | 628 | int spc, cnt; |
630 | int inlist, sizof, fin, inquote; | |
629 | int sizof, fin, inquote; | |
631 | 630 | |
632 | 631 | /* now find the first argument */ |
633 | 632 | p = skipwhite(valp); |
636 | 635 | return (dobeep_msg("strlcpy error")); |
637 | 636 | argp = argbuf; |
638 | 637 | spc = 1; /* initially fake a space so we find first argument */ |
639 | inlist = fin = inquote = cnt = spc = 0; | |
638 | fin = inquote = cnt = spc = 0; | |
640 | 639 | |
641 | 640 | for (p = argbuf; *p != '\0'; p++) { |
642 | 641 | if (*(p + 1) == '\0') |
692 | 691 | continue; |
693 | 692 | } else { |
694 | 693 | const char *errstr; |
695 | int iters; | |
696 | ||
697 | iters = strtonum(argp, 0, INT_MAX, &errstr); | |
694 | ||
695 | strtonum(argp, 0, INT_MAX, &errstr); | |
698 | 696 | if (errstr != NULL) |
699 | 697 | return (dobeep_msgs("Var not found:", |
700 | 698 | argp)); |
18 | 18 | |
19 | 19 | #if HAVE_PTY_H |
20 | 20 | #include <pty.h> |
21 | #include <utmp.h> | |
21 | 22 | #elif HAVE_UTIL_H |
22 | 23 | #include <util.h> |
23 | 24 | #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 $ | |
1 | 1 | .\" This file is in the public domain. |
2 | 2 | .\" |
3 | .Dd $Mdocdate: May 2 2021 $ | |
3 | .Dd $Mdocdate: March 31 2022 $ | |
4 | 4 | .Dt MG 1 |
5 | 5 | .Os |
6 | 6 | .Sh NAME |
1043 | 1043 | by the position of the cursor in the dired buffer. |
1044 | 1044 | .It dired-find-file |
1045 | 1045 | 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. | |
1047 | 1047 | .It dired-flag-file-deletion |
1048 | 1048 | Flag the file listed on the current line for deletion. |
1049 | 1049 | 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 $ */ | |
1 | 1 | |
2 | 2 | /* |
3 | 3 | * This file is in the public domain. |
459 | 459 | |
460 | 460 | /* Underscore character is to be treated as "inword" while |
461 | 461 | * 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 | |
463 | 463 | * identifier with underscore. |
464 | 464 | */ |
465 | 465 | c = cinfo['_']; |