Codebase list mg / b496ef0
New upstream version 20170828 Harald Dunkel 6 years ago
10 changed file(s) with 56 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
00 /ttyio.c/1.37/Wed Mar 25 18:47:22 2015//
11 /def.h/1.155/Result of merge//
2 /fileio.c/1.103/Result of merge//
3 /tags.c/1.14/Result of merge//
42 /region.c/1.37/Result of merge//
53 /main.c/1.84/Result of merge//
64 /Makefile/1.33/Wed Oct 5 11:37:09 2016//
1210 /cinfo.c/1.18/Thu Sep 1 15:28:17 2016//
1311 /cmode.c/1.16/Thu Sep 1 15:28:17 2016//
1412 /cscope.c/1.16/Thu Sep 1 15:28:17 2016//
15 /dir.c/1.29/Wed Oct 5 11:37:09 2016//
1613 /dired.c/1.83/Sat Nov 26 10:20:10 2016//
17 /display.c/1.47/Thu Sep 1 15:28:17 2016//
1814 /echo.c/1.66/Sat Nov 26 10:20:10 2016//
1915 /extend.c/1.64/Mon Sep 12 16:36:26 2016//
2016 /file.c/1.100/Thu Sep 1 15:28:17 2016//
3127 /macro.h/1.7/Thu Sep 1 15:28:17 2016//
3228 /match.c/1.19/Thu Sep 1 15:28:17 2016//
3329 /mg.1/1.105/Thu Sep 1 15:30:59 2016//
34 /modes.c/1.20/Thu Sep 1 15:28:17 2016//
3530 /paragraph.c/1.45/Mon Sep 12 16:36:26 2016//
3631 /pathnames.h/1.1/Thu Sep 1 15:28:17 2016//
37 /re_search.c/1.31/Thu Sep 1 15:28:17 2016//
38 /search.c/1.44/Thu Sep 1 15:28:17 2016//
3932 /spawn.c/1.12/Thu Sep 1 15:28:17 2016//
4033 /tty.c/1.36/Thu Sep 1 15:28:17 2016//
4134 /ttykbd.c/1.18/Thu Sep 1 15:28:17 2016//
42 /tutorial/1.16/Thu Sep 1 15:28:17 2016//
4335 /undo.c/1.58/Mon Sep 12 16:36:26 2016//
4436 /util.c/1.38/Thu Sep 1 15:28:17 2016//
4537 /version.c/1.10/Thu Sep 1 15:28:17 2016//
4638 /window.c/1.36/Thu Sep 1 15:28:17 2016//
4739 /word.c/1.19/Thu Sep 1 15:28:17 2016//
4840 /yank.c/1.14/Thu Sep 1 15:28:17 2016//
49 /buffer.c/1.103/Sat Apr 1 06:51:57 2017//
41 /buffer.c/1.104/Mon Aug 28 07:58:35 2017//
42 /dir.c/1.30/Mon Aug 28 07:58:35 2017//
43 /display.c/1.48/Mon Aug 28 07:58:35 2017//
44 /fileio.c/1.104/Result of merge//
45 /modes.c/1.21/Mon Aug 28 07:58:36 2017//
46 /re_search.c/1.33/Mon Aug 28 07:58:36 2017//
47 /search.c/1.46/Mon Aug 28 07:58:36 2017//
48 /tags.c/1.16/Result of merge//
49 /tutorial/1.17/Mon Aug 28 07:58:36 2017//
5050 D
0 /* $OpenBSD: buffer.c,v 1.103 2017/03/13 20:32:58 florian Exp $ */
0 /* $OpenBSD: buffer.c,v 1.104 2017/08/06 04:39:45 bcallah Exp $ */
11
22 /* This file is in the public domain. */
33
8585 if (curbp->b_altb == NULL)
8686 bufp = eread("Switch to buffer: ", bufn, NBUFN, EFNEW | EFBUF);
8787 else
88 bufp = eread("Switch to buffer: (default %s) ", bufn, NBUFN,
88 bufp = eread("Switch to buffer (default %s): ", bufn, NBUFN,
8989 EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname);
9090
9191 if (bufp == NULL)
111111 bufp = eread("Switch to buffer in other window: ", bufn, NBUFN,
112112 EFNEW | EFBUF);
113113 else
114 bufp = eread("Switch to buffer in other window: (default %s) ",
114 bufp = eread("Switch to buffer in other window (default %s): ",
115115 bufn, NBUFN, EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname);
116116 if (bufp == NULL)
117117 return (ABORT);
145145
146146 if (f & FFRAND) /* dired mode 'q' */
147147 bp = curbp;
148 else if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN,
148 else if ((bufp = eread("Kill buffer (default %s): ", bufn, NBUFN,
149149 EFNUL | EFNEW | EFBUF, curbp->b_bname)) == NULL)
150150 return (ABORT);
151151 else if (bufp[0] == '\0')
745745
746746 /* Get buffer to use from user */
747747 if (curbp->b_altb != NULL)
748 bufp = eread("Insert buffer: (default %s) ", bufn, NBUFN,
748 bufp = eread("Insert buffer (default %s): ", bufn, NBUFN,
749749 EFNUL | EFNEW | EFBUF, curbp->b_altb->b_bname);
750750 else
751751 bufp = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF);
0 /* $OpenBSD: dir.c,v 1.29 2016/09/12 18:32:54 millert Exp $ */
0 /* $OpenBSD: dir.c,v 1.30 2017/05/30 07:05:22 florian Exp $ */
11
22 /* This file is in the public domain. */
33
116116 {
117117 struct stat sb;
118118 int finished, ishere;
119 mode_t dir_mode, mode, oumask;
119 mode_t dir_mode, f_mode, oumask;
120120 char *slash;
121121
122122 if ((path = adjustname(path, TRUE)) == NULL)
130130 slash = path;
131131
132132 oumask = umask(0);
133 mode = 0777 & ~oumask;
134 dir_mode = mode | S_IWUSR | S_IXUSR;
133 f_mode = 0777 & ~oumask;
134 dir_mode = f_mode | S_IWUSR | S_IXUSR;
135135
136136 for (;;) {
137137 slash += strspn(slash, "/");
151151 continue;
152152 }
153153
154 if (mkdir(path, finished ? mode : dir_mode) == 0) {
155 if (mode > 0777 && chmod(path, mode) < 0) {
154 if (mkdir(path, finished ? f_mode : dir_mode) == 0) {
155 if (f_mode > 0777 && chmod(path, f_mode) < 0) {
156156 umask(oumask);
157157 return (ABORT);
158158 }
0 /* $OpenBSD: display.c,v 1.47 2015/04/03 22:10:29 bcallah Exp $ */
0 /* $OpenBSD: display.c,v 1.48 2017/07/06 19:27:37 schwarze Exp $ */
11
22 /* This file is in the public domain. */
33
365365 } else if (ISCTRL(c) != FALSE) {
366366 vtpute('^');
367367 vtpute(CCHR(c));
368 } else {
368 } else if (isprint(c)) {
369369 if (vtcol >= 0)
370370 vp->v_text[vtcol] = c;
371371 ++vtcol;
372 } else {
373 char bf[5], *cp;
374
375 snprintf(bf, sizeof(bf), "\\%o", c);
376 for (cp = bf; *cp != '\0'; cp++)
377 vtpute(*cp);
372378 }
373379 }
374380
0 /* $OpenBSD: fileio.c,v 1.103 2016/07/28 21:40:25 tedu Exp $ */
0 /* $OpenBSD: fileio.c,v 1.104 2017/05/30 07:05:22 florian Exp $ */
11
22 /* This file is in the public domain. */
33
216216 fbackupfile(const char *fn)
217217 {
218218 struct stat sb;
219 struct timespec new_times[2];
219220 int from, to, serrno;
220221 ssize_t nread;
221222 char buf[BUFSIZ];
269270 (void) fchmod(to, (sb.st_mode & 0777));
270271
271272 /* copy the mtime to the backupfile */
272 struct timespec new_times[2];
273273 new_times[0] = sb.st_atim;
274274 new_times[1] = sb.st_mtim;
275275 futimens(to, new_times);
0 /* $OpenBSD: modes.c,v 1.20 2015/03/19 21:22:15 bcallah Exp $ */
0 /* $OpenBSD: modes.c,v 1.21 2017/05/30 07:05:22 florian Exp $ */
11
22 /* This file is in the public domain. */
33
2222 int defb_flag = 0;
2323
2424 int
25 changemode(int f, int n, char *mode)
25 changemode(int f, int n, char *newmode)
2626 {
2727 int i;
2828 struct maps_s *m;
2929
30 if ((m = name_mode(mode)) == NULL) {
30 if ((m = name_mode(newmode)) == NULL) {
3131 dobeep();
32 ewprintf("Can't find mode %s", mode);
32 ewprintf("Can't find mode %s", newmode);
3333 return (FALSE);
3434 }
3535 if (!(f & FFARG)) {
0 /* $OpenBSD: re_search.c,v 1.31 2015/03/19 21:22:15 bcallah Exp $ */
0 /* $OpenBSD: re_search.c,v 1.33 2017/08/06 04:39:45 bcallah Exp $ */
11
22 /* This file is in the public domain. */
33
419419 * some do-it-yourself control expansion.
420420 */
421421 static int
422 re_readpattern(char *prompt)
422 re_readpattern(char *re_prompt)
423423 {
424424 static int dofree = 0;
425425 int flags, error, s;
426426 char tpat[NPAT], *rep;
427427
428428 if (re_pat[0] == '\0')
429 rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, prompt);
429 rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, re_prompt);
430430 else
431 rep = eread("%s: (default %s) ", tpat, NPAT,
432 EFNUL | EFNEW | EFCR, prompt, re_pat);
431 rep = eread("%s (default %s): ", tpat, NPAT,
432 EFNUL | EFNEW | EFCR, re_prompt, re_pat);
433433 if (rep == NULL)
434434 return (ABORT);
435435 if (rep[0] != '\0') {
0 /* $OpenBSD: search.c,v 1.44 2015/03/19 21:22:15 bcallah Exp $ */
0 /* $OpenBSD: search.c,v 1.46 2017/08/06 04:39:45 bcallah Exp $ */
11
22 /* This file is in the public domain. */
33
541541 }
542542
543543 /*
544 * Prompt writing routine for the incremental search. The "prompt" is just
544 * Prompt writing routine for the incremental search. The "i_prompt" is just
545545 * a string. The "flag" determines whether pat should be printed.
546546 */
547547 static void
548 is_dspl(char *prompt, int flag)
548 is_dspl(char *i_prompt, int flag)
549549 {
550550 if (flag != FALSE)
551 ewprintf("%s: ", prompt);
551 ewprintf("%s: ", i_prompt);
552552 else
553 ewprintf("%s: %s", prompt, pat);
553 ewprintf("%s: %s", i_prompt, pat);
554554 }
555555
556556 /*
829829 * expansion.
830830 */
831831 int
832 readpattern(char *prompt)
832 readpattern(char *r_prompt)
833833 {
834834 char tpat[NPAT], *rep;
835835 int retval;
836836
837837 if (pat[0] == '\0')
838 rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, prompt);
838 rep = eread("%s: ", tpat, NPAT, EFNEW | EFCR, r_prompt);
839839 else
840 rep = eread("%s: (default %s) ", tpat, NPAT,
841 EFNUL | EFNEW | EFCR, prompt, pat);
840 rep = eread("%s (default %s): ", tpat, NPAT,
841 EFNUL | EFNEW | EFCR, r_prompt, pat);
842842
843843 /* specified */
844844 if (rep == NULL) {
0 /* $OpenBSD: tags.c,v 1.14 2016/09/01 10:01:53 sunil Exp $ */
0 /* $OpenBSD: tags.c,v 1.16 2017/08/06 04:39:45 bcallah Exp $ */
11
22 /*
33 * This file is in the public domain.
8989 return (FALSE);
9090 }
9191
92 bufp = eread("visit tags table (default %s): ", fname,
92 bufp = eread("Visit tags table (default %s): ", fname,
9393 NFILEN, EFFILE | EFCR | EFNEW | EFDEF, DEFAULTFN);
9494 if (bufp == NULL)
9595 return (ABORT);
153153
154154 if (curtoken(f, n, dtok) == FALSE) {
155155 dtok[0] = '\0';
156 bufp = eread("Find tag:", utok, MAX_TOKEN, EFNUL | EFNEW);
156 bufp = eread("Find tag: ", utok, MAX_TOKEN, EFNUL | EFNEW);
157157 } else
158 bufp = eread("Find tag (default %s):", utok, MAX_TOKEN,
158 bufp = eread("Find tag (default %s): ", utok, MAX_TOKEN,
159159 EFNUL | EFNEW, dtok);
160160
161161 if (bufp == NULL)
405405 * Search through each line of buffer for pattern.
406406 */
407407 int
408 searchpat(char *pat)
408 searchpat(char *s_pat)
409409 {
410410 struct line *lp;
411411 int dotline;
412412 size_t plen;
413413
414 plen = strlen(pat);
414 plen = strlen(s_pat);
415415 dotline = 1;
416416 lp = lforw(curbp->b_headp);
417417 while (lp != curbp->b_headp) {
418418 if (ltext(lp) != NULL && plen <= llength(lp) &&
419 (strncmp(pat, ltext(lp), plen) == 0)) {
419 (strncmp(s_pat, ltext(lp), plen) == 0)) {
420420 curwp->w_doto = 0;
421421 curwp->w_dotp = lp;
422422 curwp->w_dotline = dotline;
313313
314314 You've already seen C-x C-f and C-x C-s to open and save a file. There are
315315 other longer commands. For instance, you can also open a file by typing
316 M-x open-file Enter. When you type a command using M-x, mg prompts you for
316 M-x find-file Enter. When you type a command using M-x, mg prompts you for
317317 the command at the bottom of the screen. You can type out the whole command
318318 if you wish, or you can type out part of the command and then use the TAB key
319319 for autocompleting the command.