Update upstream source from tag 'upstream/20200723'
Update to upstream version '20200723'
with Debian dir 58ff68f4ca41e03d19756afafcc24463a2c8d21f
Tomasz Buchert
3 years ago
5 | 5 | line.c macro.c main.c match.c modes.c paragraph.c |
6 | 6 | re_search.c region.c search.c spawn.c tty.c ttyio.c ttykbd.c |
7 | 7 | undo.c util.c version.c window.c word.c yank.c |
8 | cmode.c cscope.c dired.c grep.c tags.c | |
8 | cmode.c cscope.c dired.c grep.c tags.c interpreter.c | |
9 | 9 | ) |
10 | 10 | |
11 | 11 | add_executable (mg ${MG_SRC}) |
21 | 21 | link_directories (${BSD_LIBRARY_DIRS}) |
22 | 22 | string (REPLACE ";" " " LIBBSD_FLAGS "${BSD_CFLAGS}") |
23 | 23 | target_link_libraries (mg ${BSD_LIBRARIES}) |
24 | set (CMAKE_C_FLAGS "-Wall -DREGEX -D_GNU_SOURCE ${LIBBSD_FLAGS} ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}") | |
25 | else() | |
26 | set (CMAKE_C_FLAGS "-Wall -DREGEX ${LIBBSD_FLAGS} ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}") | |
24 | 27 | endif() |
25 | ||
26 | set (CMAKE_C_FLAGS "-Wall -DREGEX ${LIBBSD_FLAGS} ${NCURSES_FLAGS} -L${NCURSES_LIBRARY_DIRS}") |
0 | 0 | /tags.c/1.16/Result of merge// |
1 | /re_search.c/1.33/Mon Aug 28 19:36:58 2017// | |
2 | 1 | /undo.c/1.58/Tue Apr 10 04:57:08 2018// |
3 | 2 | /region.c/1.38/Result of merge// |
4 | 3 | /Makefile/1.35/Result of merge// |
5 | /README/1.14/Mon Aug 12 23:34:18 2019// | |
6 | /autoexec.c/1.17/Mon Aug 12 23:34:18 2019// | |
7 | /basic.c/1.49/Mon Aug 12 23:34:18 2019// | |
8 | /bell.c/1.5/Mon Aug 12 23:34:28 2019// | |
9 | /buffer.c/1.107/Mon Aug 12 23:34:28 2019// | |
10 | /chrdef.h/1.10/Mon Aug 12 23:34:18 2019// | |
11 | /cinfo.c/1.18/Mon Aug 12 23:34:18 2019// | |
12 | /cmode.c/1.17/Mon Aug 12 23:34:28 2019// | |
13 | /cscope.c/1.18/Mon Aug 12 23:34:28 2019// | |
14 | /dir.c/1.31/Mon Aug 12 23:34:28 2019// | |
15 | 4 | /dired.c/1.93/Result of merge// |
16 | /display.c/1.48/Mon Aug 12 23:34:18 2019// | |
17 | /echo.c/1.66/Mon Aug 12 23:34:18 2019// | |
18 | /extend.c/1.71/Mon Aug 12 23:34:28 2019// | |
19 | /file.c/1.102/Mon Aug 12 23:34:28 2019// | |
20 | 5 | /fileio.c/1.106/Result of merge// |
21 | /funmap.c/1.59/Mon Aug 12 23:34:28 2019// | |
22 | /funmap.h/1.8/Mon Aug 12 23:34:28 2019// | |
23 | /grep.c/1.48/Mon Aug 12 23:34:28 2019// | |
24 | /help.c/1.35/Mon Aug 12 23:34:18 2019// | |
25 | /interpreter.c/1.5/Sat Jul 20 11:06:33 2019// | |
26 | /kbd.h/1.19/Mon Aug 12 23:34:18 2019// | |
27 | /key.h/1.6/Mon Aug 12 23:34:28 2019// | |
28 | /keymap.c/1.58/Mon Aug 12 23:34:18 2019// | |
29 | /line.c/1.61/Mon Aug 12 23:34:18 2019// | |
30 | /log.c/1.11/Mon Aug 12 23:34:29 2019// | |
31 | /log.h/1.5/Mon Aug 12 23:34:29 2019// | |
32 | /macro.c/1.16/Mon Aug 12 23:34:18 2019// | |
33 | /macro.h/1.7/Mon Aug 12 23:34:18 2019// | |
34 | 6 | /main.c/1.87/Result of merge// |
35 | /match.c/1.21/Mon Aug 12 23:34:29 2019// | |
36 | /modes.c/1.21/Mon Aug 12 23:34:18 2019// | |
37 | /paragraph.c/1.46/Mon Aug 12 23:34:18 2019// | |
38 | /pathnames.h/1.1/Mon Aug 12 23:34:18 2019// | |
39 | /search.c/1.47/Mon Aug 12 23:34:18 2019// | |
40 | /spawn.c/1.12/Mon Aug 12 23:34:18 2019// | |
41 | 7 | /ttyio.c/1.38/Result of merge// |
42 | /ttykbd.c/1.19/Mon Aug 12 23:34:18 2019// | |
43 | /tutorial/1.18/Mon Aug 12 23:34:18 2019// | |
44 | /util.c/1.42/Mon Aug 12 23:34:29 2019// | |
45 | /version.c/1.10/Mon Aug 12 23:34:18 2019// | |
46 | /window.c/1.36/Mon Aug 12 23:34:18 2019// | |
47 | /word.c/1.19/Mon Aug 12 23:34:18 2019// | |
48 | /yank.c/1.14/Mon Aug 12 23:34:18 2019// | |
49 | /mg.1/1.118/Mon Feb 3 03:25:17 2020// | |
50 | 8 | /def.h/1.166/Result of merge+Sat Feb 15 14:26:34 2020// |
51 | /kbd.c/1.34/Result of merge// | |
52 | /tty.c/1.37/Result of merge+Sat Feb 15 14:26:47 2020// | |
9 | /README/1.14/Thu Mar 12 08:13:18 2020// | |
10 | /autoexec.c/1.17/Thu Mar 12 08:13:18 2020// | |
11 | /basic.c/1.49/Thu Mar 12 08:13:18 2020// | |
12 | /bell.c/1.5/Thu Mar 12 08:13:18 2020// | |
13 | /buffer.c/1.107/Thu Mar 12 08:13:18 2020// | |
14 | /chrdef.h/1.10/Thu Mar 12 08:13:18 2020// | |
15 | /cinfo.c/1.18/Thu Mar 12 08:13:18 2020// | |
16 | /cmode.c/1.17/Thu Mar 12 08:13:18 2020// | |
17 | /cscope.c/1.18/Thu Mar 12 08:13:18 2020// | |
18 | /dir.c/1.31/Thu Mar 12 08:13:18 2020// | |
19 | /display.c/1.48/Thu Mar 12 08:13:18 2020// | |
20 | /echo.c/1.66/Thu Mar 12 08:13:18 2020// | |
21 | /extend.c/1.71/Thu Mar 12 08:13:18 2020// | |
22 | /file.c/1.102/Thu Mar 12 08:13:18 2020// | |
23 | /funmap.c/1.59/Thu Mar 12 08:13:18 2020// | |
24 | /funmap.h/1.8/Thu Mar 12 08:13:18 2020// | |
25 | /grep.c/1.48/Thu Mar 12 08:13:18 2020// | |
26 | /help.c/1.35/Thu Mar 12 08:13:18 2020// | |
27 | /interpreter.c/1.5/Thu Mar 12 08:13:18 2020// | |
28 | /kbd.c/1.34/Thu Mar 12 08:13:18 2020// | |
29 | /kbd.h/1.19/Thu Mar 12 08:13:18 2020// | |
30 | /key.h/1.6/Thu Mar 12 08:13:18 2020// | |
31 | /keymap.c/1.58/Thu Mar 12 08:13:18 2020// | |
32 | /log.c/1.11/Thu Mar 12 08:13:18 2020// | |
33 | /log.h/1.5/Thu Mar 12 08:13:18 2020// | |
34 | /macro.c/1.16/Thu Mar 12 08:13:18 2020// | |
35 | /macro.h/1.7/Thu Mar 12 08:13:18 2020// | |
36 | /match.c/1.21/Thu Mar 12 08:13:18 2020// | |
37 | /mg.1/1.118/Thu Mar 12 08:13:18 2020// | |
38 | /modes.c/1.21/Thu Mar 12 08:13:18 2020// | |
39 | /paragraph.c/1.46/Thu Mar 12 08:13:18 2020// | |
40 | /pathnames.h/1.1/Thu Mar 12 08:13:18 2020// | |
41 | /search.c/1.47/Thu Mar 12 08:13:18 2020// | |
42 | /spawn.c/1.12/Thu Mar 12 08:13:18 2020// | |
43 | /tty.c/1.37/Thu Mar 12 08:13:18 2020// | |
44 | /ttykbd.c/1.19/Thu Mar 12 08:13:18 2020// | |
45 | /tutorial/1.18/Thu Mar 12 08:13:18 2020// | |
46 | /util.c/1.42/Thu Mar 12 08:13:18 2020// | |
47 | /version.c/1.10/Thu Mar 12 08:13:18 2020// | |
48 | /window.c/1.36/Thu Mar 12 08:13:18 2020// | |
49 | /word.c/1.19/Thu Mar 12 08:13:18 2020// | |
50 | /yank.c/1.14/Thu Mar 12 08:13:18 2020// | |
51 | /line.c/1.62/Thu Jul 23 17:18:45 2020// | |
52 | /re_search.c/1.35/Result of merge// | |
53 | 53 | D |
0 | /* $OpenBSD: line.c,v 1.61 2018/08/29 07:50:16 reyk Exp $ */ | |
0 | /* $OpenBSD: line.c,v 1.62 2020/07/22 13:22:53 tb Exp $ */ | |
1 | 1 | |
2 | 2 | /* This file is in the public domain. */ |
3 | 3 | |
555 | 555 | goto done; |
556 | 556 | |
557 | 557 | lp = curwp->w_dotp; |
558 | if (ltext(lp) == NULL) | |
559 | goto done; | |
558 | 560 | doto = curwp->w_doto; |
559 | 561 | n = plen; |
560 | 562 |
0 | /* $OpenBSD: re_search.c,v 1.33 2017/08/06 04:39:45 bcallah Exp $ */ | |
0 | /* $OpenBSD: re_search.c,v 1.35 2020/07/22 13:29:05 tb Exp $ */ | |
1 | 1 | |
2 | 2 | /* This file is in the public domain. */ |
3 | 3 | |
311 | 311 | static int |
312 | 312 | re_forwsrch(void) |
313 | 313 | { |
314 | int tbo, tdotline, error; | |
314 | int re_flags, tbo, tdotline, error; | |
315 | 315 | struct line *clp; |
316 | 316 | |
317 | 317 | clp = curwp->w_dotp; |
321 | 321 | if (tbo == clp->l_used) |
322 | 322 | /* |
323 | 323 | * Don't start matching past end of line -- must move to |
324 | * beginning of next line, unless at end of file. | |
324 | * beginning of next line, unless line is empty or at | |
325 | * end of file. | |
325 | 326 | */ |
326 | if (clp != curbp->b_headp) { | |
327 | if (clp != curbp->b_headp && llength(clp) != 0) { | |
327 | 328 | clp = lforw(clp); |
328 | 329 | tdotline++; |
329 | 330 | tbo = 0; |
333 | 334 | * always makes the last line empty so this is good. |
334 | 335 | */ |
335 | 336 | while (clp != (curbp->b_headp)) { |
337 | re_flags = REG_STARTEND; | |
338 | if (tbo != 0) | |
339 | re_flags |= REG_NOTBOL; | |
336 | 340 | regex_match[0].rm_so = tbo; |
337 | 341 | regex_match[0].rm_eo = llength(clp); |
338 | error = regexec(®ex_buff, ltext(clp), RE_NMATCH, regex_match, | |
339 | REG_STARTEND); | |
342 | error = regexec(®ex_buff, ltext(clp) ? ltext(clp) : "", | |
343 | RE_NMATCH, regex_match, re_flags); | |
340 | 344 | if (error != 0) { |
341 | 345 | clp = lforw(clp); |
342 | 346 | tdotline++; |
392 | 396 | * do this character-by-character after the first match since |
393 | 397 | * POSIX regexps don't give you a way to do reverse matches. |
394 | 398 | */ |
395 | while (!regexec(®ex_buff, ltext(clp), RE_NMATCH, regex_match, | |
396 | REG_STARTEND) && regex_match[0].rm_so < tbo) { | |
399 | while (!regexec(®ex_buff, ltext(clp) ? ltext(clp) : "", | |
400 | RE_NMATCH, regex_match, REG_STARTEND) && | |
401 | regex_match[0].rm_so <= tbo) { | |
397 | 402 | memcpy(&lastmatch, ®ex_match[0], sizeof(regmatch_t)); |
398 | 403 | regex_match[0].rm_so++; |
399 | 404 | regex_match[0].rm_eo = llength(clp); |
541 | 546 | /* see if line matches */ |
542 | 547 | regex_match[0].rm_so = 0; |
543 | 548 | regex_match[0].rm_eo = llength(clp); |
544 | error = regexec(®ex_buff, ltext(clp), RE_NMATCH, regex_match, | |
545 | REG_STARTEND); | |
549 | error = regexec(®ex_buff, ltext(clp) ? ltext(clp) : "", | |
550 | RE_NMATCH, regex_match, REG_STARTEND); | |
546 | 551 | |
547 | 552 | /* Delete line when appropriate */ |
548 | 553 | if ((cond == FALSE && error) || (cond == TRUE && !error)) { |
616 | 621 | /* see if line matches */ |
617 | 622 | regex_match[0].rm_so = 0; |
618 | 623 | regex_match[0].rm_eo = llength(clp); |
619 | error = regexec(®ex_buff, ltext(clp), RE_NMATCH, regex_match, | |
620 | REG_STARTEND); | |
624 | error = regexec(®ex_buff, ltext(clp) ? ltext(clp) : "", | |
625 | RE_NMATCH, regex_match, REG_STARTEND); | |
621 | 626 | |
622 | 627 | /* Count line when appropriate */ |
623 | 628 | if ((cond == FALSE && error) || (cond == TRUE && !error)) |