Commit Graph

155 Commits

Author SHA1 Message Date
mrg
1fcf7be45f - use -Wno-error=implicit-fallthrough with GCC7. 2019-02-04 04:05:15 +00:00
pgoyette
d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
rin
ed5ee5bf48 Fix description for -r option reflecting the actual behavior.
Suggested by christos on current-users.
2018-09-14 13:19:15 +00:00
rin
a05b1d7076 Use wp and wlen instead of ip and ilen for consistency.
No binary changes intended.
2018-08-07 11:41:23 +00:00
rin
5006b3769f Remove unnecessary buffer allocation and memcpy.
Partially taken from nvi2.
2018-08-07 11:25:45 +00:00
rin
f459985261 Add imctrl and imkey options, inspired by cannactrl and fepkey options in
nvi-m17n by itojun.

If imctrl option is set, input method is controlled by using escape
sequences compatible to Tera Term and RLogin. The state of input method in
commands specified by imkey option is saved and restored automatically.
Input method is then deactivated on returning to command mode.
2018-08-07 08:05:47 +00:00
rin
ae6aff383c As described in comments, we treat non-spacing chars as single-width ones. 2018-08-01 02:48:47 +00:00
kamil
54b8bd3463 Include <stddef.h> for offsetof(3) 2018-06-25 18:36:36 +00:00
kamil
17b10cd3f4 Specify SANITIZER_RENAME_SYMBOL in nvi
Rename local versions of regcomp regerror regexec regfree in order to
remove symbol clash with libc.
2018-06-25 18:00:34 +00:00
kamil
626dd188a2 Avoid unportable offsetof(3) calculation in nvi in log1.c
Detected with MKSANITIZER/UBSan.
2018-06-25 17:42:34 +00:00
kamil
b3019d4b3d Correct previous change to CHAR_T_OFFSET
The intended operation is offsetof(), not alignof().

Noted by <christos>
2018-06-16 21:00:12 +00:00
kamil
4e2759a682 Do not cause Undefined Behavior in vi(1)
Replace unportable manual calculation of alignof() that causes UB, with
a GCC extension __alignof__.

This fixes a problem reported by UBSan with the MKSANITIZER distribution.
2018-06-16 18:54:52 +00:00
christos
2357fc5dd5 use SUBDIR.roff suggested by uwe@ 2018-06-10 17:55:11 +00:00
rin
65b076fb4d Make sure that every wide char occupies at least one display width:
- Replace non-printable multibyte char with ?-symbol.
  - Put space before non-spacing char.

Fix problems reported in PR bin/53164 and
PR bin/53323, that are because we did not take into account non-printable
multibyte char of wctob(wc) == EOF && wcwidth(wc) == -1.
2018-06-03 08:08:36 +00:00
christos
bf7113376a Create a new bsd.hostinit.mk file and put the build definitions for all host
programs there; make all Makefiles that use bsd.hostprog.mk include it.
Namely turn off MKREPRO and don't make lint, man pages, info files etc.
Remove the Makefile.inc files that contained these same settings, and
remove the settings from Makefile.host
2018-05-01 19:59:42 +00:00
rin
91b8b0444c PR bin/53164: Comment why we abort here. 2018-04-10 12:44:41 +00:00
mrg
b9c2640a34 fix GCC 6.4 issues (finally a couple that aren't actual bugs,
but only weird code?):

amd's amfs_program_exec() has a missing {} issue.

flex's check_options() has odd inconsistent identation that
trips the new ident checker.

ntpd's oncore_check_leap_sec() and oncore_set_traim() have
missing {} issues.

sntp's optionLoadNested() an identation weirdness that
trips the new ident checker.

