summaryrefslogtreecommitdiffstats
path: root/usr.bin/less (follow)
Commit message (Collapse)AuthorAgeFilesLines
* adjust a variable name in a comment after the reorg in signal.c rev. 1.18schwarze2019-09-041-1/+1
|
* less uses a correct raceless signal method of indicating signal events inderaadt2019-09-0315-61/+57
| | | | | | | | a volatile sig_atomic_t variable, and then processing events in the mainloop. But only one variable was used for 3 signals, with |= bit operations which are signal interruptable! Rewrite the code to use 3 independent variables and cleanup how the mainloop observes indications. ok schwarze
* Delete what remains of the support for combining characters intoschwarze2019-09-024-42/+7
| | | | | | | | | | | | | | ligatures: it was incomplete (only for the Arabic script and only for the single ligature LAM WITH ALEF) and it was implemented in a way that is unsustainable (with a static table inside less). If we ever want ligature support, we are better off making a fresh start. However, for languages like Arabic and Persian, even that wouldn't really be useful without having bidirectional support first. OK millert@ (and also considering comments from Mohammadreza Abdollahzadeh, Evan Silberman, and benno@)
* New utility function mbtowc_left() because this functionality -schwarze2019-08-313-45/+30
| | | | | | | decoding a UTF-8 multibyte character to the left of a given byte - is already needed at three places in line.c and will also be needed for cleanup work in cmdbuf.c in the future. OK millert@
* - more no longer accepts random less commandsjmc2019-08-202-34/+30
| | | | | | | | - history trim - sundry diff from evan silberman; tweaked/ok by schwarze and deraadt
* Correct misleading description of -S;schwarze2019-07-201-6/+4
| | | | problem reported by George Brown <321 dot george at gmail dot com> on tech@.
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-287-8/+8
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* asprintf returns -1, not an arbitrary value < 0. Also upon error thederaadt2019-06-281-1/+1
| | | | | | | (very sloppy specification) leaves an undefined value in *ret, so it is wrong to inspect it, the error condition is enough. discussed a little with nicm, and then much more with millert until we were exasperated
* In manpages, don't escape apostrophes as \'; it's rarely what you want.bentley2019-06-021-3/+3
| | | | | Most of these are correct just as '. A few benefit from Ql or \(aq. But if in doubt, just use '.
* use proper crossreferencesnaddy2019-05-261-4/+8
|
* trivial patch to at least make the buggy functions control_char()schwarze2019-05-152-4/+2
| | | | and get_wchar() static for now - until they can be deleted
* trivial replacement of the home-grown IS_ASCII_OCTET()schwarze2019-05-154-5/+3
| | | | with the standard isascii(3)
* Clean up all major UTF-8 issues in cvt.c.schwarze2019-05-153-46/+11
| | | | | This also allows to delete the buggy, now unused function put_wchar(). OK millert@
* UTF-8 cleanup in the function cmd_putstr().schwarze2019-05-151-18/+5
| | | | | | This function is only ever called with constant ASCII string arguments, so actually it doesn't need any UTF-8 handling whatsoever. OK millert@
* delete five unused macrosschwarze2019-05-091-5/+0
|
* UTF-8 cleanup in the function pshift().schwarze2019-05-091-39/+37
| | | | | | | | | | Use the standard functions mbtowc(3), wcwidth(3), iscntrl(3) instead of bad functions like get_wchar(), utf_len(), is_wide_char(), is_composing_char(), is_combining_char(), control_char(). If only half of a double-width character is shifted off screen, do not inspect anything following it because that clearly remains on-screen. Improve and add comments. OK millert@
* fix an obvious documentation bug: -# requires an argumentschwarze2019-05-071-6/+11
|
* Completely clean up UTF-8 handling in the file filename.c:schwarze2019-05-073-25/+12
| | | | | | | | | | Employ the usual form of an mbtowc(3) loop, eliminating two calls to the bad function step_char() and reducing the number of nested loops by one. This also removes the last caller of the bad function binary_char(), which is consequently deleted. While here, count ASCII C0 non-whitespace control characters as binary (except backspace and, with -R only, escape). OK millert@
* UTF-8 cleanup of the function pappend():schwarze2019-05-071-42/+42
| | | | | | | Use the standard function mbrtowc(3) to distinguish valid, incomplete, and invalid multibyte characters, getting rid of five calls to functions and macros that we want to phase out, and of one goto. Add comments. OK millert@.
* Cleanup and bugfix:schwarze2019-03-141-6/+8
| | | | | | | | When looking for uppercase characters, iterate over multibyte characters with the standard function mbtowc(3) rather than with the buggy and outdated step_char(), skipping invalid bytes, and correctly use iswupper(3) instead of the inapplicable isupper(3). OK stsp@
* UTF-8 cleanup in do_append() replacing calls to broken functions:schwarze2019-03-131-7/+11
| | | | | | | | * get_wchar() -> mbtowc(3) * is_composing_char() || is_combining_char() -> wcwidth(3) * control_char() -> !isprint(3) * is_ubin_char() -> !iswprint(3) OK millert@
* Clean up UTF-8 handling in backc():schwarze2019-03-121-8/+38
| | | | | | | | | Use wchar_t instead of LWCHAR and mbtowc(3) instead of step_char(). Play it safe and handle all error cases, even in the arguably unlikely case that linebuf[] contains UTF-8 encoding errors. Reset mbtowc(3) internal state after failure for portability, also in one place where mbtowc(3) was already introduced earlier. OK nicm@
* de-obfuscate by expanding three useless macros; no functional change;schwarze2019-03-011-24/+22
| | | | tweak and OK millert@
* Start UTF-8 cleanup of store_char(), in particular getting rid ofschwarze2019-03-012-38/+37
| | | | | | | | | | a call to the flawed function step_char(-1), using the standard function mbtowc(3) instead. Merge in in_ansi_esc_seq(), simplifying the code, and make the related functions is_ansi_end() and is_ascii_char() static because they are used in line.c only. OK nicm@, and no opposition when shown on tech@
* To simplify the upcoming UTF-8 cleanup in less(1), delete supportschwarze2019-02-264-19/+11
| | | | | | | | | | | | | | for ANSI escape sequences introduced by an 8-bit CSI (e.g. "\23343m") because these are neither compatible with UTF-8 nor strictly compatible with pure ASCII and for those introduced by an UTF-8 CSI (e.g. "\302\23343m") because not even xterm(1) supports them at all, not even with a non-default configuration, because both forms are very rarely used, if at all, and because the current code trying to support them doesn't even appear to work according to my tests. Full support for the ESC-[ CSI (e.g. "\033[43m") remains. Tweaks and OK millert@, OK nicm@, and sthen@ agrees with the general direction.
* To measure the display width of a wide character in pwidth(), useschwarze2019-02-241-35/+40
| | | | | | | | | | | | | | | | | the standard function wcwidth(3) instead of several hand-rolled functions accessing outdated local character tables, making this part of the code conform to our in-tree Unicode 10. Of course, with the current hand-rolled (and buggy) UTF-8 parser contained in less(1), this only works if wchar_t stores UCS-4 values and is more than 31 bits wide, but both will always be true on OpenBSD, and ultmately, we shall switch to mbtowc(3) for parsing anyway, lifting these restrictuons. The existence of the outdated character tables was originally called out by Evan Silberman on bugs@. OK stsp@
* Delete unnecessary <libgen.h> #includesguenther2018-12-301-1/+0
| | | | ok deraadt@
* Split only LESS on $.krw2018-03-173-9/+9
| | | | | | As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !". anton@ came up with the same diff. ok nicm@
* Fix use after free that caused the creation of a spurious file.krw2018-03-172-1/+3
| | | | | | As guenther@ said "fix whatever led to the \337 x 16 crap". anton@ came up with the same diff. ok nicm@
* Use CLOCK_MONOTONIC for the delay before printing "Calculating line numbers"jca2017-11-271-3/+23
| | | | from Scott Cheloha who's pushing this upstream. ok tb@
* After fstat(2) failure, trying lseek(2) is useless, so delete it.schwarze2017-10-291-16/+1
| | | | | Based on a smaller diff from Jesper Wallin <jesper at ifconfig dot se>. OK deraadt@
* When performing an inverted search in less, make sure to invalidate the matchanton2017-08-022-2/+5
| | | | | | | | | | bounds prior calling regexec(). In this inverted scenario a match is found when regexec() returns false causing the bounds to not be updated. This is problematic since the bounds will then refer to a previous match and future pointer arithmetic will eventually be off which is manifested in a SIGSEGV. Issue reported by Larry Hynes on tech@ ok martijn@ tb@
* remove redundant variable declarations in Makefiles, since those areespie2017-07-091-2/+1
| | | | | | the default. okay millert@
* While freeing tag entries, make sure to free the copied strings.millert2017-05-031-0/+2
| | | | From Anton Lindqvist. OK tobias@ nicm@
* control_char() for ASCII needs to include both genuine controlnicm2017-04-201-1/+3
| | | | | | | | characters and top-bit-set nonprintable characters (so both iscntrl() and !isprint()), fixes behaviour broken in r1.15/r1.16, noticed by deraadt@. ok deraadt tedu
* The character buffer should be resized using recallocarray()deraadt2017-04-021-2/+2
| | | | ok millert and nicm a while ago
* Fix the "t" command for the case where we go down by just a few lines:schwarze2017-01-121-0/+1
| | | | | clear the status before printing content on the last line of the screen. OK millert@ tom@
* Avoid an out of bounds read when the environment variable LESSBINFMTmillert2017-01-041-3/+4
| | | | is set to "*". Patch from Tobias Stoeckmann. OK tb@
* restore a not so redundant test. loopcount = -1 is a significant indicatortedu2016-12-301-1/+1
| | | | | to prevent printing the calculating message over and over. from Hugo Villeneuve
* Unify wording for LC_CTYPE in ENVIRONMENT:schwarze2016-10-241-3/+6
| | | | | | * Consistently use "character encoding locale" as suggested by stsp@. * Resolve various gratuitious wording variations. OK jmc@.
* little bit more KNFderaadt2016-09-1725-63/+63
|
* Check the MORE (or LESS) environment variables after forcing the variousnicm2016-08-281-4/+4
| | | | | more(1) options, so it is possible to change them using MORE. From Ross L Richardson. ok deraadt millert
* Pass errret pointer to setupterm() to prevent setupterm()millert2016-07-081-2/+7
| | | | | from calling exit() when given an unknown terminal type. From Anton Lindqvist, who also upstreamed the fix.
* Improve handling of ambiguous overstrike sequences. A sequence of _\b_natano2016-03-262-12/+24
| | | | | | | | | | | can either mean an underlined underscore or a bold underscore. This ambiguity can be 'resolved' by takeing the state of the surrounding text into account. If surrounded by bold text, the result should probably be bold and likewise for underlined. less(1) previously only looked at the preceding text and ul(1) didn't examine the context at all. tweaks and ok schwarze ok tb (on a previous version of the diff)
* style(9) includesmmcc2016-03-1616-27/+37
| | | | ok nicm@
* Wrap a macro's args in parentheses. No binary change.mmcc2016-03-161-2/+2
| | | | | | | | | I'm discussing with deraadt@ whether it's a good idea to convert some of these to functions. The one changed by this commit probably isn't eligible because it defines only a for loop's condition, but many others in less(1) should probably be converted. ok millert@
* Rename a local var so that we can call the global message buffer msg.mmcc2016-02-031-9/+10
| | | | ok nicm, tb
* sort includesmmcc2016-01-291-8/+7
| | | | from Michael Reed
* remove unneeded CHAR_BIT macrommcc2016-01-291-4/+0
| | | | from Michael Reed
* remove superfluous macrommcc2016-01-292-2/+1
| | | | ok nicm