History log of /openbsd-current/usr.bin/less/funcs.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.26 14-Apr-2024 guenther

Delete support for the LESSOPEN and LESSCLOSE environment variables
aka the "Input Preprocessor": it's been a source for multiple
security bugs in the past as everything has to deal with handling
arbitrary filenames and generally resulted in multiple TOCTOU issues.
The base system never included a default LESSOPEN setting like some
Linux distributions did, but it's a suds-filled sink full of knives
to try to use safely.

ok tb@ deraadt@ millert@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.25 02-Sep-2019 schwarze

Delete what remains of the support for combining characters into
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@)


# 1.24 31-Aug-2019 schwarze

New utility function mbtowc_left() because this functionality -
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@


# 1.23 15-May-2019 schwarze

trivial patch to at least make the buggy functions control_char()
and get_wchar() static for now - until they can be deleted


# 1.22 15-May-2019 schwarze

Clean up all major UTF-8 issues in cvt.c.
This also allows to delete the buggy, now unused function put_wchar().
OK millert@


# 1.21 07-May-2019 schwarze

Completely clean up UTF-8 handling in the file filename.c:
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@


Revision tags: OPENBSD_6_5_BASE
# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.25 02-Sep-2019 schwarze

Delete what remains of the support for combining characters into
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@)


# 1.24 31-Aug-2019 schwarze

New utility function mbtowc_left() because this functionality -
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@


# 1.23 15-May-2019 schwarze

trivial patch to at least make the buggy functions control_char()
and get_wchar() static for now - until they can be deleted


# 1.22 15-May-2019 schwarze

Clean up all major UTF-8 issues in cvt.c.
This also allows to delete the buggy, now unused function put_wchar().
OK millert@


# 1.21 07-May-2019 schwarze

Completely clean up UTF-8 handling in the file filename.c:
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@


Revision tags: OPENBSD_6_5_BASE
# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.24 31-Aug-2019 schwarze

New utility function mbtowc_left() because this functionality -
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@


# 1.23 15-May-2019 schwarze

trivial patch to at least make the buggy functions control_char()
and get_wchar() static for now - until they can be deleted


# 1.22 15-May-2019 schwarze

Clean up all major UTF-8 issues in cvt.c.
This also allows to delete the buggy, now unused function put_wchar().
OK millert@


# 1.21 07-May-2019 schwarze

Completely clean up UTF-8 handling in the file filename.c:
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@


Revision tags: OPENBSD_6_5_BASE
# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.23 15-May-2019 schwarze

trivial patch to at least make the buggy functions control_char()
and get_wchar() static for now - until they can be deleted


# 1.22 15-May-2019 schwarze

Clean up all major UTF-8 issues in cvt.c.
This also allows to delete the buggy, now unused function put_wchar().
OK millert@


# 1.21 07-May-2019 schwarze

Completely clean up UTF-8 handling in the file filename.c:
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@


Revision tags: OPENBSD_6_5_BASE
# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.21 07-May-2019 schwarze

Completely clean up UTF-8 handling in the file filename.c:
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@


Revision tags: OPENBSD_6_5_BASE
# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


# 1.20 01-Mar-2019 schwarze

Start UTF-8 cleanup of store_char(), in particular getting rid of
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@


Revision tags: OPENBSD_6_3_BASE OPENBSD_6_4_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_3_BASE
# 1.19 17-Mar-2018 krw

Split only LESS on $.

As guenther@ said "STOP SPLITTING ANYTHING BUT $LESS ON '$' !".

anton@ came up with the same diff. ok nicm@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.18 19-Jan-2016 mmcc

Remove the lintism PRINTFLIKE1, don't replace it with an attribute so we
can keep it portable.

also noticed by Michael Reed, discussed with deraadt@


# 1.17 15-Jan-2016 mmcc

remove needless extern keywords, a vestige of pre-ANSI C

explained by and ok millert@


# 1.16 12-Jan-2016 mmcc

Remove LINUNUM, a needless alias for off_t. Also, remove a redundant
condition.

ok nicm@


# 1.15 23-Nov-2015 nicm

Missing prototype.


# 1.14 21-Nov-2015 tedu

remove fancy null check function in favor of checking for null.
from Ricardo Mestre


# 1.13 13-Nov-2015 nicm

Add a flag argument to flush() to stop it calling quit() on error, then
use this from quit() to stop less blowing up the stack looping through
quit()/flush() if stderr is closed (for example "less /missing
2</dev/null"). ok millert


# 1.12 09-Nov-2015 deraadt

close_getchr() is now a noop


# 1.11 07-Nov-2015 tedu

replace save() with estrdup() and make estrdup() exit like all the other
ecalloc, etc. functions do.
ok mmcc nicm


# 1.10 06-Nov-2015 tedu

time_t is not a long. remove incorrect abstraction around time().
ok nicm


# 1.9 05-Nov-2015 nicm

Replace less with the cleaned-up fork of less 458 maintained by Garrett
D'Amore at https://github.com/gdamore/less-fork. This has significantly
less portability goop, has a tidied up code style, uses terminfo instead
of termcap, and is has stricter POSIX compliance.

Many of our local changes have been accepted upstream: substantial
remaining local changes are code to read help files from /usr/share
rather than compiling them in, man page and help improvements, and some
tweaks to the default options.

Review and testing by millert, ok deraadt


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.8 10-May-2014 schwarze

Give more(1) its own help file, shorter than the one for less(1).
The helpfile itself was prepared by jmc@, the glue by me.
OK millert@ jmc@


# 1.7 25-Apr-2014 shadchin

Merge Less 458 plus local patches

ok guenther@, ok jmc@ for man bits


Revision tags: OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.6 16-Sep-2011 shadchin

Merge in less 444 plus local changes

ok nicm@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE
# 1.5 07-Jun-2003 millert

Use interruptible syscalls instead of setjmp/longjmp. This makes
less's signal handlers safe. No one has reported problems so far...


# 1.4 14-Apr-2003 millert

o go back to using a help file instead of embedding it in the binary
o deal with HELPFILE not being defined
o add a SMALL definition to make a smaller less for the boot floppies
This still needs to be pared down a bit for the SMALL case


# 1.3 13-Apr-2003 millert

Merge in less-381 w/ local changes and remove obsolete files.


Revision tags: OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.2 29-Jan-2001 niklas

$OpenBSD$


# 1.1 21-Sep-1996 etheisen

branches: 1.1.1;
Initial revision