vi's cl_attr() has a wrong {} issue, and its vs_paint() has
an identation weirdness that trips the new ident checker.
2018-02-04 09:15:44 +00:00
jmcneill
76fae9132e When testing to see if a signal handler was previously installed in
h_winch, test sa_handler against all SIG_* actions defined in sys/signal.h
instead of just 0. Corrects an issue where vi crashes after a window is
resized.
2017-12-06 17:16:14 +00:00
rin
1597af3dd8 Compare ap->len wide chars, not ap->len bytes. 2017-12-01 20:01:31 +00:00
rin
c14a835e62 Check format strings for ex_printf. 2017-12-01 18:39:49 +00:00
rin
a90a8d8c63 Remove ex_printf duplicate with ex_extern.h. 2017-12-01 18:35:58 +00:00
rin
59cd10f512 Fix missing of "search wrapped" message when searching from the last char of
file, taken from nvi2:
a59e892d23
2017-11-22 16:17:30 +00:00
rin
f8052d784e Fix backward memcpy in :e +cmd, taken from nvi2 (and OpenBSD):
7ab02500a2
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/vi/ex/ex.c#rev1.21
2017-11-22 13:13:18 +00:00
rin
a07ca21052 Fix segmentation fault in corner case of backward sentence deletion,
taken from nvi2 (and Debian Bug report #193498):
e84d40ec20
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=193498
2017-11-22 12:47:30 +00:00
rin
7419ae3a04 Use ISMULTIWIDTH() macro. No binary changes. 2017-11-21 07:48:07 +00:00
rin
a8ee716c25 A boundary between single- and multi-width chars is regarded as a word boundary.
Suggested on tech-userland@ without any objections.
2017-11-21 07:43:47 +00:00
rin
f10703c63c Fix screen corruption by rewriting only a part of a multi-width character. 2017-11-21 06:35:22 +00:00
rin
b6a6fbff71 Bump WARNS to 5. Add -Wno-old-style-definition to regex.c for gcc. 2017-11-21 02:47:14 +00:00
rin
63e761a651 Enable -Wuninitialized -Wformat-security for clang. 2017-11-21 02:45:03 +00:00
rin
0c92db7399 We always need -Wno-format-nonliteral for v_increment.c whether compiler is
gcc or clang.
2017-11-21 02:44:13 +00:00
rin
a1deadaca4 Cosmetic changes. No functional changes. 2017-11-21 02:42:08 +00:00
rin
4fc00db461 Enable to compile & run without USE_ICONV. 2017-11-21 02:36:45 +00:00
rin
d43bd23851 Fix resource leaks due to missing of iconv_close(3). 2017-11-21 02:11:44 +00:00
rin
03a096c4f1 Fix -Wsign-compare issue for BINC_GOTO in a similar manner to BINC_RET. 2017-11-21 02:04:39 +00:00
rin
bd6bbecf8a Fix use of uninitialized variable, found by clang. 2017-11-21 02:00:29 +00:00
rin
3a5fc74837 Fix cursor movement for the case of USE_WIDECHAR != "yes", where the argument
of INTISWIDE() is not evaluated.
2017-11-14 12:20:55 +00:00
rin
d3727deea0 Protect iconv stuffs by USE_WIDECHAR in addition to USE_ICONV. 2017-11-13 04:21:55 +00:00
rin
4a32e20dee Sorry, remove illegal indents. Real fix for build with USE_WIDECHAR != "yes". 2017-11-13 04:09:41 +00:00
rin
66231ee6b4 - Add -Wno-unused and -Wno-unsequenced for gcc and clang, respectively.
This is because encoding conversion macros yield such like:

    #define FILE2INT5(sp,buf,n,nlen,w,wlen) (w = n, wlen = nlen, 0)

- Silence gcc warnings on nonliteral arguments for snprintf(3) in v_increment.c,
  that are overlooked for swprintf(3) in the case of USE_WIDECHAR == "yes".
2017-11-13 02:33:13 +00:00
rin
2b97f00020 Use mvwchgat(3), which is not a macro in general (and in our case). 2017-11-13 01:51:47 +00:00
rin
aee2cbfef0 Make sure to cast arguments of ISFOO and TOFOO macros into UCHAR_T. 2017-11-13 01:40:37 +00:00
rin
94d00a62d3 Use ISBLANK macro instead of isblank(3). 2017-11-13 01:37:48 +00:00
rin
0446123c92 Remove duplicate definition for ISUPPER.
No binary changes.
2017-11-13 01:34:59 +00:00
christos
ac02d96ecd PR/52671: Ralph Geier, return the wide character when changing case (because
it could be wide).
2017-11-12 16:33:31 +00:00
rin
2d83cf0dc9 _POSIX_VDISABLE exceeds CHAR_MAX. We thus need to cast it to CHAR_T for the
case where USE_WIDECHAR != "yes", i.e., CHAR_T is char.
2017-11-12 15:33:03 +00:00
rin
b72c72dd34 db_recno_t aka recno_t is uint32_t 2017-11-12 15:27:53 +00:00
rin
b6e834eb55 No need to cast endp in both cases of USE_WIDECHAR == "yes" nor "no".
Note that RCHAR_T is intended to use for bundled regex, not for nvi itself.
2017-11-12 15:26:33 +00:00
rin
b2095b2c80 Fix argument type of put() in common_extern.h 2017-11-12 15:23:51 +00:00
rin
4cf2a28bf8 Add missing encoding conversion before printing it. 2017-11-12 15:22:09 +00:00
christos
874da4738d Instead of opening the file and using popen(3), pass the file descriptor
to sendmail directory. Idea and code from Todd Miller.
2017-11-10 20:01:11 +00:00