diff --git a/.vscode/launch.json b/.vscode/launch.json index 19ad235..6312a72 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,11 +13,9 @@ "externalConsole": false, "logging": { "engineLogging": true }, "MIMode": "gdb", - // "miDebuggerPath": "${workspaceFolder}/dbin/gdb-chcp1257.BAT", "miDebuggerPath": "gdb.exe", "setupCommands": [ { "text": "-enable-pretty-printing", "description": "Enable GDB pretty printing", "ignoreFailures": true } ], - // "preLaunchTask": "${defaultBuildTask}", // PENDING: see , - "preLaunchTask": "Build (gcc; debug)" + "preLaunchTask": "${defaultBuildTask}", } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 806ff76..c36ec8f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,13 +1,29 @@ { "version": "2.0.0", "tasks": [ + { + "label": "Build (clang; debug)", + "type": "shell", + "command": "make", + "args": [ + "-f", + "Makefile.win", + "CC=clang", + "DEBUG=1" + ], + "group": "build", + "problemMatcher": [ + "$gcc" + ] + }, { "label": "Build (gcc; debug)", "type": "shell", "command": "make", "args": [ "-f", - "Makefile.win.mingw", + "Makefile.win", + "CC=gcc", "DEBUG=1" ], "group": { @@ -24,33 +40,45 @@ "command": "make", "args": [ "-f", - "Makefile.win.mingw", + "Makefile.win", "clean" ], - "group": { - "kind": "none" - }, + "group": "none", "problemMatcher": [ "$gcc" ] }, { + "label": "REBuild (clang; debug)", "type": "shell", - "label": "clang.exe build active file", - "command": "C:\\Users\\Roy\\AppData\\Local\\scoop\\apps\\clang\\7.0.0\\bin\\clang.exe", + "command": "make", "args": [ - "-g", - "${file}", - "-o", - "${fileDirname}\\${fileBasenameNoExtension}.exe" + "rebuild", + "-f", + "Makefile.win", + "CC=clang", + "DEBUG=1" ], - "options": { - "cwd": "C:\\Users\\Roy\\AppData\\Local\\scoop\\apps\\clang\\7.0.0\\bin" - }, + "group": "build", "problemMatcher": [ "$gcc" + ] + }, + { + "label": "REBuild (gcc; debug)", + "type": "shell", + "command": "make", + "args": [ + "rebuild", + "-f", + "Makefile.win", + "CC=gcc", + "DEBUG=1" ], - "group": "build" - } + "group": "build", + "problemMatcher": [ + "$gcc" + ] + }, ] } diff --git a/INSTALL.upstream b/INSTALL.upstream index 979aed6..aeaee7b 100644 --- a/INSTALL.upstream +++ b/INSTALL.upstream @@ -183,4 +183,3 @@ operates. script, and exit. `configure' also accepts some other, not widely useful, options. - diff --git a/LICENSE.upstream b/LICENSE.upstream index 07e5b40..65eda8c 100644 --- a/LICENSE.upstream +++ b/LICENSE.upstream @@ -24,4 +24,3 @@ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/Makefile.aut b/Makefile.aut index da763d4..7a0bef6 100644 --- a/Makefile.aut +++ b/Makefile.aut @@ -4,7 +4,7 @@ EMAIL = bug-less@gnu.org HOMEPAGE = http://www.greenwoodsoftware.com/less SHELL = /bin/sh GIT = git -NROFF = nroff -man +NROFF = nroff -t -man srcdir = . diff --git a/Makefile.win b/Makefile.win index 93f45e3..dc35ca7 100644 --- a/Makefile.win +++ b/Makefile.win @@ -1,24 +1,24 @@ # Makefile for `less` -# Windows version; MS Visual C/C++ -# make (GNU make) version - +# Cross-platform (bash/sh + CMD/PowerShell) +# `bcc32`, `cl`, `clang`, `embcc32`, and `gcc` (defaults to `CC=clang`) +# GNU make (gmake) compatible; ref: # Copyright (C) 2020 ~ Roy Ivy III ; MIT+Apache-2.0 license # NOTE: * requires `make` version 4.0+ (minimum needed for correct path functions) # NOTE: `make` doesn't handle spaces within file names without gyrations (see @@) -# `make -f Makefile.win.msvc` +# `make -f Makefile.win` -NAME := less ## empty/null => autoset to name of containing folder +NAME := less ## $()/empty/null => autoset to name of containing folder #### # spell-checker:ignore () brac cmdbuf forwback funcs ifile lessecho lesskey linenum lsystem optfunc opttbl scrsize ttyin # spell-checker:ignore (targets) realclean vclean veryclean -# spell-checker:ignore (make) CURDIR MAKEFLAGS SHELLSTATUS TERMERR TERMOUT abspath addprefix addsuffix endef eval findstring firstword gmake ifeq ifneq lastword notdir prepend undefine wordlist +# spell-checker:ignore (make) CURDIR MAKEFLAGS SHELLSTATUS TERMERR TERMOUT abspath addprefix addsuffix endef eval findstring firstword gmake ifeq ifneq lastword notdir patsubst prepend undefine wordlist # -# spell-checker:ignore (CC) DDEBUG DNDEBUG NDEBUG Ofast Werror Wextra Xclang Xlinker dumpmachine flto flto-visibility-public-std fpie nodefaultlib nologo nothrow +# spell-checker:ignore (CC) DDEBUG DNDEBUG NDEBUG Ofast Werror Wextra Xclang Xlinker bcc dumpmachine embcc flto flto-visibility-public-std fpie nodefaultlib nologo nothrow psdk # spell-checker:ignore (abbrev/acronyms) LLVM MSVC MinGW POSIX VCvars # spell-checker:ignore (jargon) autoset deps delims executables maint multilib # spell-checker:ignore (libraries) libcmt libgcc libstdc lmsvcrt lstdc stdext @@ -26,19 +26,57 @@ NAME := less ## empty/null => autoset to name of containing folder # spell-checker:ignore (shell/nix) mkdir printf rmdir uname # spell-checker:ignore (shell/win) COMSPEC SystemDrive SystemRoot findstr findstring mkdir windir # spell-checker:ignore (utils) goawk ilink -# spell-checker:ignore (vars) BQUOTE CFLAGS CPPFLAGS CXXFLAGS DEFINETYPE DQUOTE EXEEXT LDFLAGS LIBDIR LIBPATH MAKEDIR OBJ_deps OSID PAREN SQUOTE devnull falsey fileset punct truthy +# spell-checker:ignore (vars) CFLAGS CPPFLAGS CXXFLAGS DEFINETYPE EXEEXT LDFLAGS LIBPATH LIBs MAKEDIR OBJ_deps OBJs OSID PAREN devnull falsey fileset filesets globset globsets punct truthy + +#### + +LIBS := user32## list of any additional required libraries (space separated) + +DEFINETYPE := wn +OBJ_deps = ${SRC_DIR}/defines.h ${SRC_DIR}/less.h ${SRC_DIR}/funcs.h ${SRC_DIR}/cmd.h + +#### + +# `make ...` command line flags/options +ARCH := $()## default ARCH for compilation ([$(),...]); $()/empty/null => use CC default ARCH +CC_DEFINES := false## provide compiler info (as `CC_...` defines) to compiling targets ('truthy'-type) +COLOR := $(if $(or ${MAKE_TERMOUT},${MAKE_TERMERR}),true,false)## enable colorized output ('truthy'-type) +DEBUG := false## enable compiler debug flags/options ('truthy'-type) +STATIC := true## compile to statically linked executable ('truthy'-type) +VERBOSE := false## verbose `make` output ('truthy'-type) +MAKEFLAGS_debug := $(if $(findstring d,${MAKEFLAGS}),true,false)## Makefile debug output ('truthy'-type; default == false) ## NOTE: use `-d` or `MAKEFLAGS_debug=1`, `--debug[=FLAGS]` does not set MAKEFLAGS correctly (see ) + +#### + +OSID := $(or $(and $(filter .exe,$(patsubst %.exe,.exe,$(subst $() $(),_,${SHELL}))),$(filter win,${OS:Windows_NT=win})),nix)## OSID == [nix,win] +# for Windows OS, set SHELL to `%ComSpec%` or `cmd` (note: environment/${OS}=="Windows_NT" for XP, 2000, Vista, 7, 10 ...) +# * `make` may otherwise use an incorrect shell (eg, `bash`), if found; "syntax error: unexpected end of file" error output is indicative +ifeq (${OSID},win) +# use case and location fallbacks; note: assumes *no spaces* within the path values specified by ${ComSpec}, ${SystemRoot}, or ${windir} +COMSPEC := $(or ${ComSpec},${COMSPEC},${comspec}) +SystemRoot := $(or ${SystemRoot},${SYSTEMROOT},${systemroot},${windir}) +SHELL := $(firstword $(wildcard ${COMSPEC} ${SystemRoot}/System32/cmd.exe) cmd) +endif #### Start of system configuration section. #### -# * default to `clang` -CC = clang +CC_default := clang## default ${CC} ([$()/empty, ...]) + +CC := $(and $(filter-out default,$(origin CC)),${CC})## if defined, use any non-makefile defined value as default ## note: used to avoid a recursive definition of ${CC} within the the shell ${CC} presence check when determining default ${CC} +CC := $(or ${CC},$(if $(filter clang,${CC_default}),$(subst -FOUND,,$(filter clang-FOUND,$(shell clang --version 2>&1 && echo clang-FOUND || echo))),gcc))## * for CC_default of `clang` (if `clang` missing, fallback to `gcc`; via a portable shell test) +CC := $(or ${CC},${CC_default},gcc) CC_ID := $(lastword $(subst -,$() $(),${CC})) +#### * Compiler configuration + +OUT_obj_filesets := $()## union of all compiler intermediate build file globsets (space separated) + ifeq (,$(filter-out clang gcc,${CC_ID})) ## `clang` or `gcc` -CXX = ${CC:gcc=g}++ -LD = ${CXX} +CXX := ${CC:gcc=g}++ +LD := ${CXX} +%link = ${LD} ${LDFLAGS} ${LD_o}${1} ${2} ${3}## $(call %link,EXE,OBJs,LIBs); requires delayed expansion STRIP_CC_clang_OSID_nix := strip STRIP_CC_clang_OSID_win := llvm-strip STRIP_CC_gcc := strip @@ -60,7 +98,10 @@ CFLAGS_ARCH_32 := -m32 CFLAGS_ARCH_64 := -m64 CFLAGS_DEBUG_true := -DDEBUG -O0 -g CFLAGS_DEBUG_false := -DNDEBUG -O3 +# CFLAGS_STATIC_false := -shared +# CFLAGS_STATIC_true := -static CFLAGS_VERBOSE_true := -v +CFLAGS_check := -v CFLAGS_machine := -dumpmachine CFLAGS_v := --version CPPFLAGS := $() @@ -77,12 +118,14 @@ LDFLAGS := $() LDFLAGS_ARCH_32 := -m32 LDFLAGS_ARCH_64 := -m64 LDFLAGS_DEBUG_false := -Xlinker --strip-all +# LDFLAGS_STATIC_false := -pie +# LDFLAGS_STATIC_false := -shared # LDFLAGS_STATIC_true := -static -static-libgcc -static-libstdc++ LDFLAGS_STATIC_true := -static LDFLAGS_clang_nix := -lstdc++ LDFLAGS_gcc := -lstdc++ -LIBS := $() +LIBS := $(foreach lib,${LIBS},-l${lib}) # ifeq ($(CC),clang) # LDFLAGS_dynamic := -Wl,-nodefaultlib:libcmt -lmsvcrt # only works for MSVC targets @@ -92,12 +135,14 @@ LIBS := $() # # LDFLAGS_dynamic := -fpie # endif endif ## `clang` or `gcc` +OUT_obj_filesets := ${OUT_obj_filesets} $() *.o## `clang`/`gcc` intermediate files ifeq (cl,${CC_ID}) -CXX = cl -LD = link -STRIP = $() ## `cl` (MSVC) +CXX := ${CC} +LD := link +%link = ${LD} ${LDFLAGS} ${LD_o}${1} ${2} ${3}## $(call %link,EXE,OBJs,LIBs); requires delayed expansion +STRIP := $() ## ref: @@ ## /nologo :: startup without logo display ## /W3 :: set warning level to 3 [1..4, all; increasing level of warning scrutiny] @@ -116,16 +161,19 @@ STRIP = $() ## /MT :: static linking ## /MTd :: static debug linking ## /Fd:... :: program database file name +## /TC :: compile all SOURCE files as C +## /TP :: compile all SOURCE files as C++ ## /Zi :: generate complete debug information (as a *.PDB file) ## /Z7 :: generate complete debug information within each object file (no *.PDB file) ## * `link` ## ref: @@ -## /subsystem:console :: generate "Win32 character-mode" console application ## /incremental:no :: disable incremental linking (avoids size increase, useless for cold builds, with minimal time cost) ## /machine:I386 :: specify the target machine platform +## /subsystem:console,4.00 :: generate "Win32 character-mode" console application; 4.00 => minimum supported system is Win9x/NT; supported only by MSVC 9 (`cl` version "15xx") or less +## /subsystem:console,5.01 :: generate "Win32 character-mode" console application; 5.01 => minimum supported system is XP; supported by MSVC 10 (`cl` version "16xx") or later CFLAGS := /nologo /W3 /WX /EHsc /I "." /D "WIN32" /D "_CONSOLE" /D "_CRT_SECURE_NO_WARNINGS" CFLAGS_COMPILE_ONLY := -c -# CFLAGS_DEBUG_true = /D "DEBUG" /D "_DEBUG" /Od /Zi /Fd"${OUT_obj}/" +# CFLAGS_DEBUG_true = /D "DEBUG" /D "_DEBUG" /Od /Zi /Fd"${OUT_DIR_obj}/" CFLAGS_DEBUG_true := /D "DEBUG" /D "_DEBUG" /Od /Z7 CFLAGS_DEBUG_false := /D "NDEBUG" /Ox /O2 CFLAGS_DEBUG_true_STATIC_false := /MDd ## debug + dynamic @@ -134,67 +182,159 @@ CFLAGS_DEBUG_true_STATIC_true := /MTd ## debug + static CFLAGS_DEBUG_false_STATIC_true := /MT ## release + static CFLAGS_VERBOSE_true := $() CPPFLAGS := $() -CXXFLAGS := $() -LDFLAGS := /nologo /subsystem:console /incremental:no +CXXFLAGS := /TP +LDFLAGS := /nologo /incremental:no LDFLAGS_ARCH_32 := /machine:I386 +# CL version specific flags +LDFLAGS_CL1600+_false := /subsystem:console,4.00 +LDFLAGS_CL1600+_true := /subsystem:console,5.01 # VC6-specific flags ## /ignore:4254 :: suppress "merging sections with different attributes" warning (LNK4254) LDFLAGS_VC6_true := /ignore:4254 -LIBS := user32.lib -endif ## `cl` (MSVC) - -# ifeq (bcc32,${CC_ID}) -# # NOTE: *untested* configuration -# CXX = ${CC_ID} -# LD = ilink32 -# CFLAGS := -I. -O2 -w-pro -TWC -P-c -v- -d -f- -ff- -vi -# CFLAGS_COMPILE_ONLY := -c -# LDFLAGS := -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE -# LIBDIR = $(MAKEDIR)\..\lib -# LIBS = ${LIBDIR}\import32.lib ${LIBDIR}\cw32.lib -# endif ## `bcc32` (Borland) +CC_${CC_ID}_e := /Fe +CC_${CC_ID}_o := /Fo +LD_${CC_ID}_o := /out: -DEFINETYPE := wn -OBJ_deps := defines.h less.h funcs.h cmd.h +O_${CC_ID} := obj -# `make` command line flags/options -COLOR ?= $(if $(or ${MAKE_TERMOUT},${MAKE_TERMERR}),true,false)## enable colorized output ('truthy'-type) -DEBUG ?= false## enable compiler debug flags/options ('truthy'-type; default == false) -STATIC ?= true## compile to statically linked executable ('truthy'-type; default == true) -VERBOSE ?= false## verbose `make` output ('truthy'-type; default == false) -MAKEFLAGS_debug ?= $(if $(findstring d,${MAKEFLAGS}),true,false)## Makefile debug output ('truthy'-type; default == false) ## NOTE: use `-d` or `MAKEFLAGS_debug=1`, `--debug[=FLAGS]` does not set MAKEFLAGS correctly (see ) +LIBS := $(foreach lib,${LIBS},${lib}.lib) +endif ## `cl` (MSVC) +OUT_obj_filesets := ${OUT_obj_filesets} $() *.obj## `cl` intermediate files + +ifeq (bcc32,${CC_ID}) +## `bcc32` (Borland C++ 5.5.1 free command line tools) +CXX := ${CC} +LD := ilink32 +%link = ${LD} ${LDFLAGS} $(subst /,\,${2}), $(subst /,\,${1}),,$(subst /,\,${3})## $(call %link,EXE,OBJs,LIBs); requires delayed expansion +STRIP := $() + +# * find CC base directory (for include and library directories plus initialization code, as needed); note: CMD/PowerShell is assumed as `bcc32` is DOS/Windows-only +CC_BASEDIR := $(subst /,\,$(abspath $(firstword $(shell scoop which ${CC} 2>NUL) $(shell which ${CC} 2>NUL) $(shell where ${CC} 2>NUL))\..\..)) +LIB_DIRS := "${CC_BASEDIR}\lib" +LD_INIT_OBJ := "${CC_BASEDIR}\lib\c0x32.obj" + +# ref: BCCTool help file +# -q :: "quiet" * suppress compiler identification banner +# -O2 :: generate fastest possible code (optimize for speed) +# -TWC :: specify assembler option(s) ("WC") +# -P-c :: compile SOURCE.cpp as C++, all other extensions as C, and sets the default extension to .c +# -d :: merge duplicate strings +# -f- :: no floating point (avoids linking floating point libraries when not using floating point; linker errors will occur if floating point operations are used) +# -ff- :: use strict ANSI floating point rules (disables "fast floating point" optimizations) +# -v- :: turn off source level debugging and inline expansion on +# -vi :: turn on inline function expansion +# -w-pro :: disable warning "Call to function 'function' with no prototype" +#*was* CFLAGS := -q -O2 -TWC -P-c -d -f- -ff- -v- -vi -w-pro -I. -I"${CC_BASEDIR}\include" +CFLAGS := -q -O2 -P-c -d -f- -ff- -v- -vi -w-pro -I. -I"${CC_BASEDIR}\include" +CFLAGS_COMPILE_ONLY := -c +CPPFLAGS := $() +# -P :: compile all SOURCE files as C++ (regardless of extension) +CXXFLAGS := -P +# ref: @@ +# -q :: suppress command line banner +# -Tpe :: targets 32-bit windows EXE +# -v- :: disable debugging information +# -ap :: builds 32-bit console application +# -c :: treats case as significant in public and external symbols +# -x :: suppress creation of a MAP file +# -V4.0 :: specifies expected Windows version (4.0 == Windows 9x/NT+) +# -GF:AGGRESSIVE :: aggressively trims the working set of an application when the application is idle +# -L... :: specifies library search path +LDFLAGS := -q -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE -L${LIB_DIRS} ${LD_INIT_OBJ} + +CC_${CC_ID}_e := -e +CC_${CC_ID}_o := -o +LD_${CC_ID}_o := $() + +O_${CC_ID} := obj + +LIBS := import32.lib cw32.lib +endif ## `bcc32` (Borland) +OUT_obj_filesets := ${OUT_obj_filesets} $() *.obj *.ilc *.ild *.ilf *.ils *.tds## `bcc32` intermediate files + +ifeq (embcc32,${CC_ID}) +## `embcc32` (Embarcadero Borland C++ free command line tools) +CXX := ${CC} +LD := ilink32 +%link = ${LD} ${LDFLAGS} $(subst /,\,${2}), $(subst /,\,${1}),,$(subst /,\,${3})## $(call %link,EXE,OBJs,LIBs); requires delayed expansion +STRIP := $() + +# * find CC base directory (for include and library directories plus initialization code, as needed); note: CMD/PowerShell is assumed as `bcc32` is DOS/Windows-only +CC_BASEDIR := $(subst /,\,$(abspath $(firstword $(shell scoop which ${CC} 2>NUL) $(shell which ${CC} 2>NUL) $(shell where ${CC} 2>NUL))\..\..)) +LIB_DIRS := "${CC_BASEDIR}\lib\win32c\release";"${CC_BASEDIR}\lib\win32c\release\psdk" +LD_INIT_OBJ := "${CC_BASEDIR}\lib\c0x32.obj" + +# ref: @@ +# -q :: "quiet" * suppress compiler identification banner +# -O2 :: generate fastest possible code (optimize for speed) +# -TWC :: specify assembler option(s) ("WC") +# -P-c :: compile SOURCE.cpp as C++, all other extensions as C, and sets the default extension to .c +# -d :: merge duplicate strings +# -f- :: no floating point (avoids linking floating point libraries when not using floating point; linker errors will occur if floating point operations are used) +# -ff- :: use strict ANSI floating point rules (disables "fast floating point" optimizations) +# -v- :: turn off source level debugging and inline expansion on +# -vi :: turn on inline function expansion +# -w-pro :: disable warning "Call to function 'function' with no prototype" +#*was* CFLAGS := -q -O2 -TWC -P-c -v- -d -f- -vi -I. +CFLAGS := -q -O2 -P-c -d -f- -v- -vi -I. +CFLAGS_COMPILE_ONLY := -c +CFLAGS_check := --version +CFLAGS_v := --version +CPPFLAGS := $() +CXXFLAGS := -P +# ref: @@ +# -q :: suppress command line banner +# -Tpe :: targets 32-bit windows EXE +# -v- :: disable debugging information +# -ap :: builds 32-bit console application +# -c :: treats case as significant in public and external symbols +# -x :: suppress creation of a MAP file +# -V4.0 :: specifies expected Windows version (4.0 == Windows 9x/NT+) +# -GF:AGGRESSIVE :: aggressively trims the working set of an application when the application is idle +# -L... :: specifies library search path +LDFLAGS := -q -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE -L${LIB_DIRS} ${LD_INIT_OBJ} + +CC_${CC_ID}_e := -e +CC_${CC_ID}_o := -o +LD_${CC_ID}_o := $() + +O_${CC_ID} := obj + +LIBS := import32.lib cw32.lib +endif ## `embcc32` (Borland) +OUT_obj_filesets := ${OUT_obj_filesets} $() *.obj *.ilc *.ild *.ilf *.ils *.tds## `embcc32` intermediate files #### End of system configuration section. #### -OSID := $(or $(and $(filter .exe,$(patsubst %.exe,.exe,$(subst $() $(),_,${SHELL}))),$(filter win,${OS:Windows_NT=win})),nix)## OSID == [nix,win] - -# for Windows OS, set SHELL to `%ComSpec%` or `cmd` (note: environment/${OS}=="Windows_NT" for XP, 2000, Vista, 7, 10 ...) -# * `make` may otherwise use an incorrect shell (eg, `bash`), if found; "syntax error: unexpected end of file" error output is indicative -ifeq (${OSID},win) -# use case and location fallbacks; note: assumes *no spaces* within ${ComSpec}, ${SystemRoot}, or ${windir} -COMSPEC := $(or ${ComSpec},${COMSPEC},${comspec}) -SystemRoot := $(or ${SystemRoot},${SYSTEMROOT},${systemroot},${windir}) -SHELL := $(firstword $(wildcard ${COMSPEC} ${SystemRoot}/System32/cmd.exe) cmd) -endif - -#### - falsey := false 0 f n no off false := $() true := true truthy := ${true} + +devnull := $(if $(filter win,${OSID}),NUL,/dev/null) +int_max := 2147483647## largest signed 32-bit integer; used as arbitrary max expected list length + +NULL := $() +BACKSLASH := $()\$() +COMMA := , +DOT := . ESC := $()$()## literal ANSI escape character (required for ANSI color display output; also used for some string matching) -int_max := 2147483647## largest signed 32-bit integer; arbitrary max expected list length +HASH := \# +PAREN_OPEN := $()($() +PAREN_CLOSE := $())$() +SLASH := / +SPACE := $() $() + [lower] := a b c d e f g h i j k l m n o p q r s t u v w x y z [upper] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [alpha] := ${[lower]} ${[upper]} [digit] := 1 2 3 4 5 6 7 8 9 0 -[punct] = ~ ` ! @ ${HASH} ${DOLLAR} % ^ & * ${OPEN_PAREN} ${CLOSE_PAREN} _ - + = { } [ ] | ${BACKSLASH} : ; " ' < > ${COMMA} ? ${SLASH} . +[punct] := ~ ` ! @ ${HASH} ${DOLLAR} % ^ & * ${PAREN_OPEN} ${PAREN_CLOSE} _ - + = { } [ ] | ${BACKSLASH} : ; " ' < > ${COMMA} ? ${SLASH} ${DOT} -%not = $(if ${1},${false},${true}) -%eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) -%neq = $(call %not,$(call %eq,${1},${2})) +%not = $(if ${1},${false},$(or ${1},${true})) +%eq = $(or $(and $(findstring ${1},${2}),$(findstring ${2},${1})),$(if ${1}${2},${false},${true}))# note: `call %eq,$(),$()` => ${true} +%neq = $(if $(call %eq,${1},${2}),${false},$(or ${1},${2},${true}))# note: ${1} != ${2} => ${false}; ${1} == ${2} => first non-empty value (or ${true}) %falsey = $(firstword ${falsey}) %truthy = $(firstword ${truthy}) @@ -221,17 +361,31 @@ int_max := 2147483647## largest signed 32-bit integer; arbitrary max expected li %uc = $(call %tr,${[lower]},${[upper]},${1}) ifeq (${OSID},win) -%rm_dir = if EXIST "${1}" ${RMDIR} "${1}" && echo $(call %info_text,"${1}" removed) -%rm_file = if EXIST "${1}" ${RM} "${1}" && echo $(call %info_text,"${1}" removed) -%rm_fileset = $(if $(shell for %%G in (${1}) do ${RM} "%%G" >${devnull} && echo done),$(shell echo echo $(call %info_text,"${1}" removed)),) +%rm_dir = $(shell if EXIST "${1}" ${RMDIR} "${1}" && ${ECHO} ${true}) +%rm_file = $(shell if EXIST "${1}" ${RM} "${1}" && ${ECHO} ${true}) +%rm_file_globset = $(shell for %%G in (${1}) do ${RM} "%%G" >${devnull} && ${ECHO} ${true}) +else +%rm_dir = $(shell ls -d "${1}" >${devnull} 2>&1 && { ${RMDIR} "${1}" && ${ECHO} ${true}; } || true) +%rm_file = $(shell ls -d "${1}" >${devnull} 2>&1 && { ${RM} "${1}" && ${ECHO} ${true}; } || true) +%rm_file_globset = $(shell for file in ${1}; do ls -d "$${file}" >${devnull} 2>&1 && ${RM} "$${file}"; done && ${ECHO} "${true}") +endif +%rm_dirs = $(call %filter_map,%rm_dir,${1}) +%rm_dirs_verbose = $(call %filter_map,$(eval %f=$$(if $$(call %rm_dir,$${1}),$$(call %info,"$${1}" removed),))%f,${1}) +%rm_files = $(call %filter_map,%rm_file,${1}) +%rm_files_verbose = $(call %filter_map,$(eval %f=$$(if $$(call %rm_file,$${1}),$$(call %info,"$${1}" removed),))%f,${1}) +%rm_file_globsets = $(call %filter_map,%rm_file_globset,${1}) +%rm_file_globsets_verbose = $(call %filter_map,$(eval %f=$$(if $$(call %rm_file_globset,$${1}),$$(call %info,"$${1}" removed),))%f,${1}) + +ifeq (${OSID},win) +%shell_quote = $(call %tr,^ | < > %,^^ ^| ^< ^> ^%,${1}) else -%rm_dir = ls -d "${1}" >${devnull} 2>&1 && { ${RMDIR} "${1}" && echo ${ECHO_SQ}$(call %info_text,"${1}" removed)${ECHO_SQ}; } || true -%rm_file = ls -d "${1}" >${devnull} 2>&1 && { ${RM} "${1}" && echo ${ECHO_SQ}$(call %info_text,"${1}" removed)${ECHO_SQ}; } || true -%rm_fileset = for file in ${1}; do ls -d "${1}" >${devnull} 2>&1 && ${RM} "$${file}"; done && echo ${ECHO_SQ}$(call %info_text,"${1}" removed)${ECHO_SQ} || true +%shell_quote = '$(call %tr,','"'"',${1})' endif @mkdir_rule = ${1} : ${2} ; ${MKDIR} "$$@" +!shell_noop = ${ECHO} >${devnull} + #### color_black := $(if $(call %is_truthy,${COLOR}),${ESC}[0;30m,) @@ -275,6 +429,26 @@ override MAKEFLAGS_debug := $(call %as_truthy,$(or $(call %is_truthy,${MAKEFLAGS $(call %debug_var,OSID) $(call %debug_var,SHELL) +$(call %debug_var,CC) +$(call %debug_var,CXX) +$(call %debug_var,LD) +$(call %debug_var,CFLAGS) +$(call %debug_var,CPPFLAGS) +$(call %debug_var,CXXFLAGS) +$(call %debug_var,LDFLAGS) + +CC_e := $(or ${CC_${CC_ID}_e},-o${SPACE}) +CC_o := $(or ${CC_${CC_ID}_o},-o${SPACE}) +LD_o := $(or ${LD_${CC_ID}_o},-o${SPACE}) + +$(call %debug_var,CC_e) +$(call %debug_var,CC_o) +$(call %debug_var,LD_o) + +O := $(or ${O_${CC_ID}},o) + +$(call %debug_var,O) + $(call %debug_var,COLOR) $(call %debug_var,DEBUG) $(call %debug_var,STATIC) @@ -285,17 +459,17 @@ $(call %debug_var,MAKEFLAGS_debug) #### # require at least `make` v4.0 (minimum needed for correct path functions) -MAKE_VERSION_major := $(word 1,$(subst ., ,$(MAKE_VERSION))) -MAKE_VERSION_minor := $(word 2,$(subst ., ,$(MAKE_VERSION))) -MAKE_VERSION_fail := $(filter $(MAKE_VERSION_major),3 2 1 0) +MAKE_VERSION_major := $(word 1,$(subst ., ,${MAKE_VERSION})) +MAKE_VERSION_minor := $(word 2,$(subst ., ,${MAKE_VERSION})) +MAKE_VERSION_fail := $(filter ${MAKE_VERSION_major},3 2 1 0) ifeq (${MAKE_VERSION_major},4) -MAKE_VERSION_fail := $(filter $(MAKE_VERSION_minor),) +MAKE_VERSION_fail := $(filter ${MAKE_VERSION_minor},) endif $(call %debug_var,MAKE_VERSION) $(call %debug_var,MAKE_VERSION_major) $(call %debug_var,MAKE_VERSION_minor) $(call %debug_var,MAKE_VERSION_fail) -ifneq ($(MAKE_VERSION_fail),) +ifneq (${MAKE_VERSION_fail},) $(call %error,`make` v4.0+ required (currently using v${MAKE_VERSION})) endif @@ -312,24 +486,8 @@ $(call %debug_var,LIB) #### -devnull := $(if $(filter win,${OSID}),NUL,/dev/null) -, := , -COMMA := , -DOT := . -HASH := \# -BQUOTE := ` -DQUOTE := " -SQUOTE := ' -SLASH := / -OPEN_PAREN := $()($() -CLOSE_PAREN := $())$() -BACKSLASH := $()\$() -NULL := $() -SPACE := $() $() - # detect ${CC} -CC_check_flags := $(if $(filter cl,${CC_ID}),,-v) -ifeq (,$(shell "${CC}" ${CC_check_flags} >${devnull} 2>&1 && echo ${CC} present)) +ifeq (,$(shell "${CC}" ${CFLAGS_check} >${devnull} 2>&1 && echo ${CC} present)) $(call %error,Missing required compiler (`${CC}`)) endif @@ -338,7 +496,7 @@ $(call %error,'s within project directory may cause issues) endif # Since we rely on paths relative to the makefile location, abort if make isn't being run from there. -ifneq ($(makefile_dir),$(current_dir)) +ifneq (${makefile_dir},${current_dir}) $(call %error,Invalid current directory; this makefile must be invoked from the directory it resides in) endif @@ -346,13 +504,9 @@ endif OS_PREFIX= ifeq (${OSID},win) -OSID_name ?= windows +OSID_name := windows OS_PREFIX := win. -CC_e := $(or $(if $(filter cl,${CC_ID}),/Fe),-o${SPACE}) -CC_o := $(or $(if $(filter cl,${CC_ID}),/Fo),-o${SPACE}) -LD_o := $(or $(if $(filter cl,${CC_ID}),/out:),-o${SPACE}) EXEEXT := .exe -O := $(if $(filter cl,${CC_ID}),obj,o) # AWK := gawk ## from `scoop install gawk`; or "goawk" from `go get github.com/benhoyt/goawk` CAT := "${SystemRoot}\System32\findstr" /r .* @@ -367,18 +521,13 @@ FIND := "${SystemRoot}\System32\find" FINDSTR := "${SystemRoot}\System32\findstr" MORE := "${SystemRoot}\System32\more" SORT := "${SystemRoot}\System32\sort" +WHICH := where # -ECHO_NL := echo: -ECHO_DQ := $() -ECHO_SQ := $() +ECHO_newline := echo. else OSID_name ?= $(shell uname | tr '[:upper:]' '[:lower:]') OS_PREFIX := ${OSID_name}. -CC_e := -o${SPACE} -CC_o := -o${SPACE} -LD_o := -o${SPACE} EXEEXT := $() -O := o # AWK := awk CAT := cat @@ -390,17 +539,25 @@ RM := rm RM_r := ${RM} -r RMDIR := ${RM} -r SORT := sort +WHICH := which # -ECHO_NL := echo -ECHO_DQ := " -ECHO_SQ := ' +ECHO_newline := echo endif -# calculate `strip` for ${CC_ID} and ${OSID} -STRIP := $(or ${STRIP_CC_${CC_ID}_OSID_${OSID}}, ${STRIP_CC_${CC_ID}}, ${STRIP}) -$(call %debug_var,STRIP) -# * and... ${STRIP} available? (missing in some distributions) +# find/calculate best available `strip` STRIP_check_flags := --version +# * calculate `strip`; general overrides for ${CC_ID} and ${OSID} +STRIP := $(or ${STRIP_CC_${CC_ID}_OSID_${OSID}},${STRIP_CC_${CC_ID}},${STRIP}) +# $(call %debug_var,STRIP) +# * available as ${CC}-prefixed variant? +STRIP_CC_${CC}_name := $(call %neq,${CC:-${CC_ID}=-strip},${CC}) +$(call %debug_var,STRIP_CC_${CC}_name) +STRIP_CC_${CC} := $(or ${STRIP_CC_${CC}},$(and ${STRIP_CC_${CC}_name},$(shell "${STRIP_CC_${CC}_name}" ${STRIP_check_flags} >${devnull} 2>&1 && echo ${STRIP_CC_${CC}_name}))) +$(call %debug_var,STRIP_CC_${CC}) +# * calculate `strip`; specific overrides for ${CC} +STRIP := $(or ${STRIP_CC_${CC}},${STRIP}) +# $(call %debug_var,STRIP) +# * and... ${STRIP} available? (missing in some distributions) STRIP := $(shell "${STRIP}" ${STRIP_check_flags} >${devnull} 2>&1 && echo ${STRIP}) $(call %debug_var,STRIP) @@ -427,12 +584,11 @@ endif #### -ARCH_default := i686 -ARCH_i686 := i686 x86 -ARCH_x86_64 := x64 x86_64 -ARCH_allowed := $(sort 32 x32 ${ARCH_i686} 64 ${ARCH_x86_64}) +ARCH_x86 := i386 i586 i686 x86 +ARCH_x86_64 := amd64 x64 x86_64 x86_amd64 +ARCH_allowed := $(sort 32 x32 ${ARCH_x86} 64 ${ARCH_x86_64}) ifneq (${ARCH},$(filter ${ARCH},${ARCH_allowed})) -$(call %error,Unknown architecture "$(ARCH)"; valid values are [""$(subst $(SPACE),$(),$(addprefix ${COMMA}${DQUOTE},$(addsuffix ${DQUOTE},${ARCH_allowed})))]) +$(call %error,Unknown architecture "$(ARCH)"; valid values are [""$(subst $(SPACE),$(),$(addprefix ${COMMA}",$(addsuffix ",${ARCH_allowed})))]) endif ifeq (${OSID},win) @@ -441,11 +597,11 @@ else ## nix CC_machine_raw := $(shell ${CC} ${CFLAGS_machine} 2>&1 | ${GREP} -n ".*" | ${GREP} "^1:" ) endif CC_machine_raw := $(subst ${ESC}1:,$(),${ESC}${CC_machine_raw}) -CC_ARCH := $(or $(filter $(subst -, ,${CC_machine_raw}),${ARCH_i686} ${ARCH_x86_64}),${ARCH_default}) -CC_machine := $(or $(and $(call %eq,cl,${CC}),${CC_ARCH}),${CC_machine_raw}) -CC_ARCH_ID := $(if $(filter ${CC_ARCH},32 x32 ${ARCH_i686}),32,64) +CC_ARCH := $(or $(filter $(subst -, ,${CC_machine_raw}),${ARCH_x86} ${ARCH_x86_64}),i686)## fallback to "i686" for ${CC_ARCH} if not found from ${CC_machine_raw} +CC_machine := $(or $(and $(filter cl bcc32,${CC_ID}),${CC_ARCH}),${CC_machine_raw}) +CC_ARCH_ID := $(if $(filter ${CC_ARCH},32 x32 ${ARCH_x86}),32,64) override ARCH := $(or ${ARCH},${CC_ARCH}) -ARCH_ID := $(if $(filter ${ARCH},32 x32 ${ARCH_i686}),32,64) +ARCH_ID := $(if $(filter ${ARCH},32 x32 ${ARCH_x86}),32,64) $(call %debug_var,CC_machine_raw) $(call %debug_var,CC_machine) @@ -492,7 +648,8 @@ CC_version_m := $(strip $(word 2,${CC_version_parts})) CC_version_r := $(strip $(word 3,${CC_version_parts})) CC_version_Mm := $(strip ${CC_version_M}.${CC_version_m}) -is_VC6 := $(and $(call %eq,cl,${CC}),$(call %eq,12,${CC_version_M}),${true}) +is_CL1600+ := $(call %as_truthy,$(and $(call %eq,cl,${CC}),$(call %not,$(filter ${CC_version_M},0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)),${true})) +is_VC6 := $(call %as_truthy,$(and $(call %eq,cl,${CC}),$(call %eq,12,${CC_version_M}),${true})) $(call %debug_var,CC_version) $(call %debug_var,CC_version_parts) @@ -500,6 +657,7 @@ $(call %debug_var,CC_version_M) $(call %debug_var,CC_version_m) $(call %debug_var,CC_version_r) $(call %debug_var,CC_version_Mm) +$(call %debug_var,is_CL1600+) $(call %debug_var,is_VC6) #### @@ -528,23 +686,29 @@ $(call %debug_var,OUT_DIR_EXT) CFLAGS += ${CFLAGS_ARCH_${ARCH_ID}} CFLAGS += ${CFLAGS_TARGET} CFLAGS += ${CFLAGS_DEBUG_${DEBUG}} +CFLAGS += ${CFLAGS_STATIC_${STATIC}} CFLAGS += ${CFLAGS_DEBUG_${DEBUG}_STATIC_${STATIC}} CFLAGS += ${CFLAGS_VERBOSE_${VERBOSE}} +CPPFLAGS += $(if $(call %is_truthy,${CC_DEFINES}),-D_CC="${CC}" -D_CC_ID="${CC_ID}" -D_CC_version="${CC_version}" -D_CC_machine="${CC_machine}" -D_CC_target="${TARGET}" -D_CC_target_arch="${ARCH_ID}",$()) + CXXFLAGS += ${CXXFLAGS_${CC_ID}} LDFLAGS += ${LDFLAGS_ARCH_${ARCH_ID}} LDFLAGS += ${LDFLAGS_TARGET} LDFLAGS += ${LDFLAGS_STATIC_${STATIC}} +LDFLAGS += ${LDFLAGS_CL1600+_${is_CL1600+}} LDFLAGS += ${LDFLAGS_VC6_${is_VC6}} LDFLAGS += ${LDFLAGS_${CC_ID}} LDFLAGS += ${LDFLAGS_${CC_ID}_${OSID}} CFLAGS := $(strip ${CFLAGS}) +CPPFLAGS := $(strip ${CPPFLAGS}) CXXFLAGS := $(strip ${CXXFLAGS}) LDFLAGS := $(strip ${LDFLAGS}) $(call %debug_var,CFLAGS) +$(call %debug_var,CPPFLAGS) $(call %debug_var,CXXFLAGS) $(call %debug_var,LDFLAGS) @@ -580,14 +744,14 @@ endif #### -BUILD_DIR ?= ${HASH}build -CONFIG ?= $(if $(call %is_truthy,${DEBUG}),debug,release) +BUILD_DIR := ${HASH}build +CONFIG := $(if $(call %is_truthy,${DEBUG}),debug,release) SRC_DIR := . OUT_DIR := . -OUT_bin := . -OUT_obj := . -out_dirs := $(strip $(call %uniq,${OUT_DIR} ${OUT_bin} ${OUT_obj})) +OUT_DIR_bin := . +OUT_DIR_obj := . +out_dirs := $(strip $(call %uniq,${OUT_DIR} ${OUT_DIR_bin} ${OUT_DIR_obj})) out_dirs_for_rules := $(strip $(subst ${HASH},${BACKSLASH}${HASH},${out_dirs})) $(call %debug_var,out_dirs) @@ -595,9 +759,9 @@ $(call %debug_var,out_dirs_for_rules) SRC_files := $(wildcard ${SRC_DIR}/*.c ${SRC_DIR}/*.cpp ${SRC_DIR}/*.cxx) OBJ_files := $(SRC_files) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.c=${OUT_obj}/%.${O}) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.cpp=${OUT_obj}/%.${O}) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.cxx=${OUT_obj}/%.${O}) +OBJ_files := $(OBJ_files:${SRC_DIR}/%.c=${OUT_DIR_obj}/%.${O}) +OBJ_files := $(OBJ_files:${SRC_DIR}/%.cpp=${OUT_DIR_obj}/%.${O}) +OBJ_files := $(OBJ_files:${SRC_DIR}/%.cxx=${OUT_DIR_obj}/%.${O}) $(call %debug_var,SRC_DIR) $(call %debug_var,SRC_files) @@ -605,50 +769,48 @@ $(call %debug_var,OBJ_files) #### -PROJECT_TARGET := ${OUT_bin}/${NAME}${EXEEXT} +PROJECT_TARGET := ${OUT_DIR_bin}/${NAME}${EXEEXT} ${PROJECT_TARGET}: # *default* target (see recipe/rule below) #### AUX_names := lessecho lesskey -AUX_targets := $(addprefix ${OUT_bin}/,$(addsuffix ${EXEEXT},${AUX_names})) +AUX_targets := $(addprefix ${OUT_DIR_bin}/,$(addsuffix ${EXEEXT},${AUX_names})) $(call %debug_var,AUX_names) $(call %debug_var,AUX_targets) -OBJ_files := $(filter-out $(addprefix ${SRC_DIR}/,$(addsuffix .c,${AUX_names} scrsize)),${SRC_files}) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.c=${OUT_obj}/%.${O}) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.cpp=${OUT_obj}/%.${O}) -OBJ_files := $(OBJ_files:${SRC_DIR}/%.cxx=${OUT_obj}/%.${O}) +OBJ_files := $(filter-out $(addprefix ${OUT_DIR_obj}/,$(addsuffix .${O},${AUX_names} scrsize)),${OBJ_files}) $(call %debug_var,OBJ_files) #### -${AUX_targets}: %${EXEEXT}: %.${O} version.${O} ${makefile_abs_path} | ${OUT_bin} - ${LD} ${LDFLAGS} "$<" "version.${O}" ${LIBS} ${LD_o}"$@" +${AUX_targets}: %${EXEEXT}: %.${O} version.${O} ${makefile_abs_path} | ${OUT_DIR_bin} + $(call %link,"$@","$<" "version.${O}",${LIBS}) $(if $(and ${STRIP},$(call %is_falsey,${DEBUG})),${STRIP} "$@",) - @${ECHO} ${ECHO_DQ}$(call %success_text,made '$@'.)${ECHO_DQ} + @${ECHO} $(call %shell_quote,$(call %success_text,made '$@'.)) -${OBJ_files}: ${OBJ_deps} | ${OUT_obj} +${OBJ_files}: ${OBJ_deps} | ${OUT_DIR_obj} -defines.h: defines.${DEFINETYPE} - ${CP} defines.${DEFINETYPE} defines.h +${SRC_DIR}/defines.h: ${SRC_DIR}/defines.${DEFINETYPE} + @${CP} "$<" "$@" >${devnull} + @${ECHO} $(call %shell_quote,$(call %info_text,created '$@' from '$<'.)) #### .PHONY: help help: ## Display help - @${ECHO} ${BQUOTE}${make_invoke_alias}${BQUOTE} - @${ECHO} Usage: ${BQUOTE}${make_invoke_alias} [ARCH=..] [COLOR=..] [DEBUG=..] [STATIC=..] [TARGET=..] [VERBOSE=..] [MAKE_TARGET...]${BQUOTE} - @${ECHO} Builds ${SQUOTE}${PROJECT_TARGET}${SQUOTE} within ${DQUOTE}$(current_dir)${DQUOTE} - @${ECHO_NL} - @${ECHO} MAKE_TARGETs: - @${ECHO_NL} + @${ECHO} $(call %shell_quote,`${make_invoke_alias}`) + @${ECHO} $(call %shell_quote,Usage: `${make_invoke_alias} [ARCH=..] [CC_DEFINES=..] [COLOR=..] [DEBUG=..] [STATIC=..] [TARGET=..] [VERBOSE=..] [MAKE_TARGET...]`) + @${ECHO} $(call %shell_quote,Builds '${PROJECT_TARGET}' within "$(current_dir)") + @${ECHO_newline} + @${ECHO} $(call %shell_quote,MAKE_TARGETs:) + @${ECHO_newline} ifeq (${OSID},win) @${FINDSTR} "^[a-zA-Z-]*:.*${HASH}${HASH}" "${makefile_path}" | ${SORT} | for /f "tokens=1-2,* delims=:${HASH}" %%g in ('${MORE}') do @(@call set "t=%%g " & @call echo ${color_success}%%t:~0,15%%${color_reset} ${color_info}%%i${color_reset}) else - @${GREP} -P "(?i)^[[:alpha:]-]+:" "${makefile_path}" | ${SORT} | ${AWK} 'match($$0,"^([[:alpha:]]+):.*?${HASH}${HASH}\\s*(.*)$$",m){ printf "${color_success}%-10s${color_reset}\t${color_info}%s${color_reset}\n", m[1], m[2] }' + @${GREP} -P "(?i)^[[:alpha:]-]+:" "${makefile_path}" | ${SORT} | ${AWK} 'match($$0,"^([[:alpha:]]+):.*?${HASH}${HASH}\\s*(.*)$$",m){ printf "${color_success}%-10s${color_reset}\t${color_info}%s${color_reset}\n", m[1], m[2] }END{printf "\n"}' endif .PHONY: run @@ -659,21 +821,21 @@ run: ${PROJECT_TARGET} ## Build/execute project executable .PHONY: clean clean: ## Remove build artifacts (including intermediate files) - @$(call %rm_fileset,*.${O}) - @$(call %rm_file,defines.h) - @$(call %rm_file,${PROJECT_TARGET}) - @$(call %rm_files,${AUX_targets}) + @$(call !shell_noop,$(call %rm_file_globsets_verbose,$(call %uniq,$(foreach fileset,${OUT_obj_filesets},${OUT_DIR_obj}/${fileset})))) + @$(call !shell_noop,$(call %rm_files_verbose,defines.h)) + @$(call !shell_noop,$(call %rm_files_verbose,${PROJECT_TARGET})) + @$(call !shell_noop,$(call %rm_files_verbose,${AUX_targets})) #### .PHONY: all build build-aux compile realclean rebuild vclean veryclean -all: build build-aux ## Build all project executables +all: build build-aux ## Build all project targets build: ${PROJECT_TARGET} ## Build project (`less`) build-aux: ${AUX_targets} ## Build auxillary executables (`lessecho` and `lesskey`) compile: ${OBJ_files} ## Build intermediate files realclean: clean rebuild: clean build ## Clean and rebuild project -vclean: realclean +vclean: veryclean veryclean: realclean #### @@ -681,19 +843,21 @@ veryclean: realclean # ref: [`make` default rules] @@ # ref: [make ~ `eval()`](http://make.mad-scientist.net/the-eval-function) @ -${PROJECT_TARGET}: ${OBJ_files} ${makefile_abs_path} | ${OUT_bin} - ${LD} ${LDFLAGS} $(addprefix ",$(addsuffix ",${OBJ_files})) ${LIBS} ${LD_o}"$@" +${PROJECT_TARGET}: ${OBJ_files} ${makefile_abs_path} | ${OUT_DIR_bin} + $(call %link,"$@",$(addprefix ",$(addsuffix ",${OBJ_files})),${LIBS}) $(if $(and ${STRIP},$(call %is_falsey,${DEBUG})),${STRIP} "$@",) - @${ECHO} ${ECHO_DQ}$(call %success_text,made '$@'.)${ECHO_DQ} + @${ECHO} $(call %shell_quote,$(call %success_text,made '$@'.)) -${OUT_obj}/%.${O}: ${SRC_DIR}/%.c ${makefile_abs_path} | ${OUT_obj} - ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} "$<" ${CC_o}"$@" +${OUT_DIR_obj}/%.${O}: ${SRC_DIR}/%.c ${makefile_abs_path} | ${OUT_DIR_obj} + ${CC} ${CC_o}"$@" ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} "$<" -${OUT_obj}/%.${O}: ${SRC_DIR}/%.cpp ${makefile_abs_path} | ${OUT_obj} - ${CXX} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CXXFLAGS} ${CFLAGS} "$<" ${CC_o}"$@" +${OUT_DIR_obj}/%.${O}: ${SRC_DIR}/%.cpp ${makefile_abs_path} | ${OUT_DIR_obj} + ${CXX} ${CC_o}"$@" ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} "$<" -${OUT_obj}/%.${O}: ${SRC_DIR}/%.cxx ${makefile_abs_path} | ${OUT_obj} - ${CXX} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CXXFLAGS} ${CFLAGS} "$<" ${CC_o}"$@" -#or ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} "$<" ${CC_o}"$@" +${OUT_DIR_obj}/%.${O}: ${SRC_DIR}/%.cxx ${makefile_abs_path} | ${OUT_DIR_obj} + ${CXX} ${CC_o}"$@" ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS} "$<" +# or ${CC} ${CC_o}"$@" ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} "$<" + +#### -$(foreach dir,${out_dirs_for_rules},$(eval $(call @mkdir_rule,${dir}))) +$(foreach dir,$(filter-out . ..,${out_dirs_for_rules}),$(eval $(call @mkdir_rule,${dir}))) diff --git a/Makefile.win.borland b/Makefile.win.borland deleted file mode 100644 index 1f0d8be..0000000 --- a/Makefile.win.borland +++ /dev/null @@ -1,93 +0,0 @@ -# Makefile for less. -# Windows version -# Borland C++ 5.5.1 free command line tools - -# spell-checker:ignore (targets) distclean realclean vclean veryclean -# spell-checker:ignore (make) abspath firstword ifeq ifndef ifneq lastword undefine vclean veryclean -# -# spell-checker:ignore (acronyms/names) Borland Borland's LLVM MSVC MinGW POSIX VCvars -# spell-checker:ignore (flags/options) DDEBUG DNDEBUG NDEBUG Werror Wextra Xclang defaultlib dumpmachine flto flto-visibility-public-std libcmt nologo nothrow -# spell-checker:ignore (jargon) multilib -# spell-checker:ignore (shell/win) COMSPEC SystemDrive SystemRoot findstr findstring windir -# spell-checker:ignore (utils) ilink nmake printf -# spell-checker:ignore (vars) BQUOTE CFLAGS CPPFLAGS CXXFLAGS DEFINETYPE DQUOTE EXEEXT LDFLAGS LIBDIR LIBPATH MAKEDIR OBJDEP SHELLSTATUS devnull mkfile -# spell-checker:ignore () brac cmdbuf forwback funcs ifile lessecho lesskey linenum lsystem optfunc opttbl stdext ttyin - -#### Start of system configuration section. #### -# -# Borland's make knows its own location in the -# filesystem. -# - -CC = bcc32 -LIBDIR = $(MAKEDIR)\..\lib - -CFLAGS = -O2 -w-pro -TWC -P-c -v- -d -f- -ff- -vi -LDFLAGS = -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE -LD = ilink32 -LIBS = ${LIBDIR}\import32.lib ${LIBDIR}\cw32.lib - -#### End of system configuration section. #### - -# Set SHELL to `cmd` for Windows OS (note: environment/${OS}=="Windows_NT" for XP, 2000, Vista, 7, 10 ...) -# * `make` may otherwise use an incorrect shell (eg, `bash`), if found; "syntax error: unexpected end of file" error output is indicative -ifeq (${OS},Windows_NT) - # use case and location fallbacks; note: assumes *no spaces* within ${ComSpec}, ${SystemRoot}, or ${windir} - COMSPEC := $(or ${ComSpec},${COMSPEC},${comspec}) - SystemRoot := $(or ${SystemRoot},${SYSTEMROOT},${systemroot},${windir}) - SHELL := $(firstword $(wildcard ${COMSPEC} ${SystemRoot}/System32/cmd.exe) cmd) -endif -# $(info SHELL=${SHELL}) - -#### - -# -# This rule allows us to supply the necessary -D options -# in addition to whatever the user asks for. -# -.c.obj: - ${CC} -c -I. ${CPPFLAGS} ${CFLAGS} $< - -OBJ = \ - main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj \ - command.obj cvt.obj decode.obj edit.obj filename.obj forwback.obj \ - help.obj ifile.obj input.obj jump.obj line.obj linenum.obj \ - lsystem.obj mark.obj optfunc.obj option.obj opttbl.obj os.obj \ - output.obj pattern.obj position.obj prompt.obj search.obj signal.obj \ - tags.obj ttyin.obj version.obj regexp.obj - -all: less lesskey lessecho - -# -# This is really horrible, but the command line is too long for -# MS-DOS if we try to link ${OBJ}. -# -less: ${OBJ} - ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} - -lesskey: lesskey.obj version.obj - ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} - -lessecho: lessecho.obj version.obj - ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} - -defines.h: defines.wn - -del defines.h - -copy defines.wn defines.h - -${OBJ}: less.h defines.h funcs.h cmd.h - -clean: - -del *.obj - -del *.il? - -del *.tds - -del defines.h - -del less.exe - -del lesskey.exe - -del lessecho.exe - -build: all -compile: ${OBJ} -realclean: clean -rebuild: clean build -veryclean: realclean diff --git a/NEWS.upstream b/NEWS.upstream index c9b705e..fe3ec9c 100644 --- a/NEWS.upstream +++ b/NEWS.upstream @@ -11,7 +11,7 @@ ====================================================================== - Major changes between "less" versions 551 and 557 + Major changes between "less" versions 551 and 562 * Update Unicode tables. @@ -20,6 +20,14 @@ * Display error message immediately when -o is toggled and input is not a pipe. +* Fix regression: make screen repaint when "squished" and + a no-movement command is given. + +* Fix erroneous EOF calculation when F command is interrupted. + +* Make WIN32C version include this fix from 551: + Don't count lines in initial screen if using -X with -F. + * Fix display bug in WIN32C version. * Fix memory corruption when built with libtermcap. @@ -173,7 +181,7 @@ ====================================================================== - Major changes between "less" versions 451 and 458 + Major changes between "less" versions 451 and 458 * Allow backslash escaping of metacharacters in LESS environment variable after the --use-backslash option. @@ -192,7 +200,7 @@ ====================================================================== - Major changes between "less" versions 444 and 451 + Major changes between "less" versions 444 and 451 * Add ESC-F command to keep reading data until a pattern is found. @@ -219,7 +227,7 @@ ====================================================================== - Major changes between "less" versions 443 and 444 + Major changes between "less" versions 443 and 444 * Fix bug in unget handling that can cause strange effects on the command line. @@ -228,7 +236,7 @@ ====================================================================== - Major changes between "less" versions 436 and 443 + Major changes between "less" versions 436 and 443 * Change search behavior such that when a search is given an explicit pattern, the entire displayed screen is included in the search and @@ -259,7 +267,7 @@ ====================================================================== - Major changes between "less" versions 429 and 436 + Major changes between "less" versions 429 and 436 * Don't pass "-" to non-pipe LESSOPEN unless it starts with "-". @@ -271,7 +279,7 @@ ====================================================================== - Major changes between "less" versions 424 and 429 + Major changes between "less" versions 424 and 429 * LESSOPEN pipe will now be used on standard input, if the LESSOPEN environment variable begins with "|-". @@ -294,7 +302,7 @@ ====================================================================== - Major changes between "less" versions 418 and 424 + Major changes between "less" versions 418 and 424 * New "&" command allows filtering of lines based on a pattern. @@ -312,7 +320,7 @@ ====================================================================== - Major changes between "less" versions 416 and 418 + Major changes between "less" versions 416 and 418 * Color escape sequences are now supported in WIN32 build. @@ -328,7 +336,7 @@ ====================================================================== - Major changes between "less" versions 409 and 416 + Major changes between "less" versions 409 and 416 * New --follow-name option makes F command follow the name of a file rather than the file descriptor if an open file is renamed. @@ -339,7 +347,7 @@ ====================================================================== - Major changes between "less" versions 406 and 409 + Major changes between "less" versions 406 and 409 * Support CSI escape sequences, like SGR escape sequences. @@ -353,7 +361,7 @@ ====================================================================== - Major changes between "less" versions 394 and 406 + Major changes between "less" versions 394 and 406 * Allow decimal point in number for % (percent) command. @@ -400,7 +408,7 @@ ====================================================================== - Major changes between "less" versions 382 and 394 + Major changes between "less" versions 382 and 394 * Add history file to save search and shell command history between invocations of less. @@ -449,14 +457,14 @@ ====================================================================== - Major changes between "less" versions 381 and 382 + Major changes between "less" versions 381 and 382 * Removed some old copyrighted code. This probably breaks OS/9 support. ====================================================================== - Major changes between "less" versions 378 and 381 + Major changes between "less" versions 378 and 381 * New -L option to disable LESSOPEN processing. @@ -477,7 +485,7 @@ ====================================================================== - Major changes between "less" versions 376 and 378 + Major changes between "less" versions 376 and 378 * Bug fixes: Default buffer space is now 64K as documented. @@ -487,7 +495,7 @@ ====================================================================== - Major changes between "less" versions 358 and 376 + Major changes between "less" versions 358 and 376 * -x option can now specify multiple variable-width tab stops. @@ -536,7 +544,7 @@ ====================================================================== - Major changes between "less" versions 354 and 358 + Major changes between "less" versions 354 and 358 * Add -J (--status-column) option to display a status column. @@ -550,7 +558,7 @@ ====================================================================== - Major changes between "less" versions 352 and 354 + Major changes between "less" versions 352 and 354 * Allow space after numeric-valued command line options. @@ -566,7 +574,7 @@ ====================================================================== - Major changes between "less" versions 346 and 352 + Major changes between "less" versions 346 and 352 * Enable UTF-8 if "UTF-8" appears in locale-related environment variables. @@ -588,7 +596,7 @@ ====================================================================== - Major changes between "less" versions 340 and 346 + Major changes between "less" versions 340 and 346 * The UTF-8 character set is now supported. @@ -615,7 +623,7 @@ ====================================================================== - Major changes between "less" versions 337 and 340 + Major changes between "less" versions 337 and 340 * Command line options for less may now be given in either the old single-letter form, or a new long name form (--option-name). @@ -646,14 +654,14 @@ ====================================================================== - Major changes between "less" versions 335 and 337 + Major changes between "less" versions 335 and 337 * Fixed bugs in "make install". ====================================================================== - Major changes between "less" versions 332 and 335 + Major changes between "less" versions 332 and 335 * The old -w flag (suppress tildes after end-of-file) has been removed. @@ -677,7 +685,7 @@ ====================================================================== - Major changes between "less" versions 330 and 332 + Major changes between "less" versions 330 and 332 * Filenames from the command line are entered into the command history, so UPARROW/DOWNARROW can be used to retrieve them from the :e command. @@ -700,7 +708,7 @@ ====================================================================== - Major changes between "less" versions 321 and 330 + Major changes between "less" versions 321 and 330 * Now supports filenames containing spaces (in double quotes). New option -" can be used to change the quoting characters. @@ -728,7 +736,7 @@ ====================================================================== - Major changes between "less" versions 291 and 321 + Major changes between "less" versions 291 and 321 * Command line at bottom of screen now scrolls, so it can be longer than the screen width. @@ -772,7 +780,7 @@ ====================================================================== - Major changes between "less" versions 290 and 291 + Major changes between "less" versions 290 and 291 * Less environment variables can be specified in lesskey files. @@ -781,7 +789,7 @@ ====================================================================== - Major changes between "less" versions 278 and 290 + Major changes between "less" versions 278 and 290 * Accepts GNU-style options "--help" and "--version". @@ -792,7 +800,7 @@ ====================================================================== - Major changes between "less" versions 252 and 278 + Major changes between "less" versions 252 and 278 * A LESSOPEN preprocessor may now pipe the converted file data to less, rather than writing it to a temporary file. @@ -816,7 +824,7 @@ ====================================================================== - Major changes between "less" versions 237 and 252 + Major changes between "less" versions 237 and 252 * Changes in line-editing keys: The literal key is now ^V or ^A rather than \ (backslash). @@ -839,7 +847,7 @@ ====================================================================== - Major changes between "less" versions 170 and 237 + Major changes between "less" versions 170 and 237 * By popular demand, text which matches the current search pattern is highlighted. New -F flag disables this feature. @@ -896,7 +904,7 @@ ====================================================================== - Major changes between "less" versions 123 and 170 + Major changes between "less" versions 123 and 170 * New option -j allows target lines to be positioned anywhere on screen. @@ -926,12 +934,12 @@ * New command :x directly jumps to a file in the command line list. * Search commands have been enhanced and reorganized: - n Repeat search, same direction. - N Repeat search, opposite direction. - ESC-/ Search forward thru file boundaries - ESC-? Search backward thru file boundaries - ESC-n Repeat search thru file boundaries, same direction. - ESC-N Repeat search thru file boundaries, opposite direction. + n Repeat search, same direction. + N Repeat search, opposite direction. + ESC-/ Search forward thru file boundaries + ESC-? Search backward thru file boundaries + ESC-n Repeat search thru file boundaries, same direction. + ESC-N Repeat search thru file boundaries, opposite direction. Special character * causes search to search thru file boundaries. Special character @ causes search to begin at start/end of file list. @@ -949,7 +957,7 @@ ====================================================================== - Major changes between "less" versions 97 and 123 + Major changes between "less" versions 97 and 123 * New option (-N) causes line numbers to be displayed in the text of the file (like vi "set nu"). diff --git a/README.upstream b/README.upstream index a467a3f..903b8cb 100644 --- a/README.upstream +++ b/README.upstream @@ -1,7 +1,7 @@ - Less, version 557 + Less, version 562 - This is the distribution of less, version 557, released 21 Mar 2020. + This is the distribution of less, version 562, released 19 May 2020. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or diff --git a/ch.c b/ch.c index ab42c01..844b841 100644 --- a/ch.c +++ b/ch.c @@ -843,7 +843,8 @@ seekable(f) public void ch_set_eof(VOID_PARAM) { - ch_fsize = ch_fpos; + if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) + ch_fsize = ch_fpos; } diff --git a/charset.c b/charset.c index a33f2a0..6871b02 100644 --- a/charset.c +++ b/charset.c @@ -573,11 +573,10 @@ utf_skip_to_lead(pp, limit) char **pp; char *limit; { - /* Skip to next lead byte. */ - do { + do { ++(*pp); } while (*pp < limit && !IS_UTF8_LEAD((*pp)[0] & 0377) && !IS_ASCII_OCTET((*pp)[0])); - } +} /* diff --git a/cmdbuf.c b/cmdbuf.c index 1b2cc4b..57375e5 100644 --- a/cmdbuf.c +++ b/cmdbuf.c @@ -960,10 +960,7 @@ cmd_istr(str) step_char(&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) - { - bell(); return (action); - } } return (CC_OK); } diff --git a/command.c b/command.c index 222f745..574c79f 100644 --- a/command.c +++ b/command.c @@ -855,10 +855,8 @@ getccu(VOID_PARAM) LWCHAR c; if (ungot == NULL) { - /* - Normal case: no ungotten chars. - * Get char from the user. - */ + /* Normal case: no ungotten chars. + * Get char from the user. */ c = getchr(); } else { @@ -885,7 +883,7 @@ getcc_repl(orig, repl, gr_getc, gr_ungetc) char const* repl; LWCHAR (*gr_getc)(VOID_PARAM); void (*gr_ungetc)(LWCHAR); - { +{ LWCHAR c; LWCHAR keys[16]; size_t ki = 0; @@ -894,13 +892,13 @@ getcc_repl(orig, repl, gr_getc, gr_ungetc) if (orig == NULL || orig[0] == '\0') return c; for (;;) - { + { keys[ki] = c; if (c != (LWCHAR)orig[ki] || ki >= sizeof(keys)-1) { /* This is not orig we have been receiving. * If we have stashed chars in keys[], - * unget them and return the first one */ + * unget them and return the first one. */ while (ki > 0) (*gr_ungetc)(keys[ki--]); return keys[0]; @@ -913,12 +911,12 @@ getcc_repl(orig, repl, gr_getc, gr_ungetc) while (ki > 0) (*gr_ungetc)(repl[ki--]); return repl[0]; - } + } /* We've received a partial orig sequence (ki chars of it). * Get next char and see if it continues to match orig. */ c = (*gr_getc)(); - } } +} /* * Get command character. @@ -1631,9 +1629,9 @@ commands(VOID_PARAM) #if EXAMINE if (!secure) { - start_mca(A_EXAMINE, "Examine: ", ml_examine, 0); - c = getcc(); - goto again; + start_mca(A_EXAMINE, "Examine: ", ml_examine, 0); + c = getcc(); + goto again; } #endif error("Command not available", NULL_PARG); @@ -1646,29 +1644,29 @@ commands(VOID_PARAM) #if EDITOR if (!secure) { - if (ch_getflags() & CH_HELPFILE) - break; - if (strcmp(get_filename(curr_ifile), "-") == 0) - { - error("Cannot edit standard input", NULL_PARG); - break; - } + if (ch_getflags() & CH_HELPFILE) + break; + if (strcmp(get_filename(curr_ifile), "-") == 0) + { + error("Cannot edit standard input", NULL_PARG); + break; + } if (get_altfilename(curr_ifile) != NULL) - { - error("WARNING: This file was viewed via LESSOPEN", - NULL_PARG); - } - start_mca(A_SHELL, "!", ml_shell, 0); - /* - * Expand the editor prototype string - * and pass it to the system to execute. - * (Make sure the screen is displayed so the - * expansion of "+%lm" works.) - */ - make_display(); - cmd_exec(); - lsystem(pr_expand(editproto, 0), (char*)NULL); - break; + { + error("WARNING: This file was viewed via LESSOPEN", + NULL_PARG); + } + start_mca(A_SHELL, "!", ml_shell, 0); + /* + * Expand the editor prototype string + * and pass it to the system to execute. + * (Make sure the screen is displayed so the + * expansion of "+%lm" works.) + */ + make_display(); + cmd_exec(); + lsystem(pr_expand(editproto, 0), (char*)NULL); + break; } #endif error("Command not available", NULL_PARG); @@ -1839,9 +1837,9 @@ commands(VOID_PARAM) #if SHELL_ESCAPE if (!secure) { - start_mca(A_SHELL, "!", ml_shell, 0); - c = getcc(); - goto again; + start_mca(A_SHELL, "!", ml_shell, 0); + c = getcc(); + goto again; } #endif error("Command not available", NULL_PARG); @@ -1893,18 +1891,18 @@ commands(VOID_PARAM) #if PIPEC if (!secure) { - start_mca(A_PIPE, "|mark: ", (void*)NULL, 0); - c = getcc(); + start_mca(A_PIPE, "|mark: ", (void*)NULL, 0); + c = getcc(); if (is_erase_char(c)) - break; + break; if (is_newline_char(c)) - c = '.'; - if (badmark(c)) - break; - pipec = c; - start_mca(A_PIPE, "!", ml_shell, 0); - c = getcc(); - goto again; + c = '.'; + if (badmark(c)) + break; + pipec = c; + start_mca(A_PIPE, "!", ml_shell, 0); + c = getcc(); + goto again; } #endif error("Command not available", NULL_PARG); diff --git a/compose.uni b/compose.uni index df28196..1235232 100644 --- a/compose.uni +++ b/compose.uni @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Thu Oct 17 10:15:55 PDT 2019 */ +/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x0300, 0x036f }, /* Mn */ { 0x0483, 0x0487 }, /* Mn */ { 0x0488, 0x0489 }, /* Me */ @@ -58,7 +58,7 @@ { 0x0b3f, 0x0b3f }, /* Mn */ { 0x0b41, 0x0b44 }, /* Mn */ { 0x0b4d, 0x0b4d }, /* Mn */ - { 0x0b56, 0x0b56 }, /* Mn */ + { 0x0b55, 0x0b56 }, /* Mn */ { 0x0b62, 0x0b63 }, /* Mn */ { 0x0b82, 0x0b82 }, /* Mn */ { 0x0bc0, 0x0bc0 }, /* Mn */ @@ -81,6 +81,7 @@ { 0x0d41, 0x0d44 }, /* Mn */ { 0x0d4d, 0x0d4d }, /* Mn */ { 0x0d62, 0x0d63 }, /* Mn */ + { 0x0d81, 0x0d81 }, /* Mn */ { 0x0dca, 0x0dca }, /* Mn */ { 0x0dd2, 0x0dd4 }, /* Mn */ { 0x0dd6, 0x0dd6 }, /* Mn */ @@ -140,6 +141,7 @@ { 0x1a7f, 0x1a7f }, /* Mn */ { 0x1ab0, 0x1abd }, /* Mn */ { 0x1abe, 0x1abe }, /* Me */ + { 0x1abf, 0x1ac0 }, /* Mn */ { 0x1b00, 0x1b03 }, /* Mn */ { 0x1b34, 0x1b34 }, /* Mn */ { 0x1b36, 0x1b3a }, /* Mn */ @@ -183,6 +185,7 @@ { 0xa806, 0xa806 }, /* Mn */ { 0xa80b, 0xa80b }, /* Mn */ { 0xa825, 0xa826 }, /* Mn */ + { 0xa82c, 0xa82c }, /* Mn */ { 0xa8c4, 0xa8c5 }, /* Mn */ { 0xa8e0, 0xa8f1 }, /* Mn */ { 0xa8ff, 0xa8ff }, /* Mn */ @@ -224,6 +227,7 @@ { 0x10a3f, 0x10a3f }, /* Mn */ { 0x10ae5, 0x10ae6 }, /* Mn */ { 0x10d24, 0x10d27 }, /* Mn */ + { 0x10eab, 0x10eac }, /* Mn */ { 0x10f46, 0x10f50 }, /* Mn */ { 0x11001, 0x11001 }, /* Mn */ { 0x11038, 0x11046 }, /* Mn */ @@ -237,6 +241,7 @@ { 0x11180, 0x11181 }, /* Mn */ { 0x111b6, 0x111be }, /* Mn */ { 0x111c9, 0x111cc }, /* Mn */ + { 0x111cf, 0x111cf }, /* Mn */ { 0x1122f, 0x11231 }, /* Mn */ { 0x11234, 0x11234 }, /* Mn */ { 0x11236, 0x11237 }, /* Mn */ @@ -272,6 +277,9 @@ { 0x11727, 0x1172b }, /* Mn */ { 0x1182f, 0x11837 }, /* Mn */ { 0x11839, 0x1183a }, /* Mn */ + { 0x1193b, 0x1193c }, /* Mn */ + { 0x1193e, 0x1193e }, /* Mn */ + { 0x11943, 0x11943 }, /* Mn */ { 0x119d4, 0x119d7 }, /* Mn */ { 0x119da, 0x119db }, /* Mn */ { 0x119e0, 0x119e0 }, /* Mn */ @@ -303,6 +311,7 @@ { 0x16b30, 0x16b36 }, /* Mn */ { 0x16f4f, 0x16f4f }, /* Mn */ { 0x16f8f, 0x16f92 }, /* Mn */ + { 0x16fe4, 0x16fe4 }, /* Mn */ { 0x1bc9d, 0x1bc9e }, /* Mn */ { 0x1d167, 0x1d169 }, /* Mn */ { 0x1d17b, 0x1d182 }, /* Mn */ @@ -321,6 +330,7 @@ { 0x1e023, 0x1e024 }, /* Mn */ { 0x1e026, 0x1e02a }, /* Mn */ { 0x1e130, 0x1e136 }, /* Mn */ + { 0x1e2ae, 0x1e2ae }, /* Mn */ { 0x1e2ec, 0x1e2ef }, /* Mn */ { 0x1e8d0, 0x1e8d6 }, /* Mn */ { 0x1e944, 0x1e94a }, /* Mn */ diff --git a/configure b/configure index 962a8c8..124a1a8 100644 --- a/configure +++ b/configure @@ -57,8 +57,8 @@ else arg=$1; case $arg in #( *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' @@ -84,7 +84,7 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -IFS=" "" $as_nl" +IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= @@ -213,23 +213,23 @@ do test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi - done;; + done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS @@ -328,27 +328,27 @@ as_fn_mkdir_p () as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" @@ -437,22 +437,22 @@ fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -810,7 +810,7 @@ do "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; @@ -836,7 +836,7 @@ do "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; @@ -1049,7 +1049,7 @@ do "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; @@ -1065,7 +1065,7 @@ do "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; @@ -1182,27 +1182,27 @@ if test -z "$srcdir"; then # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. @@ -1216,8 +1216,8 @@ if test ! -r "$srcdir/$ac_unique_file"; then fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. @@ -1435,15 +1435,15 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err + test -z "$ac_c_werror_flag" || + test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -1473,18 +1473,18 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err + test -z "$ac_c_werror_flag" || + test ! -s conftest.err } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext + test "$cross_compiling" = yes || + test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would @@ -1518,8 +1518,8 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err }; then : ac_retval=0 else @@ -1590,7 +1590,7 @@ if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? @@ -1655,7 +1655,7 @@ else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -1687,7 +1687,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -1713,7 +1713,7 @@ int main () { if (sizeof ($2)) - return 0; + return 0; ; return 0; } @@ -1726,7 +1726,7 @@ int main () { if (sizeof (($2))) - return 0; + return 0; ; return 0; } @@ -1741,7 +1741,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -1808,7 +1808,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -1896,19 +1896,19 @@ do 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; @@ -1953,8 +1953,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" @@ -1985,11 +1985,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo for ac_var in $ac_subst_files do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -2117,21 +2117,21 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -2552,24 +2552,24 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; * ) - break;; + break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= @@ -2621,7 +2621,7 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; + break;; * ) break;; esac done @@ -2682,9 +2682,9 @@ $as_echo "$ac_try_echo"; } >&5 cross_compiling=no else if test "$cross_compiling" = maybe; then - cross_compiling=yes + cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. @@ -2824,8 +2824,8 @@ if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2923,7 +2923,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : @@ -3050,7 +3050,7 @@ do #else # include #endif - Syntax error + Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : @@ -3109,7 +3109,7 @@ do #else # include #endif - Syntax error + Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : @@ -3392,30 +3392,30 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi - fi done done ;; @@ -3466,9 +3466,9 @@ else if test "$GCC" != yes; then ac_save_CC=$CC while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. @@ -3477,8 +3477,8 @@ else incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -3487,16 +3487,16 @@ main () return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext - break + break done CC=$ac_save_CC rm -f conftest.$ac_ext @@ -3523,8 +3523,8 @@ else incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -3547,8 +3547,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -3592,8 +3592,8 @@ else incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -3616,8 +3616,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -4414,9 +4414,9 @@ else # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -4427,7 +4427,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) return 2; return 0; } @@ -4453,7 +4453,7 @@ fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default @@ -5673,8 +5673,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. @@ -5697,15 +5697,15 @@ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" + cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( *) - mv -f confcache "$cache_file" ;; - esac + mv -f confcache "$cache_file" ;; + esac fi fi else @@ -5810,8 +5810,8 @@ else arg=$1; case $arg in #( *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' @@ -5837,7 +5837,7 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -IFS=" "" $as_nl" +IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= @@ -5986,22 +5986,22 @@ fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -6070,27 +6070,27 @@ as_fn_mkdir_p () as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" @@ -6500,7 +6500,7 @@ _ACEOF # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ @@ -6556,23 +6556,23 @@ sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset -s/^[ ]*#[ ]*define[ ][ ]*/ / +s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont @@ -6660,14 +6660,14 @@ do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -6677,8 +6677,8 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 @@ -6701,27 +6701,27 @@ $as_echo "$as_me: creating $ac_file" >&6;} ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. @@ -6859,7 +6859,7 @@ $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ diff --git a/configure.ac b/configure.ac index 3f1985f..27cd09a 100644 --- a/configure.ac +++ b/configure.ac @@ -192,63 +192,63 @@ AC_HEADER_TIME # Autoheader templates for symbols defined later by AC_DEFINE. AH_TEMPLATE([HAVE_GNU_REGEX], - [GNU regex library]) + [GNU regex library]) AH_TEMPLATE([HAVE_POSIX_REGCOMP], - [POSIX regcomp() and regex.h]) + [POSIX regcomp() and regex.h]) AH_TEMPLATE([HAVE_PCRE], [PCRE (Perl-compatible regular expression) library]) AH_TEMPLATE([HAVE_PCRE2], [PCRE2 (Perl-compatible regular expression) library]) AH_TEMPLATE([HAVE_RE_COMP], - [BSD re_comp()]) + [BSD re_comp()]) AH_TEMPLATE([HAVE_REGCMP], - [System V regcmp()]) + [System V regcmp()]) AH_TEMPLATE([HAVE_V8_REGCOMP], - [Henry Spencer V8 regcomp() and regexp.h]) + [Henry Spencer V8 regcomp() and regexp.h]) AH_TEMPLATE([NO_REGEX], - [pattern matching is supported, but without metacharacters.]) + [pattern matching is supported, but without metacharacters.]) AH_TEMPLATE([HAVE_REGEXEC2], - []) + []) AH_TEMPLATE([HAVE_VOID], - [Define HAVE_VOID if your compiler supports the "void" type.]) + [Define HAVE_VOID if your compiler supports the "void" type.]) AH_TEMPLATE([HAVE_FLOAT], - [Define HAVE_FLOAT if your compiler supports the "double" type.]) + [Define HAVE_FLOAT if your compiler supports the "double" type.]) AH_TEMPLATE([HAVE_CONST], - [Define HAVE_CONST if your compiler supports the "const" modifier.]) + [Define HAVE_CONST if your compiler supports the "const" modifier.]) AH_TEMPLATE([HAVE_STAT_INO], - [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) + [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) AH_TEMPLATE([HAVE_TIME_T], - [Define HAVE_TIME_T if your system supports the "time_t" type.]) + [Define HAVE_TIME_T if your system supports the "time_t" type.]) AH_TEMPLATE([HAVE_STRERROR], - [Define HAVE_STRERROR if you have the strerror() function.]) + [Define HAVE_STRERROR if you have the strerror() function.]) AH_TEMPLATE([HAVE_FILENO], - [Define HAVE_FILENO if you have the fileno() macro.]) + [Define HAVE_FILENO if you have the fileno() macro.]) AH_TEMPLATE([HAVE_ERRNO], - [Define HAVE_ERRNO if you have the errno variable.]) + [Define HAVE_ERRNO if you have the errno variable.]) AH_TEMPLATE([MUST_DEFINE_ERRNO], - [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) + [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) AH_TEMPLATE([HAVE_SYS_ERRLIST], - [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) + [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) AH_TEMPLATE([HAVE_OSPEED], - [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) + [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) AH_TEMPLATE([MUST_DEFINE_OSPEED], - [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) + [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) AH_TEMPLATE([HAVE_LOCALE], - [Define HAVE_LOCALE if you have locale.h and setlocale.]) + [Define HAVE_LOCALE if you have locale.h and setlocale.]) AH_TEMPLATE([HAVE_TERMIOS_FUNCS], - [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) + [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) AH_TEMPLATE([HAVE_UPPER_LOWER], - [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) + [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) AH_TEMPLATE([HAVE_WCTYPE], - [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) + [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) AH_TEMPLATE([HAVE_SIGSET_T], - [Define HAVE_SIGSET_T you have the sigset_t type.]) + [Define HAVE_SIGSET_T you have the sigset_t type.]) AH_TEMPLATE([HAVE_SIGEMPTYSET], - [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) + [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) AH_TEMPLATE([EDIT_PGM], - [Define EDIT_PGM to your editor.]) + [Define EDIT_PGM to your editor.]) AH_TEMPLATE([SECURE_COMPILE], - [Define SECURE_COMPILE=1 to build a secure version of less.]) + [Define SECURE_COMPILE=1 to build a secure version of less.]) # Checks for identifiers. AC_TYPE_OFF_T @@ -535,24 +535,24 @@ AH_TOP([ * be safe to run by unprivileged users. * SECURE_COMPILE is set by the --with-secure configure option. */ -#define SECURE SECURE_COMPILE +#define SECURE SECURE_COMPILE /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ -#define SHELL_ESCAPE (!SECURE) +#define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ -#define EXAMINE (!SECURE) +#define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ -#define TAB_COMPLETE_FILENAME (!SECURE) +#define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through @@ -564,43 +564,43 @@ AH_TOP([ * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ -#define HILITE_SEARCH 1 +#define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ -#define EDITOR (!SECURE) +#define EDITOR (!SECURE) /* * TAGS is 1 if you wish to support tag files. */ -#define TAGS (!SECURE) +#define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ -#define USERFILE (!SECURE) +#define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ -#define GLOB (!SECURE) +#define GLOB (!SECURE) /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ -#define PIPEC (!SECURE) +#define PIPEC (!SECURE) /* * LOGFILE is 1 if you wish to allow the -o option (to create log files). */ -#define LOGFILE (!SECURE) +#define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command @@ -624,10 +624,10 @@ AH_TOP([ * LESSHISTFILE is the filename of the history file * (in the HOME directory). */ -#define LESSKEYFILE ".less" -#define LESSKEYFILE_SYS SYSDIR "/sysless" -#define DEF_LESSKEYINFILE ".lesskey" -#define LESSHISTFILE ".lesshst" +#define LESSKEYFILE ".less" +#define LESSKEYFILE_SYS SYSDIR "/sysless" +#define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" /* Settings always true on Unix. */ @@ -640,7 +640,7 @@ AH_TOP([ /* * Pathname separator character. */ -#define PATHNAME_SEP "/" +#define PATHNAME_SEP "/" /* * The value returned from tgetent on success. @@ -656,7 +656,7 @@ AH_TOP([ /* * HAVE_SYS_TYPES_H is 1 if your system has . */ -#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. @@ -672,7 +672,7 @@ AH_TOP([ /* * HAVE_TIME is 1 if your system has the time() call. */ -#define HAVE_TIME 1 +#define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. @@ -688,7 +688,7 @@ AH_TOP([ /* * HAVE_DUP is 1 if your system has the dup() call. */ -#define HAVE_DUP 1 +#define HAVE_DUP 1 /* Define to 1 if you have the memcpy() function. */ #define HAVE_MEMCPY 1 @@ -705,22 +705,22 @@ AH_TOP([ #if 0 /* old sizes for small memory machines */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ -#define LINEBUF_SIZE 1024 /* Max size of line in input file */ -#define OUTBUF_SIZE 1024 /* Output buffer */ +#define LINEBUF_SIZE 1024 /* Max size of line in input file */ +#define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ -#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ -#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ -#define TAGLINE_SIZE 512 /* Max size of line in tags file */ +#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ +#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ +#define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ #else /* more reasonable sizes for modern machines */ -#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */ +#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */ #define UNGOT_SIZE 200 /* Max chars to unget() */ -#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */ -#define OUTBUF_SIZE 1024 /* Output buffer */ -#define PROMPT_SIZE 2048 /* Max size of prompt string */ -#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ -#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ -#define TAGLINE_SIZE 1024 /* Max size of line in tags file */ +#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */ +#define OUTBUF_SIZE 1024 /* Output buffer */ +#define PROMPT_SIZE 2048 /* Max size of prompt string */ +#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ +#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ +#define TAGLINE_SIZE 1024 /* Max size of line in tags file */ #define TABSTOP_MAX 128 /* Max number of custom tab stops */ #endif diff --git a/dbin/gdb-chcp1257.BAT b/dbin/gdb-chcp1257.BAT deleted file mode 100644 index 8df0930..0000000 --- a/dbin/gdb-chcp1257.BAT +++ /dev/null @@ -1 +0,0 @@ -@chcp 1257 >NUL 2>&1 && @"gdb.exe" %* diff --git a/defines.ds b/defines.ds index c42a91d..f2db8c0 100644 --- a/defines.ds +++ b/defines.ds @@ -15,7 +15,6 @@ * Settings always true for MS-DOS systems. */ -/***/ /* User preferences. */ /* @@ -120,17 +119,14 @@ * LESSHISTFILE is the filename of the history file * (in the HOME directory). */ -#define LESSKEYFILE "_less" +#define LESSKEYFILE "_less" #define LESSKEYFILE_SYS "c:\\_sysless" #define DEF_LESSKEYINFILE "_lesskey" #define LESSHISTFILE "_lesshst" -/***/ + /* Settings always true for MS-DOS systems. */ -/* - * Define MSDOS_COMPILER if compiling for MS-DOS. - */ #ifdef __DJGPP__ #define MSDOS_COMPILER DJGPPC #else @@ -191,7 +187,7 @@ /* * Sizes of various buffers. */ -#if 0 /* old sizes for small memory machines +#if 0 /* old sizes for small memory machines */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ @@ -274,9 +270,9 @@ #define HAVE_SYS_ERRLIST 1 /* Define HAVE_OSPEED if your termcap library has the ospeed variable */ +#define HAVE_OSPEED 0 /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined * in termcap.h. */ -#define HAVE_OSPEED 0 #define MUST_DEFINE_OSPEED 0 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ diff --git a/defines.o2 b/defines.o2 index 5f614a5..bfa81ae 100644 --- a/defines.o2 +++ b/defines.o2 @@ -15,7 +15,7 @@ * Settings always true for the emx compiler for OS/2 systems. */ -/***/ + /* User preferences. */ /* @@ -117,7 +117,7 @@ #define DEF_LESSKEYINFILE "lesskey.ini" #define LESSHISTFILE "lesshst.ini" -/***/ + /* Settings always true for the emx compiler for OS/2 systems. */ #define OS2 1 diff --git a/defines.o9 b/defines.o9 index d7e6923..c06cee5 100644 --- a/defines.o9 +++ b/defines.o9 @@ -15,7 +15,6 @@ * Settings always true for OS-9 systems. */ -/***/ /* User preferences. */ /* @@ -117,7 +116,7 @@ #define DEF_LESSKEYINFILE ".lesskey" #define LESSHISTFILE ".lesshst" -/***/ + /* Settings always true for OS-9. */ /* This is not needed; it is defined by the compiler. */ diff --git a/defines.wn b/defines.wn index f75e6f2..0689735 100644 --- a/defines.wn +++ b/defines.wn @@ -15,7 +15,7 @@ * Settings always true for Windows systems. */ -/***/ + /* User preferences. */ /* @@ -116,19 +116,19 @@ * LESSHISTFILE is the filename of the history file * (in the HOME directory). */ -#define LESSKEYFILE "_less" +#define LESSKEYFILE "_less" #define LESSKEYFILE_SYS "c:\\_sysless" #define DEF_LESSKEYINFILE "_lesskey" #define LESSHISTFILE "_lesshst" -/***/ + /* Settings always true for Windows systems. */ #define MSDOS_COMPILER WIN32C /* * Minimum Windows version. - * - see + * - see @@ * - @@ @@ */ #define WINVER 0x0400 // WinNT 4.0 @@ -266,7 +266,7 @@ #define HAVE_FILENO 1 /* Define HAVE_ERRNO if you have the errno variable */ -/* Define MUST_DEFINE_ERRNO if you have errno but it is not define +/* Define MUST_DEFINE_ERRNO if you have errno but it is not defined * in errno.h */ #define HAVE_ERRNO 1 #ifdef MINGW @@ -345,12 +345,12 @@ /* Define if you have the header file. */ #define HAVE_STDIO_H 1 -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + /* Define if you have the header file. */ #define HAVE_SYS_IOCTL_H 0 @@ -401,18 +401,31 @@ #endif #endif -#ifdef __clang__ +#if (defined __clang__) || ((defined __BORLANDC__) && (__BORLANDC__ >= 0x600)) #define close _close #define creat _creat -#define dup _dup #define fileno _fileno +#define open _open +#define popen _popen +#define read _read +#define write _write +#ifndef __BORLANDC__ +#define dup _dup #define isatty _isatty #define lseek _lseek -#define open _open #define putenv _putenv -#define read _read #define setmode _setmode -#define write _write +#else +#define dup dup +#define isatty isatty +#define lseek lseek +#define putenv putenv +#define setmode setmode +#endif +#endif + +#if (defined __BORLANDC__) && (__BORLANDC__ < 0x0600) +#define popen _popen #endif #if (defined __clang__) && (!defined __GNUC__) @@ -421,7 +434,7 @@ #pragma comment(lib, "user32") #endif -#ifndef MINGW +#ifdef _MSC_VER /* disable warning C4996: ... POSIX name for this item is deprecated */ #pragma warning(disable:4996) #endif diff --git a/edit.c b/edit.c index cbf62ae..2422e3e 100644 --- a/edit.c +++ b/edit.c @@ -313,7 +313,7 @@ edit_ifile(ifile) chflags = 0; f = -1; alt_filename = get_altfilename(ifile); - open_filename = (alt_filename != NULL) ? alt_filename : filename; + open_filename = (alt_filename != NULL) ? alt_filename : filename; } else { if (strcmp(filename, FAKE_HELPFILE) == 0 || @@ -324,101 +324,101 @@ edit_ifile(ifile) open_filename = (alt_filename != NULL) ? alt_filename : filename; - chflags = 0; + chflags = 0; if (altpipe != NULL) - { - /* - * The alternate "file" is actually a pipe. - * f has already been set to the file descriptor of the pipe - * in the call to open_altfile above. - * Keep the file descriptor open because it was opened - * via popen(), and pclose() wants to close it. - */ - chflags |= CH_POPENED; + { + /* + * The alternate "file" is actually a pipe. + * f has already been set to the file descriptor of the pipe + * in the call to open_altfile above. + * Keep the file descriptor open because it was opened + * via popen(), and pclose() wants to close it. + */ + chflags |= CH_POPENED; if (strcmp(filename, "-") == 0) chflags |= CH_KEEPOPEN; } else if (strcmp(filename, "-") == 0) - { - /* - * Use standard input. - * Keep the file descriptor open because we can't reopen it. - */ - f = fd0; - chflags |= CH_KEEPOPEN; - /* - * Must switch stdin to BINARY mode. - */ - SET_BINARY(f); + { + /* + * Use standard input. + * Keep the file descriptor open because we can't reopen it. + */ + f = fd0; + chflags |= CH_KEEPOPEN; + /* + * Must switch stdin to BINARY mode. + */ + SET_BINARY(f); #if MSDOS_COMPILER==DJGPPC - /* - * Setting stdin to binary by default causes - * Ctrl-C to not raise SIGINT. We must undo - * that side-effect. - */ - __djgpp_set_ctrl_c(1); + /* + * Setting stdin to binary by default causes + * Ctrl-C to not raise SIGINT. We must undo + * that side-effect. + */ + __djgpp_set_ctrl_c(1); #endif - } else if (strcmp(open_filename, FAKE_EMPTYFILE) == 0) - { - f = -1; - chflags |= CH_NODATA; - } else if (strcmp(open_filename, FAKE_HELPFILE) == 0) - { - f = -1; - chflags |= CH_HELPFILE; - } else if ((parg.p_string = bad_file(open_filename)) != NULL) - { - /* - * It looks like a bad file. Don't try to open it. - */ - error("%s", &parg); - free(parg.p_string); - err1: - if (alt_filename != NULL) + } else if (strcmp(open_filename, FAKE_EMPTYFILE) == 0) + { + f = -1; + chflags |= CH_NODATA; + } else if (strcmp(open_filename, FAKE_HELPFILE) == 0) { + f = -1; + chflags |= CH_HELPFILE; + } else if ((parg.p_string = bad_file(open_filename)) != NULL) + { + /* + * It looks like a bad file. Don't try to open it. + */ + error("%s", &parg); + free(parg.p_string); + err1: + if (alt_filename != NULL) + { close_pipe(altpipe); close_altfile(alt_filename, filename); - free(alt_filename); - } - del_ifile(ifile); - free(filename); - /* - * Re-open the current file. - */ - if (was_curr_ifile == ifile) - { + free(alt_filename); + } + del_ifile(ifile); + free(filename); /* - * Whoops. The "current" ifile is the one we just deleted. - * Just give up. + * Re-open the current file. */ - quit(QUIT_ERROR); - } - reedit_ifile(was_curr_ifile); - return (1); + if (was_curr_ifile == ifile) + { + /* + * Whoops. The "current" ifile is the one we just deleted. + * Just give up. + */ + quit(QUIT_ERROR); + } + reedit_ifile(was_curr_ifile); + return (1); } else if ((f = open(open_filename, OPEN_READ)) < 0) - { - /* - * Got an error trying to open it. - */ - parg.p_string = errno_message(filename); - error("%s", &parg); - free(parg.p_string); - goto err1; - } else - { - chflags |= CH_CANSEEK; - if (!force_open && !opened(ifile) && bin_file(f)) { /* - * Looks like a binary file. - * Ask user if we should proceed. + * Got an error trying to open it. */ - parg.p_string = filename; - answer = query("\"%s\" may be a binary file. See it anyway? ", - &parg); - if (answer != 'y' && answer != 'Y') - { - close(f); + parg.p_string = errno_message(filename); + error("%s", &parg); + free(parg.p_string); goto err1; + } else + { + chflags |= CH_CANSEEK; + if (!force_open && !opened(ifile) && bin_file(f)) + { + /* + * Looks like a binary file. + * Ask user if we should proceed. + */ + parg.p_string = filename; + answer = query("\"%s\" may be a binary file. See it anyway? ", + &parg); + if (answer != 'y' && answer != 'Y') + { + close(f); + goto err1; } } } diff --git a/filename.c b/filename.c index 49e9e27..e433417 100644 --- a/filename.c +++ b/filename.c @@ -480,7 +480,7 @@ bin_file(f) for (p = data; p < edata; ) { if (utf_mode && !is_utf8_well_formed(p, edata-data)) - { + { bin_count++; utf_skip_to_lead(&p, edata); } else @@ -632,8 +632,8 @@ lglob(filename) * The globbing function returns a list of names. */ int length; - char *p; - char *qfilename; + char *p = 0; + char *qfilename = 0; DECL_GLOB_LIST(list) GLOB_LIST(filename, list); @@ -915,7 +915,7 @@ open_altfile(filename, pf, pfd) /* * The first time we open the file, read one char - * Read one char to see if the pipe will produce any data. + * to see if the pipe will produce any data. * If it does, push the char back on the pipe. */ f = fileno(fd); @@ -971,10 +971,6 @@ close_altfile(altfilename, filename) if (secure) return; ch_ungetchar(-1); - /* - * The pclose function of OS/2 emx sometimes fails. - * Send SIGINT to the piped process before closing it. - */ if ((lessclose = lgetenv("LESSCLOSE")) == NULL) return; if (num_pct_s(lessclose) > 2) diff --git a/fmt.uni b/fmt.uni index 5c0a928..6766505 100644 --- a/fmt.uni +++ b/fmt.uni @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Thu Oct 17 10:15:55 PDT 2019 */ +/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x00ad, 0x00ad }, /* Cf */ { 0x0600, 0x0605 }, /* Cf */ { 0x061c, 0x061c }, /* Cf */ diff --git a/forwback.c b/forwback.c index d489eba..7b6f383 100644 --- a/forwback.c +++ b/forwback.c @@ -20,7 +20,6 @@ public int screen_trashed; public int squished; public int no_back_scroll = 0; public int forw_prompt; -public int same_pos_bell = 1; extern int sigs; extern int top_scroll; @@ -285,7 +284,7 @@ forw(n, pos, force, only_last, nblank) forw_prompt = 1; } - if (nlines == 0 && !ignore_eoi && same_pos_bell) + if (nlines == 0 && !ignore_eoi) eof_bell(); else if (do_repaint) repaint(); @@ -345,7 +344,7 @@ back(n, pos, force, only_last) } } - if (nlines == 0 && same_pos_bell) + if (nlines == 0) eof_bell(); else if (do_repaint) repaint(); diff --git a/help.c b/help.c index 010f059..b810295 100644 --- a/help.c +++ b/help.c @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 19:59 on 2020/3/21 */ +/* This file was generated by mkhelp.pl from less.hlp at 21:59 on 2020/5/19 */ #include "less.h" constant char helpdata[] = { '\n', diff --git a/ifile.c b/ifile.c index 56f745b..7f32cfe 100644 --- a/ifile.c +++ b/ifile.c @@ -24,14 +24,14 @@ extern IFILE curr_ifile; struct ifile { - struct ifile *h_next; /* Links for command line list */ + struct ifile *h_next; /* Links for command line list */ struct ifile *h_prev; - char *h_filename; /* Name of the file */ - void *h_filestate; /* File state (used in ch.c) */ - int h_index; /* Index within command line list */ - int h_hold; /* Hold count */ - char h_opened; /* Has this ifile been opened? */ - struct scrpos h_scrpos; /* Saved position within the file */ + char *h_filename; /* Name of the file */ + void *h_filestate; /* File state (used in ch.c) */ + int h_index; /* Index within command line list */ + int h_hold; /* Hold count */ + char h_opened; /* Has this ifile been opened? */ + struct scrpos h_scrpos; /* Saved position within the file */ void *h_altpipe; /* Alt pipe */ char *h_altfilename; /* Alt filename */ }; diff --git a/jump.c b/jump.c index 5fd5f29..7d63e8f 100644 --- a/jump.c +++ b/jump.c @@ -219,7 +219,7 @@ jump_loc(pos, sline) nline -= sindex; if (nline > 0) forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0); - else if (nline < 0) + else back(-nline, position(TOP), 1, 0); #if HILITE_SEARCH if (show_attn) @@ -290,7 +290,7 @@ jump_loc(pos, sline) * The desired line is before the current screen. * Move forward in the file far enough so that we * can call back() and put the desired line at the - * sline-th line on the screen. + * sindex-th line on the screen. */ for (nline = sindex; nline < sc_height - 1; nline++) { diff --git a/less.h b/less.h index 039a23c..bc2f7b2 100644 --- a/less.h +++ b/less.h @@ -247,12 +247,6 @@ typedef off_t LINENUM; #define NULL_POSITION ((POSITION)(-1)) -#if HAVE_TIME_T -#define time_type time_t -#else -#define time_type long -#endif - /* * Flags for open() */ @@ -566,5 +560,11 @@ void inttoa LESSPARAMS ((int, char*)); int lstrtoi LESSPARAMS ((char*, char**)); POSITION lstrtopos LESSPARAMS ((char*, char**)); #if MSDOS_COMPILER==WIN32C && !defined(MINGW) +#ifndef _CRTIMP +#define _CRTIMP +#endif +#ifndef __cdecl +#define __cdecl +#endif _CRTIMP int __cdecl pclose LESSPARAMS ((FILE*)); #endif diff --git a/less.hlp b/less.hlp index b94fb89..fe8a332 100644 --- a/less.hlp +++ b/less.hlp @@ -244,5 +244,3 @@ TAB ...................................... Complete filename & cycle. SHIFT-TAB ...................... ESC-TAB Complete filename & reverse cycle. ctrl-L ................................... Complete filename, list all. - - diff --git a/less.man b/less.man index 04002c5..cbc169b 100644 --- a/less.man +++ b/less.man @@ -18,12 +18,11 @@ LESS(1) General Commands Manual LESS(1) (See the OPTIONS section for alternate option syntax with long option names.) - DESCRIPTION - Less is a program similar to more (1), but which allows backward move- + Less is a program similar to more(1), but which allows backward move- ment in the file as well as forward movement. Also, less does not have to read the entire input file before starting, so with large input - files it starts up faster than text editors like vi (1). Less uses + files it starts up faster than text editors like vi(1). Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. There is even limited support for hardcopy terminals. (On a hardcopy terminal, lines which should be printed at the top of the @@ -33,20 +32,19 @@ LESS(1) General Commands Manual LESS(1) decimal number, called N in the descriptions below. The number is used by some commands, as indicated. - COMMANDS In the following descriptions, ^X means control-X. ESC stands for the - ESCAPE key; for example ESC-v means the two character sequence - "ESCAPE", then "v". + ESCAPE key; for example ESC-v means the two character sequence "ES- + CAPE", then "v". h or H Help: display a summary of these commands. If you forget all the other commands, remember this one. SPACE or ^V or f or ^F - Scroll forward N lines, default one window (see option -z - below). If N is more than the screen size, only the final - screenful is displayed. Warning: some systems use ^V as a spe- - cial literalization character. + Scroll forward N lines, default one window (see option -z be- + low). If N is more than the screen size, only the final screen- + ful is displayed. Warning: some systems use ^V as a special + literalization character. z Like SPACE, but if N is specified, it becomes the new window size. @@ -65,9 +63,9 @@ LESS(1) General Commands Manual LESS(1) u commands. b or ^B or ESC-v - Scroll backward N lines, default one window (see option -z - below). If N is more than the screen size, only the final - screenful is displayed. + Scroll backward N lines, default one window (see option -z be- + low). If N is more than the screen size, only the final screen- + ful is displayed. w Like ESC-v, but if N is specified, it becomes the new window size. @@ -89,19 +87,18 @@ LESS(1) General Commands Manual LESS(1) ESC-) or RIGHTARROW Scroll horizontally right N characters, default half the screen - width (see the -# option). If a number N is specified, it - becomes the default for future RIGHTARROW and LEFTARROW com- - mands. While the text is scrolled, it acts as though the -S - option (chop lines) were in effect. + width (see the -# option). If a number N is specified, it be- + comes the default for future RIGHTARROW and LEFTARROW commands. + While the text is scrolled, it acts as though the -S option + (chop lines) were in effect. ESC-( or LEFTARROW Scroll horizontally left N characters, default half the screen - width (see the -# option). If a number N is specified, it - becomes the default for future RIGHTARROW and LEFTARROW com- - mands. + width (see the -# option). If a number N is specified, it be- + comes the default for future RIGHTARROW and LEFTARROW commands. ESC-} or ^RIGHTARROW - Scroll horizontally right to show the end of the longest dis- + Scroll horizontally right to show the end of the longest dis- played line. ESC-{ or ^LEFTARROW @@ -110,17 +107,17 @@ LESS(1) General Commands Manual LESS(1) r or ^R or ^L Repaint the screen. - R Repaint the screen, discarding any buffered input. Useful if + R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed. - F Scroll forward, and keep trying to read when the end of file is - reached. Normally this command would be used when already at - the end of the file. It is a way to monitor the tail of a file - which is growing while it is being viewed. (The behavior is + F Scroll forward, and keep trying to read when the end of file is + reached. Normally this command would be used when already at + the end of the file. It is a way to monitor the tail of a file + which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.) - ESC-F Like F, but as soon as a line is found which matches the last - search pattern, the terminal bell is rung and forward scrolling + ESC-F Like F, but as soon as a line is found which matches the last + search pattern, the terminal bell is rung and forward scrolling stops. g or < or ESC-< @@ -128,12 +125,12 @@ LESS(1) General Commands Manual LESS(1) ing: this may be slow if N is large.) G or > or ESC-> - Go to line N in the file, default the end of the file. (Warn- - ing: this may be slow if N is large, or if N is not specified + Go to line N in the file, default the end of the file. (Warn- + ing: this may be slow if N is large, or if N is not specified and standard input, rather than a file, is being read.) - ESC-G Same as G, except if no number N is specified and the input is - standard input, goes to the last line which is currently + ESC-G Same as G, except if no number N is specified and the input is + standard input, goes to the last line which is currently buffered. p or % Go to a position N percent into the file. N should be between 0 @@ -142,96 +139,96 @@ LESS(1) General Commands Manual LESS(1) P Go to the line containing byte offset N in the file. { If a left curly bracket appears in the top line displayed on the - screen, the { command will go to the matching right curly - bracket. The matching right curly bracket is positioned on the + screen, the { command will go to the matching right curly + bracket. The matching right curly bracket is positioned on the bottom line of the screen. If there is more than one left curly - bracket on the top line, a number N may be used to specify the + bracket on the top line, a number N may be used to specify the N-th bracket on the line. } If a right curly bracket appears in the bottom line displayed on - the screen, the } command will go to the matching left curly - bracket. The matching left curly bracket is positioned on the - top line of the screen. If there is more than one right curly - bracket on the top line, a number N may be used to specify the + the screen, the } command will go to the matching left curly + bracket. The matching left curly bracket is positioned on the + top line of the screen. If there is more than one right curly + bracket on the top line, a number N may be used to specify the N-th bracket on the line. ( Like {, but applies to parentheses rather than curly brackets. ) Like }, but applies to parentheses rather than curly brackets. - [ Like {, but applies to square brackets rather than curly brack- + [ Like {, but applies to square brackets rather than curly brack- ets. - ] Like }, but applies to square brackets rather than curly brack- + ] Like }, but applies to square brackets rather than curly brack- ets. - ESC-^F Followed by two characters, acts like {, but uses the two char- - acters as open and close brackets, respectively. For example, - "ESC ^F < >" could be used to go forward to the > which matches + ESC-^F Followed by two characters, acts like {, but uses the two char- + acters as open and close brackets, respectively. For example, + "ESC ^F < >" could be used to go forward to the > which matches the < in the top displayed line. - ESC-^B Followed by two characters, acts like }, but uses the two char- - acters as open and close brackets, respectively. For example, + ESC-^B Followed by two characters, acts like }, but uses the two char- + acters as open and close brackets, respectively. For example, "ESC ^B < >" could be used to go backward to the < which matches the > in the bottom displayed line. - m Followed by any lowercase or uppercase letter, marks the first - displayed line with that letter. If the status column is - enabled via the -J option, the status column shows the marked + m Followed by any lowercase or uppercase letter, marks the first + displayed line with that letter. If the status column is en- + abled via the -J option, the status column shows the marked line. - M Acts like m, except the last displayed line is marked rather + M Acts like m, except the last displayed line is marked rather than the first displayed line. - ' (Single quote.) Followed by any lowercase or uppercase letter, - returns to the position which was previously marked with that - letter. Followed by another single quote, returns to the posi- - tion at which the last "large" movement command was executed. - Followed by a ^ or $, jumps to the beginning or end of the file - respectively. Marks are preserved when a new file is examined, + ' (Single quote.) Followed by any lowercase or uppercase letter, + returns to the position which was previously marked with that + letter. Followed by another single quote, returns to the posi- + tion at which the last "large" movement command was executed. + Followed by a ^ or $, jumps to the beginning or end of the file + respectively. Marks are preserved when a new file is examined, so the ' command can be used to switch between input files. ^X^X Same as single quote. - ESC-m Followed by any lowercase or uppercase letter, clears the mark + ESC-m Followed by any lowercase or uppercase letter, clears the mark identified by that letter. /pattern Search forward in the file for the N-th line containing the pat- tern. N defaults to 1. The pattern is a regular expression, as - recognized by the regular expression library supplied by your - system. The search starts at the first line displayed (but see + recognized by the regular expression library supplied by your + system. The search starts at the first line displayed (but see the -a and -j options, which change this). - Certain characters are special if entered at the beginning of - the pattern; they modify the type of search rather than become + Certain characters are special if entered at the beginning of + the pattern; they modify the type of search rather than become part of the pattern: ^N or ! Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the search reaches - the END of the current file without finding a match, the - search continues in the next file in the command line + Search multiple files. That is, if the search reaches + the END of the current file without finding a match, the + search continues in the next file in the command line list. ^F or @ - Begin the search at the first line of the FIRST file in - the command line list, regardless of what is currently - displayed on the screen or the settings of the -a or -j + Begin the search at the first line of the FIRST file in + the command line list, regardless of what is currently + displayed on the screen or the settings of the -a or -j options. - ^K Highlight any text which matches the pattern on the cur- + ^K Highlight any text which matches the pattern on the cur- rent screen, but don't move to the first match (KEEP cur- rent position). - ^R Don't interpret regular expression metacharacters; that + ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. ?pattern - Search backward in the file for the N-th line containing the - pattern. The search starts at the last line displayed (but see + Search backward in the file for the N-th line containing the + pattern. The search starts at the last line displayed (but see the -a and -j options, which change this). Certain characters are special as in the / command: @@ -240,16 +237,16 @@ LESS(1) General Commands Manual LESS(1) Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the search reaches - the beginning of the current file without finding a - match, the search continues in the previous file in the + Search multiple files. That is, if the search reaches + the beginning of the current file without finding a + match, the search continues in the previous file in the command line list. ^F or @ Begin the search at the last line of the last file in the - command line list, regardless of what is currently dis- - played on the screen or the settings of the -a or -j - options. + command line list, regardless of what is currently dis- + played on the screen or the settings of the -a or -j op- + tions. ^K As in forward searches. @@ -261,36 +258,36 @@ LESS(1) General Commands Manual LESS(1) ESC-?pattern Same as "?*". - n Repeat previous search, for N-th line containing the last pat- - tern. If the previous search was modified by ^N, the search is - made for the N-th line NOT containing the pattern. If the pre- - vious search was modified by ^E, the search continues in the - next (or previous) file if not satisfied in the current file. - If the previous search was modified by ^R, the search is done - without using regular expressions. There is no effect if the + n Repeat previous search, for N-th line containing the last pat- + tern. If the previous search was modified by ^N, the search is + made for the N-th line NOT containing the pattern. If the pre- + vious search was modified by ^E, the search continues in the + next (or previous) file if not satisfied in the current file. + If the previous search was modified by ^R, the search is done + without using regular expressions. There is no effect if the previous search was modified by ^F or ^K. N Repeat previous search, but in the reverse direction. - ESC-n Repeat previous search, but crossing file boundaries. The - effect is as if the previous search were modified by *. + ESC-n Repeat previous search, but crossing file boundaries. The ef- + fect is as if the previous search were modified by *. - ESC-N Repeat previous search, but in the reverse direction and cross- + ESC-N Repeat previous search, but in the reverse direction and cross- ing file boundaries. - ESC-u Undo search highlighting. Turn off highlighting of strings + ESC-u Undo search highlighting. Turn off highlighting of strings matching the current search pattern. If highlighting is already - off because of a previous ESC-u command, turn highlighting back - on. Any search command will also turn highlighting back on. + off because of a previous ESC-u command, turn highlighting back + on. Any search command will also turn highlighting back on. (Highlighting can also be disabled by toggling the -G option; in that case search commands do not turn highlighting back on.) &pattern - Display only lines which match the pattern; lines which do not - match the pattern are not displayed. If pattern is empty (if - you type & immediately followed by ENTER), any filtering is - turned off, and all lines are displayed. While filtering is in - effect, an ampersand is displayed at the beginning of the + Display only lines which match the pattern; lines which do not + match the pattern are not displayed. If pattern is empty (if + you type & immediately followed by ENTER), any filtering is + turned off, and all lines are displayed. While filtering is in + effect, an ampersand is displayed at the beginning of the prompt, as a reminder that some lines in the file may be hidden. Certain characters are special as in the / command: @@ -298,98 +295,98 @@ LESS(1) General Commands Manual LESS(1) ^N or ! Display only lines which do NOT match the pattern. - ^R Don't interpret regular expression metacharacters; that + ^R Don't interpret regular expression metacharacters; that is, do a simple textual comparison. :e [filename] - Examine a new file. If the filename is missing, the "current" - file (see the :n and :p commands below) from the list of files - in the command line is re-examined. A percent sign (%) in the - filename is replaced by the name of the current file. A pound - sign (#) is replaced by the name of the previously examined - file. However, two consecutive percent signs are simply - replaced with a single percent sign. This allows you to enter a - filename that contains a percent sign in the name. Similarly, - two consecutive pound signs are replaced with a single pound - sign. The filename is inserted into the command line list of - files so that it can be seen by subsequent :n and :p commands. + Examine a new file. If the filename is missing, the "current" + file (see the :n and :p commands below) from the list of files + in the command line is re-examined. A percent sign (%) in the + filename is replaced by the name of the current file. A pound + sign (#) is replaced by the name of the previously examined + file. However, two consecutive percent signs are simply re- + placed with a single percent sign. This allows you to enter a + filename that contains a percent sign in the name. Similarly, + two consecutive pound signs are replaced with a single pound + sign. The filename is inserted into the command line list of + files so that it can be seen by subsequent :n and :p commands. If the filename consists of several files, they are all inserted - into the list of files and the first one is examined. If the + into the list of files and the first one is examined. If the filename contains one or more spaces, the entire filename should be enclosed in double quotes (also see the -" option). ^X^V or E - Same as :e. Warning: some systems use ^V as a special literal- - ization character. On such systems, you may not be able to use + Same as :e. Warning: some systems use ^V as a special literal- + ization character. On such systems, you may not be able to use ^V. - :n Examine the next file (from the list of files given in the com- - mand line). If a number N is specified, the N-th next file is + :n Examine the next file (from the list of files given in the com- + mand line). If a number N is specified, the N-th next file is examined. :p Examine the previous file in the command line list. If a number N is specified, the N-th previous file is examined. - :x Examine the first file in the command line list. If a number N + :x Examine the first file in the command line list. If a number N is specified, the N-th file in the list is examined. :d Remove the current file from the list of files. - t Go to the next tag, if there were more than one matches for the + t Go to the next tag, if there were more than one matches for the current tag. See the -t option for more details about tags. - T Go to the previous tag, if there were more than one matches for + T Go to the previous tag, if there were more than one matches for the current tag. = or ^G or :f - Prints some information about the file being viewed, including - its name and the line number and byte offset of the bottom line - being displayed. If possible, it also prints the length of the - file, the number of lines in the file and the percent of the + Prints some information about the file being viewed, including + its name and the line number and byte offset of the bottom line + being displayed. If possible, it also prints the length of the + file, the number of lines in the file and the percent of the file above the last displayed line. - - Followed by one of the command line option letters (see OPTIONS - below), this will change the setting of that option and print a - message describing the new setting. If a ^P (CONTROL-P) is - entered immediately after the dash, the setting of the option is - changed but no message is printed. If the option letter has a - numeric value (such as -b or -h), or a string value (such as -P - or -t), a new value may be entered after the option letter. If - no new value is entered, a message describing the current set- + - Followed by one of the command line option letters (see OPTIONS + below), this will change the setting of that option and print a + message describing the new setting. If a ^P (CONTROL-P) is en- + tered immediately after the dash, the setting of the option is + changed but no message is printed. If the option letter has a + numeric value (such as -b or -h), or a string value (such as -P + or -t), a new value may be entered after the option letter. If + no new value is entered, a message describing the current set- ting is printed and nothing is changed. - -- Like the - command, but takes a long option name (see OPTIONS + -- Like the - command, but takes a long option name (see OPTIONS below) rather than a single option letter. You must press ENTER - or RETURN after typing the option name. A ^P immediately after - the second dash suppresses printing of a message describing the + or RETURN after typing the option name. A ^P immediately after + the second dash suppresses printing of a message describing the new setting, as in the - command. - -+ Followed by one of the command line option letters this will - reset the option to its default setting and print a message - describing the new setting. (The "-+X" command does the same - thing as "-+X" on the command line.) This does not work for + -+ Followed by one of the command line option letters this will re- + set the option to its default setting and print a message de- + scribing the new setting. (The "-+X" command does the same + thing as "-+X" on the command line.) This does not work for string-valued options. - --+ Like the -+ command, but takes a long option name rather than a + --+ Like the -+ command, but takes a long option name rather than a single option letter. - -! Followed by one of the command line option letters, this will - reset the option to the "opposite" of its default setting and - print a message describing the new setting. This does not work + -! Followed by one of the command line option letters, this will + reset the option to the "opposite" of its default setting and + print a message describing the new setting. This does not work for numeric or string-valued options. - --! Like the -! command, but takes a long option name rather than a + --! Like the -! command, but takes a long option name rather than a single option letter. - _ (Underscore.) Followed by one of the command line option let- - ters, this will print a message describing the current setting + _ (Underscore.) Followed by one of the command line option let- + ters, this will print a message describing the current setting of that option. The setting of the option is not changed. __ (Double underscore.) Like the _ (underscore) command, but takes a long option name rather than a single option letter. You must press ENTER or RETURN after typing the option name. - +cmd Causes the specified cmd to be executed each time a new file is + +cmd Causes the specified cmd to be executed each time a new file is examined. For example, +G causes less to initially display each file starting at the end rather than the beginning. @@ -398,51 +395,51 @@ LESS(1) General Commands Manual LESS(1) q or Q or :q or :Q or ZZ Exits less. - The following four commands may or may not be valid, depending on your + The following four commands may or may not be valid, depending on your particular installation. - v Invokes an editor to edit the current file being viewed. The + v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, - or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- - ther VISUAL nor EDITOR is defined. See also the discussion of + or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- + ther VISUAL nor EDITOR is defined. See also the discussion of LESSEDIT under the section on PROMPTS below. ! shell-command - Invokes a shell to run the shell-command given. A percent sign - (%) in the command is replaced by the name of the current file. + Invokes a shell to run the shell-command given. A percent sign + (%) in the command is replaced by the name of the current file. A pound sign (#) is replaced by the name of the previously exam- - ined file. "!!" repeats the last shell command. "!" with no - shell command simply invokes a shell. On Unix systems, the - shell is taken from the environment variable SHELL, or defaults - to "sh". On MS-DOS and OS/2 systems, the shell is the normal + ined file. "!!" repeats the last shell command. "!" with no + shell command simply invokes a shell. On Unix systems, the + shell is taken from the environment variable SHELL, or defaults + to "sh". On MS-DOS and OS/2 systems, the shell is the normal command processor. | shell-command - represents any mark letter. Pipes a section of the input - file to the given shell command. The section of the file to be - piped is between the position marked by the letter and the cur- - rent screen. The entire current screen is included, regardless - of whether the marked position is before or after the current - screen. may also be ^ or $ to indicate beginning or end of - file respectively. If is . or newline, the current screen + represents any mark letter. Pipes a section of the input + file to the given shell command. The section of the file to be + piped is between the position marked by the letter and the cur- + rent screen. The entire current screen is included, regardless + of whether the marked position is before or after the current + screen. may also be ^ or $ to indicate beginning or end of + file respectively. If is . or newline, the current screen is piped. s filename - Save the input to a file. This only works if the input is a + Save the input to a file. This only works if the input is a pipe, not an ordinary file. OPTIONS - Command line options are described below. Most options may be changed + Command line options are described below. Most options may be changed while less is running, via the "-" command. - Most options may be given in one of two forms: either a dash followed - by a single letter, or two dashes followed by a long option name. A - long option name may be abbreviated as long as the abbreviation is - unambiguous. For example, --quit-at-eof may be abbreviated --quit, but + Most options may be given in one of two forms: either a dash followed + by a single letter, or two dashes followed by a long option name. A + long option name may be abbreviated as long as the abbreviation is un- + ambiguous. For example, --quit-at-eof may be abbreviated --quit, but not --qui, since both --quit-at-eof and --quiet begin with --qui. Some - long option names are in uppercase, such as --QUIT-AT-EOF, as distinct - from --quit-at-eof. Such option names need only have their first let- - ter capitalized; the remainder of the name may be in either case. For + long option names are in uppercase, such as --QUIT-AT-EOF, as distinct + from --quit-at-eof. Such option names need only have their first let- + ter capitalized; the remainder of the name may be in either case. For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. Options are also taken from the environment variable "LESS". For exam- @@ -455,76 +452,76 @@ LESS(1) General Commands Manual LESS(1) LESS="-options"; export LESS - On MS-DOS, you don't need the quotes, but you should replace any per- + On MS-DOS, you don't need the quotes, but you should replace any per- cent signs in the options string by double percent signs. - The environment variable is parsed before the command line, so command - line options override the LESS environment variable. If an option - appears in the LESS variable, it can be reset to its default value on - the command line by beginning the command line option with "-+". + The environment variable is parsed before the command line, so command + line options override the LESS environment variable. If an option ap- + pears in the LESS variable, it can be reset to its default value on the + command line by beginning the command line option with "-+". - Some options like -k or -D require a string to follow the option let- - ter. The string for that option is considered to end when a dollar - sign ($) is found. For example, you can set two -D options on MS-DOS + Some options like -k or -D require a string to follow the option let- + ter. The string for that option is considered to end when a dollar + sign ($) is found. For example, you can set two -D options on MS-DOS like this: LESS="Dn9.1$Ds4.1" - If the --use-backslash option appears earlier in the options, then a - dollar sign or backslash may be included literally in an option string + If the --use-backslash option appears earlier in the options, then a + dollar sign or backslash may be included literally in an option string by preceding it with a backslash. If the --use-backslash option is not - in effect, then backslashes are not treated specially, and there is no + in effect, then backslashes are not treated specially, and there is no way to include a dollar sign in the option string. -? or --help - This option displays a summary of the commands accepted by less - (the same as the h command). (Depending on how your shell - interprets the question mark, it may be necessary to quote the + This option displays a summary of the commands accepted by less + (the same as the h command). (Depending on how your shell in- + terprets the question mark, it may be necessary to quote the question mark, thus: "-\?".) -a or --search-skip-screen - By default, forward searches start at the top of the displayed - screen and backwards searches start at the bottom of the dis- - played screen (except for repeated searches invoked by the n or - N commands, which start after or before the "target" line - respectively; see the -j option for more about the target line). - The -a option causes forward searches to instead start at the - bottom of the screen and backward searches to start at the top + By default, forward searches start at the top of the displayed + screen and backwards searches start at the bottom of the dis- + played screen (except for repeated searches invoked by the n or + N commands, which start after or before the "target" line re- + spectively; see the -j option for more about the target line). + The -a option causes forward searches to instead start at the + bottom of the screen and backward searches to start at the top of the screen, thus skipping all lines displayed on the screen. -A or --SEARCH-SKIP-SCREEN - Causes all forward searches (not just non-repeated searches) to - start just after the target line, and all backward searches to - start just before the target line. Thus, forward searches will + Causes all forward searches (not just non-repeated searches) to + start just after the target line, and all backward searches to + start just before the target line. Thus, forward searches will skip part of the displayed screen (from the first line up to and - including the target line). Similarly backwards searches will + including the target line). Similarly backwards searches will skip the displayed screen from the last line up to and including the target line. This was the default behavior in less versions prior to 441. -bn or --buffers=n - Specifies the amount of buffer space less will use for each - file, in units of kilobytes (1024 bytes). By default 64 K of - buffer space is used for each file (unless the file is a pipe; - see the -B option). The -b option specifies instead that n + Specifies the amount of buffer space less will use for each + file, in units of kilobytes (1024 bytes). By default 64 KB of + buffer space is used for each file (unless the file is a pipe; + see the -B option). The -b option specifies instead that n kilobytes of buffer space should be used for each file. If n is - -1, buffer space is unlimited; that is, the entire file can be + -1, buffer space is unlimited; that is, the entire file can be read into memory. -B or --auto-buffers By default, when data is read from a pipe, buffers are allocated automatically as needed. If a large amount of data is read from - the pipe, this can cause a large amount of memory to be allo- + the pipe, this can cause a large amount of memory to be allo- cated. The -B option disables this automatic allocation of buf- - fers for pipes, so that only 64 K (or the amount of space speci- - fied by the -b option) is used for the pipe. Warning: use of -B - can result in erroneous display, since only the most recently - viewed part of the piped data is kept in memory; any earlier + fers for pipes, so that only 64 KB (or the amount of space spec- + ified by the -b option) is used for the pipe. Warning: use of + -B can result in erroneous display, since only the most recently + viewed part of the piped data is kept in memory; any earlier data is lost. -c or --clear-screen - Causes full screen repaints to be painted from the top line - down. By default, full screen repaints are done by scrolling + Causes full screen repaints to be painted from the top line + down. By default, full screen repaints are done by scrolling from the bottom of the screen. -C or --CLEAR-SCREEN @@ -532,28 +529,26 @@ LESS(1) General Commands Manual LESS(1) -d or --dumb The -d option suppresses the error message normally displayed if - the terminal is dumb; that is, lacks some important capability, + the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. The - -d option does not otherwise change the behavior of less on a + -d option does not otherwise change the behavior of less on a dumb terminal. -Dxcolor or --color=xcolor [MS-DOS only] Sets the color of the text displayed. x is a sin- - gle character which selects the type of text whose color is - being set: n=normal, s=standout, d=bold, u=underlined, k=blink. + gle character which selects the type of text whose color is be- + ing set: n=normal, s=standout, d=bold, u=underlined, k=blink. color is a pair of numbers separated by a period. The first number selects the foreground color and the second selects the background color of the text. A single number N is the same as - N.M, where M is the normal background color. A single number, - with a leading '.', .M is the same as N.M, where N is the normal - foreground color. The color may start or end with u to use - underline (with the normal color, if by itself), if the system - supports it (Windows only). x  may also be a  to toggle strict - ANSI sequence rendering (SGR mode). + N.M, where M is the normal background color. The color may + start or end with u to use underline (with the normal color, if + by itself), if the system supports it (Windows only). x may + also be a to toggle strict ANSI sequence rendering (SGR mode). -e or --quit-at-eof - Causes less to automatically exit the second time it reaches - end-of-file. By default, the only way to exit less is via the + Causes less to automatically exit the second time it reaches + end-of-file. By default, the only way to exit less is via the "q" command. -E or --QUIT-AT-EOF @@ -562,7 +557,7 @@ LESS(1) General Commands Manual LESS(1) -f or --force Forces non-regular files to be opened. (A non-regular file is a - directory or a device special file.) Also suppresses the warn- + directory or a device special file.) Also suppresses the warn- ing message when a binary file is opened. By default, less will refuse to open non-regular files. Note that some operating sys- tems will not allow directories to be read, even if -f is set. @@ -572,244 +567,244 @@ LESS(1) General Commands Manual LESS(1) played on the first screen. -g or --hilite-search - Normally, less will highlight ALL strings which match the last - search command. The -g option changes this behavior to high- - light only the particular string which was found by the last + Normally, less will highlight ALL strings which match the last + search command. The -g option changes this behavior to high- + light only the particular string which was found by the last search command. This can cause less to run somewhat faster than the default. -G or --HILITE-SEARCH - The -G option suppresses all highlighting of strings found by + The -G option suppresses all highlighting of strings found by search commands. -hn or --max-back-scroll=n - Specifies a maximum number of lines to scroll backward. If it + Specifies a maximum number of lines to scroll backward. If it is necessary to scroll backward more than n lines, the screen is repainted in a forward direction instead. (If the terminal does not have the ability to scroll backward, -h0 is implied.) -i or --ignore-case Causes searches to ignore case; that is, uppercase and lowercase - are considered identical. This option is ignored if any upper- - case letters appear in the search pattern; in other words, if a - pattern contains uppercase letters, then that search does not + are considered identical. This option is ignored if any upper- + case letters appear in the search pattern; in other words, if a + pattern contains uppercase letters, then that search does not ignore case. -I or --IGNORE-CASE - Like -i, but searches ignore case even if the pattern contains + Like -i, but searches ignore case even if the pattern contains uppercase letters. -jn or --jump-target=n - Specifies a line on the screen where the "target" line is to be - positioned. The target line is the line specified by any com- - mand to search for a pattern, jump to a line number, jump to a + Specifies a line on the screen where the "target" line is to be + positioned. The target line is the line specified by any com- + mand to search for a pattern, jump to a line number, jump to a file percentage or jump to a tag. The screen line may be speci- - fied by a number: the top line on the screen is 1, the next is + fied by a number: the top line on the screen is 1, the next is 2, and so on. The number may be negative to specify a line rel- ative to the bottom of the screen: the bottom line on the screen - is -1, the second to the bottom is -2, and so on. Alternately, - the screen line may be specified as a fraction of the height of - the screen, starting with a decimal point: .5 is in the middle - of the screen, .3 is three tenths down from the first line, and - so on. If the line is specified as a fraction, the actual line - number is recalculated if the terminal window is resized, so - that the target line remains at the specified fraction of the - screen height. If any form of the -j option is used, repeated - forward searches (invoked with "n" or "N") begin at the line - immediately after the target line, and repeated backward - searches begin at the target line, unless changed by -a or -A. - For example, if "-j4" is used, the target line is the fourth - line on the screen, so forward searches begin at the fifth line - on the screen. However nonrepeated searches (invoked with "/" - or "?") always begin at the start or end of the current screen - respectively. + is -1, the second to the bottom is -2, and so on. Alternately, + the screen line may be specified as a fraction of the height of + the screen, starting with a decimal point: .5 is in the middle + of the screen, .3 is three tenths down from the first line, and + so on. If the line is specified as a fraction, the actual line + number is recalculated if the terminal window is resized, so + that the target line remains at the specified fraction of the + screen height. If any form of the -j option is used, repeated + forward searches (invoked with "n" or "N") begin at the line im- + mediately after the target line, and repeated backward searches + begin at the target line, unless changed by -a or -A. For exam- + ple, if "-j4" is used, the target line is the fourth line on the + screen, so forward searches begin at the fifth line on the + screen. However nonrepeated searches (invoked with "/" or "?") + always begin at the start or end of the current screen respec- + tively. -J or --status-column - Displays a status column at the left edge of the screen. The - status column shows the lines that matched the current search, - and any lines that are marked (via the m or M command). The + Displays a status column at the left edge of the screen. The + status column shows the lines that matched the current search, + and any lines that are marked (via the m or M command). The status column is also used if the -w or -W option is in effect. -kfilename or --lesskey-file=filename - Causes less to open and interpret the named file as a lesskey - (1) file. Multiple -k options may be specified. If the LESSKEY - or LESSKEY_SYSTEM environment variable is set, or if a lesskey - file is found in a standard place (see KEY BINDINGS), it is also - used as a lesskey file. + Causes less to open and interpret the named file as a lesskey(1) + file. Multiple -k options may be specified. If the LESSKEY or + LESSKEY_SYSTEM environment variable is set, or if a lesskey file + is found in a standard place (see KEY BINDINGS), it is also used + as a lesskey file. -K or --quit-on-intr - Causes less to exit immediately (with status 2) when an inter- - rupt character (usually ^C) is typed. Normally, an interrupt + Causes less to exit immediately (with status 2) when an inter- + rupt character (usually ^C) is typed. Normally, an interrupt character causes less to stop whatever it is doing and return to - its command prompt. Note that use of this option makes it - impossible to return to the command prompt from the "F" command. + its command prompt. Note that use of this option makes it im- + possible to return to the command prompt from the "F" command. -L or --no-lessopen - Ignore the LESSOPEN environment variable (see the INPUT PRE- - PROCESSOR section below). This option can be set from within - less, but it will apply only to files opened subsequently, not + Ignore the LESSOPEN environment variable (see the INPUT PRE- + PROCESSOR section below). This option can be set from within + less, but it will apply only to files opened subsequently, not to the file which is currently open. -m or --long-prompt - Causes less to prompt verbosely (like more), with the percent + Causes less to prompt verbosely (like more), with the percent into the file. By default, less prompts with a colon. -M or --LONG-PROMPT Causes less to prompt even more verbosely than more. -n or --line-numbers - Suppresses line numbers. The default (to use line numbers) may - cause less to run more slowly in some cases, especially with a - very large input file. Suppressing line numbers with the -n - option will avoid this problem. Using line numbers means: the + Suppresses line numbers. The default (to use line numbers) may + cause less to run more slowly in some cases, especially with a + very large input file. Suppressing line numbers with the -n op- + tion will avoid this problem. Using line numbers means: the line number will be displayed in the verbose prompt and in the = - command, and the v command will pass the current line number to - the editor (see also the discussion of LESSEDIT in PROMPTS - below). + command, and the v command will pass the current line number to + the editor (see also the discussion of LESSEDIT in PROMPTS be- + low). -N or --LINE-NUMBERS - Causes a line number to be displayed at the beginning of each + Causes a line number to be displayed at the beginning of each line in the display. -ofilename or --log-file=filename - Causes less to copy its input to the named file as it is being + Causes less to copy its input to the named file as it is being viewed. This applies only when the input file is a pipe, not an - ordinary file. If the file already exists, less will ask for + ordinary file. If the file already exists, less will ask for confirmation before overwriting it. -Ofilename or --LOG-FILE=filename The -O option is like -o, but it will overwrite an existing file without asking for confirmation. - If no log file has been specified, the -o and -O options can be - used from within less to specify a log file. Without a file + If no log file has been specified, the -o and -O options can be + used from within less to specify a log file. Without a file name, they will simply report the name of the log file. The "s" command is equivalent to specifying -o from within less. -ppattern or --pattern=pattern - The -p option on the command line is equivalent to specifying - +/pattern; that is, it tells less to start at the first occur- + The -p option on the command line is equivalent to specifying + +/pattern; that is, it tells less to start at the first occur- rence of pattern in the file. -Pprompt or --prompt=prompt - Provides a way to tailor the three prompt styles to your own + Provides a way to tailor the three prompt styles to your own preference. This option would normally be put in the LESS envi- ronment variable, rather than being typed in with each less com- mand. Such an option must either be the last option in the LESS variable, or be terminated by a dollar sign. - -Ps followed by a string changes the default (short) prompt to + -Ps followed by a string changes the default (short) prompt to that string. -Pm changes the medium (-m) prompt. -PM changes the long (-M) prompt. -Ph changes the prompt for the help screen. -P= changes the message printed by the = command. - -Pw changes the message printed while waiting for data (in the + -Pw changes the message printed while waiting for data (in the F command). - All prompt strings consist of a sequence of letters and special + All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. -q or --quiet or --silent - Causes moderately "quiet" operation: the terminal bell is not + Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file. If the terminal has a "visual - bell", it is used instead. The bell will be rung on certain - other errors, such as typing an invalid character. The default + bell", it is used instead. The bell will be rung on certain + other errors, such as typing an invalid character. The default is to ring the terminal bell in all such cases. -Q or --QUIET or --SILENT - Causes totally "quiet" operation: the terminal bell is never - rung. If the terminal has a "visual bell", it is used in all + Causes totally "quiet" operation: the terminal bell is never + rung. If the terminal has a "visual bell", it is used in all cases where the terminal bell would have been rung. -r or --raw-control-chars Causes "raw" control characters to be displayed. The default is - to display control characters using the caret notation; for - example, a control-A (octal 001) is displayed as "^A". Warning: + to display control characters using the caret notation; for ex- + ample, a control-A (octal 001) is displayed as "^A". Warning: when the -r option is used, less cannot keep track of the actual - appearance of the screen (since this depends on how the screen + appearance of the screen (since this depends on how the screen responds to each type of control character). Thus, various dis- - play problems may result, such as long lines being split in the + play problems may result, such as long lines being split in the wrong place. -R or --RAW-CONTROL-CHARS - Like -r, but only ANSI "color" escape sequences are output in + Like -r, but only ANSI "color" escape sequences are output in "raw" form. Unlike -r, the screen appearance is maintained cor- - rectly in most cases. ANSI "color" escape sequences are - sequences of the form: + rectly in most cases. ANSI "color" escape sequences are se- + quences of the form: ESC [ ... m - where the "..." is zero or more color specification characters - For the purpose of keeping track of screen appearance, ANSI - color escape sequences are assumed to not move the cursor. You - can make less think that characters other than "m" can end ANSI - color escape sequences by setting the environment variable + where the "..." is zero or more color specification characters + For the purpose of keeping track of screen appearance, ANSI + color escape sequences are assumed to not move the cursor. You + can make less think that characters other than "m" can end ANSI + color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which can end a color - escape sequence. And you can make less think that characters - other than the standard ones may appear between the ESC and the - m by setting the environment variable LESSANSIMIDCHARS to the + escape sequence. And you can make less think that characters + other than the standard ones may appear between the ESC and the + m by setting the environment variable LESSANSIMIDCHARS to the list of characters which can appear. -s or --squeeze-blank-lines - Causes consecutive blank lines to be squeezed into a single + Causes consecutive blank lines to be squeezed into a single blank line. This is useful when viewing nroff output. -S or --chop-long-lines - Causes lines longer than the screen width to be chopped (trun- + Causes lines longer than the screen width to be chopped (trun- cated) rather than wrapped. That is, the portion of a long line that does not fit in the screen width is not displayed until you - press RIGHT-ARROW. The default is to wrap long lines; that is, + press RIGHT-ARROW. The default is to wrap long lines; that is, display the remainder on the next line. -ttag or --tag=tag The -t option, followed immediately by a TAG, will edit the file - containing that tag. For this to work, tag information must be - available; for example, there may be a file in the current - directory called "tags", which was previously built by ctags (1) - or an equivalent command. If the environment variable LESSGLOB- - ALTAGS is set, it is taken to be the name of a command compati- - ble with global (1), and that command is executed to find the - tag. (See http://www.gnu.org/software/global/global.html). The - -t option may also be specified from within less (using the - - command) as a way of examining a new file. The command ":t" is + containing that tag. For this to work, tag information must be + available; for example, there may be a file in the current di- + rectory called "tags", which was previously built by ctags(1) or + an equivalent command. If the environment variable LESSGLOBALT- + AGS is set, it is taken to be the name of a command compatible + with global(1), and that command is executed to find the tag. + (See http://www.gnu.org/software/global/global.html). The -t + option may also be specified from within less (using the - com- + mand) as a way of examining a new file. The command ":t" is equivalent to specifying -t from within less. -Ttagsfile or --tag-file=tagsfile Specifies a tags file to be used instead of "tags". -u or --underline-special - Causes backspaces and carriage returns to be treated as print- - able characters; that is, they are sent to the terminal when + Causes backspaces and carriage returns to be treated as print- + able characters; that is, they are sent to the terminal when they appear in the input. -U or --UNDERLINE-SPECIAL - Causes backspaces, tabs, carriage returns and "formatting char- + Causes backspaces, tabs, carriage returns and "formatting char- acters" (as defined by Unicode) to be treated as control charac- ters; that is, they are handled as specified by the -r option. - By default, if neither -u nor -U is given, backspaces which - appear adjacent to an underscore character are treated spe- - cially: the underlined text is displayed using the terminal's - hardware underlining capability. Also, backspaces which appear - between two identical characters are treated specially: the - overstruck text is printed using the terminal's hardware bold- - face capability. Other backspaces are deleted, along with the - preceding character. Carriage returns immediately followed by a - newline are deleted. Other carriage returns are handled as - specified by the -r option. Text which is overstruck or under- - lined can be searched for if neither -u nor -U is in effect. + By default, if neither -u nor -U is given, backspaces which ap- + pear adjacent to an underscore character are treated specially: + the underlined text is displayed using the terminal's hardware + underlining capability. Also, backspaces which appear between + two identical characters are treated specially: the overstruck + text is printed using the terminal's hardware boldface capabil- + ity. Other backspaces are deleted, along with the preceding + character. Carriage returns immediately followed by a newline + are deleted. Other carriage returns are handled as specified by + the -r option. Text which is overstruck or underlined can be + searched for if neither -u nor -U is in effect. -V or --version Displays the version number of less. -w or --hilite-unread - Temporarily highlights the first "new" line after a forward + Temporarily highlights the first "new" line after a forward movement of a full page. The first "new" line is the line imme- - diately following the line previously at the bottom of the + diately following the line previously at the bottom of the screen. Also highlights the target line after a g or p command. - The highlight is removed at the next command which causes move- - ment. The entire line is highlighted, unless the -J option is + The highlight is removed at the next command which causes move- + ment. The entire line is highlighted, unless the -J option is in effect, in which case only the status column is highlighted. -W or --HILITE-UNREAD @@ -817,48 +812,48 @@ LESS(1) General Commands Manual LESS(1) forward movement command larger than one line. -xn,... or --tabs=n,... - Sets tab stops. If only one n is specified, tab stops are set - at multiples of n. If multiple values separated by commas are - specified, tab stops are set at those positions, and then con- - tinue with the same spacing as the last two. For example, - -x9,17 will set tabs at positions 9, 17, 25, 33, etc. The - default for n is 8. + Sets tab stops. If only one n is specified, tab stops are set + at multiples of n. If multiple values separated by commas are + specified, tab stops are set at those positions, and then con- + tinue with the same spacing as the last two. For example, + -x9,17 will set tabs at positions 9, 17, 25, 33, etc. The de- + fault for n is 8. -X or --no-init Disables sending the termcap initialization and deinitialization - strings to the terminal. This is sometimes desirable if the - deinitialization string does something unnecessary, like clear- + strings to the terminal. This is sometimes desirable if the + deinitialization string does something unnecessary, like clear- ing the screen. -yn or --max-forw-scroll=n Specifies a maximum number of lines to scroll forward. If it is - necessary to scroll forward more than n lines, the screen is - repainted instead. The -c or -C option may be used to repaint - from the top of the screen if desired. By default, any forward + necessary to scroll forward more than n lines, the screen is re- + painted instead. The -c or -C option may be used to repaint + from the top of the screen if desired. By default, any forward movement causes scrolling. -zn or --window=n or -n - Changes the default scrolling window size to n lines. The - default is one screenful. The z and w commands can also be used - to change the window size. The "z" may be omitted for compati- + Changes the default scrolling window size to n lines. The de- + fault is one screenful. The z and w commands can also be used + to change the window size. The "z" may be omitted for compati- bility with some versions of more. If the number n is negative, - it indicates n lines less than the current screen size. For - example, if the screen is 24 lines, -z-4 sets the scrolling win- - dow to 20 lines. If the screen is resized to 40 lines, the + it indicates n lines less than the current screen size. For ex- + ample, if the screen is 24 lines, -z-4 sets the scrolling window + to 20 lines. If the screen is resized to 40 lines, the scrolling window automatically changes to 36 lines. -"cc or --quotes=cc - Changes the filename quoting character. This may be necessary - if you are trying to name a file which contains both spaces and - quote characters. Followed by a single character, this changes - the quote character to that character. Filenames containing a + Changes the filename quoting character. This may be necessary + if you are trying to name a file which contains both spaces and + quote characters. Followed by a single character, this changes + the quote character to that character. Filenames containing a space should then be surrounded by that character rather than by - double quotes. Followed by two characters, changes the open - quote to the first character, and the close quote to the second + double quotes. Followed by two characters, changes the open + quote to the first character, and the close quote to the second character. Filenames containing a space should then be preceded - by the open quote character and followed by the close quote - character. Note that even after the quote characters are - changed, this option remains -" (a dash followed by a double + by the open quote character and followed by the close quote + character. Note that even after the quote characters are + changed, this option remains -" (a dash followed by a double quote). -~ or --tilde @@ -868,26 +863,25 @@ LESS(1) General Commands Manual LESS(1) -# or --shift Specifies the default number of positions to scroll horizontally - in the RIGHTARROW and LEFTARROW commands. If the number speci- - fied is zero, it sets the default number of positions to one + in the RIGHTARROW and LEFTARROW commands. If the number speci- + fied is zero, it sets the default number of positions to one half of the screen width. Alternately, the number may be speci- - fied as a fraction of the width of the screen, starting with a - decimal point: .5 is half of the screen width, .3 is three - tenths of the screen width, and so on. If the number is speci- - fied as a fraction, the actual number of scroll positions is - recalculated if the terminal window is resized, so that the - actual scroll remains at the specified fraction of the screen - width. + fied as a fraction of the width of the screen, starting with a + decimal point: .5 is half of the screen width, .3 is three + tenths of the screen width, and so on. If the number is speci- + fied as a fraction, the actual number of scroll positions is re- + calculated if the terminal window is resized, so that the actual + scroll remains at the specified fraction of the screen width. --follow-name - Normally, if the input file is renamed while an F command is - executing, less will continue to display the contents of the - original file despite its name change. If --follow-name is - specified, during an F command less will periodically attempt to - reopen the file by name. If the reopen succeeds and the file is - a different file from the original (which means that a new file - has been created with the same name as the original (now - renamed) file), less will display the contents of that new file. + Normally, if the input file is renamed while an F command is ex- + ecuting, less will continue to display the contents of the orig- + inal file despite its name change. If --follow-name is speci- + fied, during an F command less will periodically attempt to re- + open the file by name. If the reopen succeeds and the file is a + different file from the original (which means that a new file + has been created with the same name as the original (now re- + named) file), less will display the contents of that new file. --mouse Enables mouse input: scrolling the mouse wheel down moves for- @@ -895,8 +889,8 @@ LESS(1) General Commands Manual LESS(1) in the file, and clicking the mouse sets the "#" mark to the line where the mouse is clicked. The number of lines to scroll when the wheel is moved can be set by the --wheel-lines option. - Mouse input works only on terminals which support X11 mouse - reporting, and on the Windows version of less. + Mouse input works only on terminals which support X11 mouse re- + porting, and on the Windows version of less. --MOUSE Like --mouse, except the direction scrolled on mouse wheel move- @@ -949,12 +943,11 @@ LESS(1) General Commands Manual LESS(1) of "xyz" in the file. As a special case, + acts like +g; that is, it starts the display at the specified line number (however, see the caveat under the "g" command above). - If the option starts with ++, the initial command applies to - every file being viewed, not just the first one. The + command + If the option starts with ++, the initial command applies to ev- + ery file being viewed, not just the first one. The + command described previously may also be used to set (or change) an ini- tial command for every file. - LINE EDITING When entering command line at the bottom of the screen (for example, a filename for the :e command, or the pattern for a search command), cer- @@ -1036,9 +1029,8 @@ LESS(1) General Commands Manual LESS(1) ^G Delete the entire command line and return to the main prompt. - KEY BINDINGS - You may define your own less commands by using the program lesskey (1) + You may define your own less commands by using the program lesskey(1) to create a lesskey file. This file specifies a set of command keys and an action associated with each key. You may also use lesskey to change the line-editing keys (see LINE EDITING), and to set environment @@ -1053,8 +1045,8 @@ LESS(1) General Commands Manual LESS(1) looks for a lesskey file called "less.ini" in any directory specified in the INIT environment variable, and if it not found there, then looks for a lesskey file called "less.ini" in any directory specified in the - PATH environment variable. See the lesskey manual page for more - details. + PATH environment variable. See the lesskey manual page for more de- + tails. A system-wide lesskey file may also be set up to provide key bindings. If a key is defined in both a local lesskey file and in the system-wide @@ -1068,7 +1060,6 @@ LESS(1) General Commands Manual LESS(1) MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys- less. On OS/2 systems, the system-wide lesskey file is c:\sysless.ini. - INPUT PREPROCESSOR You may define an "input preprocessor" for less. Before less opens a file, it first gives your input preprocessor a chance to modify the way @@ -1085,25 +1076,24 @@ LESS(1) General Commands Manual LESS(1) file, and when finished, print the name of the replacement file to its standard output. If the input preprocessor does not output a replace- ment filename, less uses the original file, as normal. The input pre- - processor is not called when viewing standard input. To set up an - input preprocessor, set the LESSOPEN environment variable to a command + processor is not called when viewing standard input. To set up an in- + put preprocessor, set the LESSOPEN environment variable to a command line which will invoke your input preprocessor. This command line - should include one occurrence of the string "%s", which will be - replaced by the filename when the input preprocessor command is - invoked. + should include one occurrence of the string "%s", which will be re- + placed by the filename when the input preprocessor command is invoked. When less closes a file opened in such a way, it will call another pro- - gram, called the input postprocessor, which may perform any desired - clean-up action (such as deleting the replacement file created by + gram, called the input postprocessor, which may perform any desired + clean-up action (such as deleting the replacement file created by LESSOPEN). This program receives two command line arguments, the orig- - inal filename as entered by the user, and the name of the replacement - file. To set up an input postprocessor, set the LESSCLOSE environment - variable to a command line which will invoke your input postprocessor. - It may include two occurrences of the string "%s"; the first is - replaced with the original name of the file and the second with the - name of the replacement file, which was output by LESSOPEN. - - For example, on many Unix systems, these two scripts will allow you to + inal filename as entered by the user, and the name of the replacement + file. To set up an input postprocessor, set the LESSCLOSE environment + variable to a command line which will invoke your input postprocessor. + It may include two occurrences of the string "%s"; the first is re- + placed with the original name of the file and the second with the name + of the replacement file, which was output by LESSOPEN. + + For example, on many Unix systems, these two scripts will allow you to keep files in compressed format, but still let less view them directly: lessopen.sh: @@ -1123,27 +1113,27 @@ LESS(1) General Commands Manual LESS(1) #! /bin/sh rm $2 - To use these scripts, put them both where they can be executed and set + To use these scripts, put them both where they can be executed and set LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More - complex LESSOPEN and LESSCLOSE scripts may be written to accept other + complex LESSOPEN and LESSCLOSE scripts may be written to accept other types of compressed files, and so on. - It is also possible to set up an input preprocessor to pipe the file - data directly to less, rather than putting the data into a replacement + It is also possible to set up an input preprocessor to pipe the file + data directly to less, rather than putting the data into a replacement file. This avoids the need to decompress the entire file before start- ing to view it. An input preprocessor that works this way is called an - input pipe. An input pipe, instead of writing the name of a replace- - ment file on its standard output, writes the entire contents of the - replacement file on its standard output. If the input pipe does not - write any characters on its standard output, then there is no replace- - ment file and less uses the original file, as normal. To use an input - pipe, make the first character in the LESSOPEN environment variable a - vertical bar (|) to signify that the input preprocessor is an input - pipe. As with non-pipe input preprocessors, the command string must - contain one occurrence of %s, which is replaced with the filename of + input pipe. An input pipe, instead of writing the name of a replace- + ment file on its standard output, writes the entire contents of the re- + placement file on its standard output. If the input pipe does not + write any characters on its standard output, then there is no replace- + ment file and less uses the original file, as normal. To use an input + pipe, make the first character in the LESSOPEN environment variable a + vertical bar (|) to signify that the input preprocessor is an input + pipe. As with non-pipe input preprocessors, the command string must + contain one occurrence of %s, which is replaced with the filename of the input file. - For example, on many Unix systems, this script will work like the pre- + For example, on many Unix systems, this script will work like the pre- vious example scripts: lesspipe.sh: @@ -1159,34 +1149,33 @@ LESS(1) General Commands Manual LESS(1) To use this script, put it where it can be executed and set LESSOPEN="|lesspipe.sh %s". - Note that a preprocessor cannot output an empty file, since that is - interpreted as meaning there is no replacement, and the original file - is used. To avoid this, if LESSOPEN starts with two vertical bars, the - exit status of the script becomes meaningful. If the exit status is - zero, the output is considered to be replacement text, even if it is - empty. If the exit status is nonzero, any output is ignored and the - original file is used. For compatibility with previous versions of + Note that a preprocessor cannot output an empty file, since that is in- + terpreted as meaning there is no replacement, and the original file is + used. To avoid this, if LESSOPEN starts with two vertical bars, the + exit status of the script becomes meaningful. If the exit status is + zero, the output is considered to be replacement text, even if it is + empty. If the exit status is nonzero, any output is ignored and the + original file is used. For compatibility with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. - When an input pipe is used, a LESSCLOSE postprocessor can be used, but + When an input pipe is used, a LESSCLOSE postprocessor can be used, but it is usually not necessary since there is no replacement file to clean - up. In this case, the replacement file name passed to the LESSCLOSE + up. In this case, the replacement file name passed to the LESSCLOSE postprocessor is "-". - For compatibility with previous versions of less, the input preproces- + For compatibility with previous versions of less, the input preproces- sor or pipe is not used if less is viewing standard input. However, if - the first character of LESSOPEN is a dash (-), the input preprocessor - is used on standard input as well as other files. In this case, the - dash is not considered to be part of the preprocessor command. If + the first character of LESSOPEN is a dash (-), the input preprocessor + is used on standard input as well as other files. In this case, the + dash is not considered to be part of the preprocessor command. If standard input is being viewed, the input preprocessor is passed a file - name consisting of a single dash. Similarly, if the first two charac- - ters of LESSOPEN are vertical bar and dash (|-) or two vertical bars - and a dash (||-), the input pipe is used on standard input as well as + name consisting of a single dash. Similarly, if the first two charac- + ters of LESSOPEN are vertical bar and dash (|-) or two vertical bars + and a dash (||-), the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. - NATIONAL CHARACTER SETS There are three types of characters in the input file: @@ -1194,25 +1183,25 @@ LESS(1) General Commands Manual LESS(1) can be displayed directly to the screen. control characters - should not be displayed directly, but are expected to be found + should not be displayed directly, but are expected to be found in ordinary text files (such as backspace and tab). binary characters - should not be displayed directly and are not expected to be + should not be displayed directly and are not expected to be found in text files. A "character set" is simply a description of which characters are to be - considered normal, control, and binary. The LESSCHARSET environment - variable may be used to select a character set. Possible values for + considered normal, control, and binary. The LESSCHARSET environment + variable may be used to select a character set. Possible values for LESSCHARSET are: - ascii BS, TAB, NL, CR, and formfeed are control characters, all chars - with values between 32 and 126 are normal, and all others are + ascii BS, TAB, NL, CR, and formfeed are control characters, all chars + with values between 32 and 126 are normal, and all others are binary. iso8859 - Selects an ISO 8859 character set. This is the same as ASCII, - except characters between 160 and 255 are treated as normal + Selects an ISO 8859 character set. This is the same as ASCII, + except characters between 160 and 255 are treated as normal characters. latin1 Same as iso8859. @@ -1224,8 +1213,8 @@ LESS(1) General Commands Manual LESS(1) ebcdic Selects an EBCDIC character set. IBM-1047 - Selects an EBCDIC character set used by OS/390 Unix Services. - This is the EBCDIC analogue of latin1. You get similar results + Selects an EBCDIC character set used by OS/390 Unix Services. + This is the EBCDIC analogue of latin1. You get similar results by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your environment. @@ -1233,102 +1222,101 @@ LESS(1) General Commands Manual LESS(1) next Selects a character set appropriate for NeXT computers. - utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. - UTF-8 is special in that it supports multi-byte characters in - the input file. It is the only character set that supports + utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. + UTF-8 is special in that it supports multi-byte characters in + the input file. It is the only character set that supports multi-byte characters. windows - Selects a character set appropriate for Microsoft Windows (cp + Selects a character set appropriate for Microsoft Windows (cp 1251). - In rare cases, it may be desired to tailor less to use a character set - other than the ones definable by LESSCHARSET. In this case, the envi- + In rare cases, it may be desired to tailor less to use a character set + other than the ones definable by LESSCHARSET. In this case, the envi- ronment variable LESSCHARDEF can be used to define a character set. It should be set to a string where each character in the string represents - one character in the character set. The character "." is used for a - normal character, "c" for control, and "b" for binary. A decimal num- - ber may be used for repetition. For example, "bccc4b." would mean - character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are - binary, and 8 is normal. All characters after the last are taken to be - the same as the last, so characters 9 through 255 would be normal. - (This is an example, and does not necessarily represent any real char- + one character in the character set. The character "." is used for a + normal character, "c" for control, and "b" for binary. A decimal num- + ber may be used for repetition. For example, "bccc4b." would mean + character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are bi- + nary, and 8 is normal. All characters after the last are taken to be + the same as the last, so characters 9 through 255 would be normal. + (This is an example, and does not necessarily represent any real char- acter set.) - This table shows the value of LESSCHARDEF which is equivalent to each + This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: - ascii 8bcccbcc18b95.b - dos 8bcccbcc12bc5b95.b. - ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b - 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. - IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc - 191.b - iso8859 8bcccbcc18b95.33b. - koi8-r 8bcccbcc18b95.b128. - latin1 8bcccbcc18b95.33b. - next 8bcccbcc18b95.bb125.bb - - If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings - "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or + ascii 8bcccbcc18b95.b + dos 8bcccbcc12bc5b95.b. + ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b + 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. + IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc + 191.b + iso8859 8bcccbcc18b95.33b. + koi8-r 8bcccbcc18b95.b128. + latin1 8bcccbcc18b95.33b. + next 8bcccbcc18b95.bb125.bb + + If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings + "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or LANG environment variables, then the default character set is utf-8. - If that string is not found, but your system supports the setlocale - interface, less will use setlocale to determine the character set. - setlocale is controlled by setting the LANG or LC_CTYPE environment - variables. + If that string is not found, but your system supports the setlocale in- + terface, less will use setlocale to determine the character set. set- + locale is controlled by setting the LANG or LC_CTYPE environment vari- + ables. - Finally, if the setlocale interface is also not available, the default + Finally, if the setlocale interface is also not available, the default character set is latin1. - Control and binary characters are displayed in standout (reverse + Control and binary characters are displayed in standout (reverse video). Each such character is displayed in caret notation if possible - (e.g. ^A for control-A). Caret notation is used only if inverting the + (e.g. ^A for control-A). Caret notation is used only if inverting the 0100 bit results in a normal printable character. Otherwise, the char- - acter is displayed as a hex number in angle brackets. This format can - be changed by setting the LESSBINFMT environment variable. LESSBINFMT + acter is displayed as a hex number in angle brackets. This format can + be changed by setting the LESSBINFMT environment variable. LESSBINFMT may begin with a "*" and one character to select the display attribute: - "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, - and "*n" is normal. If LESSBINFMT does not begin with a "*", normal - attribute is assumed. The remainder of LESSBINFMT is a string which - may include one printf-style escape sequence (a % followed by x, X, o, - d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters - are displayed in underlined hexadecimal surrounded by brackets. The - default if no LESSBINFMT is specified is "*s<%02X>". Warning: the - result of expanding the character via LESSBINFMT must be less than 31 + "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, + and "*n" is normal. If LESSBINFMT does not begin with a "*", normal + attribute is assumed. The remainder of LESSBINFMT is a string which + may include one printf-style escape sequence (a % followed by x, X, o, + d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters + are displayed in underlined hexadecimal surrounded by brackets. The + default if no LESSBINFMT is specified is "*s<%02X>". Warning: the re- + sult of expanding the character via LESSBINFMT must be less than 31 characters. When the character set is utf-8, the LESSUTFBINFMT environment variable acts similarly to LESSBINFMT but it applies to Unicode code points that - were successfully decoded but are unsuitable for display (e.g., unas- - signed code points). Its default value is "". Note that - LESSUTFBINFMT and LESSBINFMT share their display attribute setting - ("*x") so specifying one will affect both; LESSUTFBINFMT is read after - LESSBINFMT so its setting, if any, will have priority. Problematic - octets in a UTF-8 file (octets of a truncated sequence, octets of a - complete but non-shortest form sequence, illegal octets, and stray - trailing octets) are displayed individually using LESSBINFMT so as to + were successfully decoded but are unsuitable for display (e.g., unas- + signed code points). Its default value is "". Note that + LESSUTFBINFMT and LESSBINFMT share their display attribute setting + ("*x") so specifying one will affect both; LESSUTFBINFMT is read after + LESSBINFMT so its setting, if any, will have priority. Problematic + octets in a UTF-8 file (octets of a truncated sequence, octets of a + complete but non-shortest form sequence, invalid octets, and stray + trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. - PROMPTS - The -P option allows you to tailor the prompt to your preference. The - string given to the -P option replaces the specified prompt string. + The -P option allows you to tailor the prompt to your preference. The + string given to the -P option replaces the specified prompt string. Certain characters in the string are interpreted specially. The prompt - mechanism is rather complicated to provide flexibility, but the ordi- - nary user need not understand the details of constructing personalized + mechanism is rather complicated to provide flexibility, but the ordi- + nary user need not understand the details of constructing personalized prompt strings. - A percent sign followed by a single character is expanded according to + A percent sign followed by a single character is expanded according to what the following character is: - %bX Replaced by the byte offset into the current input file. The b + %bX Replaced by the byte offset into the current input file. The b is followed by a single character (shown as X above) which spec- - ifies the line whose byte offset is to be used. If the charac- - ter is a "t", the byte offset of the top line in the display is + ifies the line whose byte offset is to be used. If the charac- + ter is a "t", the byte offset of the top line in the display is used, an "m" means use the middle line, a "b" means use the bot- - tom line, a "B" means use the line just after the bottom line, - and a "j" means use the "target" line, as specified by the -j + tom line, a "B" means use the line just after the bottom line, + and a "j" means use the "target" line, as specified by the -j option. %B Replaced by the size of the current input file. @@ -1336,50 +1324,50 @@ LESS(1) General Commands Manual LESS(1) %c Replaced by the column number of the text appearing in the first column of the screen. - %dX Replaced by the page number of a line in the input file. The + %dX Replaced by the page number of a line in the input file. The line to be used is determined by the X, as with the %b option. - %D Replaced by the number of pages in the input file, or equiva- + %D Replaced by the number of pages in the input file, or equiva- lently, the page number of the last line in the input file. - %E Replaced by the name of the editor (from the VISUAL environment - variable, or the EDITOR environment variable if VISUAL is not + %E Replaced by the name of the editor (from the VISUAL environment + variable, or the EDITOR environment variable if VISUAL is not defined). See the discussion of the LESSEDIT feature below. %f Replaced by the name of the current input file. - %F Replaced by the last component of the name of the current input + %F Replaced by the last component of the name of the current input file. - %g Replaced by the shell-escaped name of the current input file. - This is useful when the expanded string will be used in a shell + %g Replaced by the shell-escaped name of the current input file. + This is useful when the expanded string will be used in a shell command, such as in LESSEDIT. - %i Replaced by the index of the current file in the list of input + %i Replaced by the index of the current file in the list of input files. - %lX Replaced by the line number of a line in the input file. The + %lX Replaced by the line number of a line in the input file. The line to be used is determined by the X, as with the %b option. %L Replaced by the line number of the last line in the input file. %m Replaced by the total number of input files. - %pX Replaced by the percent into the current input file, based on - byte offsets. The line used is determined by the X as with the + %pX Replaced by the percent into the current input file, based on + byte offsets. The line used is determined by the X as with the %b option. - %PX Replaced by the percent into the current input file, based on - line numbers. The line used is determined by the X as with the + %PX Replaced by the percent into the current input file, based on + line numbers. The line used is determined by the X as with the %b option. %s Same as %B. - %t Causes any trailing spaces to be removed. Usually used at the + %t Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. - %T Normally expands to the word "file". However if viewing files - via a tags list using the -t option, it expands to the word + %T Normally expands to the word "file". However if viewing files + via a tags list using the -t option, it expands to the word "tag". %x Replaced by the name of the next input file in the list. @@ -1387,15 +1375,15 @@ LESS(1) General Commands Manual LESS(1) If any item is unknown (for example, the file size if input is a pipe), a question mark is printed instead. - The format of the prompt string can be changed depending on certain - conditions. A question mark followed by a single character acts like - an "IF": depending on the following character, a condition is evalu- - ated. If the condition is true, any characters following the question - mark and condition character, up to a period, are included in the - prompt. If the condition is false, such characters are not included. - A colon appearing between the question mark and the period can be used + The format of the prompt string can be changed depending on certain + conditions. A question mark followed by a single character acts like + an "IF": depending on the following character, a condition is evalu- + ated. If the condition is true, any characters following the question + mark and condition character, up to a period, are included in the + prompt. If the condition is false, such characters are not included. + A colon appearing between the question mark and the period can be used to establish an "ELSE": any characters between the colon and the period - are included in the string if and only if the IF condition is false. + are included in the string if and only if the IF condition is false. Condition characters (which follow a question mark) may be: ?a True if any characters have been included in the prompt so far. @@ -1410,7 +1398,7 @@ LESS(1) General Commands Manual LESS(1) ?e True if at end-of-file. - ?f True if there is an input filename (that is, if input is not a + ?f True if there is an input filename (that is, if input is not a pipe). ?lX True if the line number of the specified line is known. @@ -1421,73 +1409,71 @@ LESS(1) General Commands Manual LESS(1) ?n True if this is the first prompt in a new input file. - ?pX True if the percent into the current input file, based on byte + ?pX True if the percent into the current input file, based on byte offsets, of the specified line is known. - ?PX True if the percent into the current input file, based on line + ?PX True if the percent into the current input file, based on line numbers, of the specified line is known. ?s Same as "?B". - ?x True if there is a next input file (that is, if the current - input file is not the last one). + ?x True if there is a next input file (that is, if the current in- + put file is not the last one). - Any characters other than the special ones (question mark, colon, - period, percent, and backslash) become literally part of the prompt. - Any of the special characters may be included in the prompt literally - by preceding it with a backslash. + Any characters other than the special ones (question mark, colon, pe- + riod, percent, and backslash) become literally part of the prompt. Any + of the special characters may be included in the prompt literally by + preceding it with a backslash. Some examples: ?f%f:Standard input. - This prompt prints the filename, if known; otherwise the string "Stan- + This prompt prints the filename, if known; otherwise the string "Stan- dard input". ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... - This prompt would print the filename, if known. The filename is fol- - lowed by the line number, if known, otherwise the percent if known, - otherwise the byte offset if known. Otherwise, a dash is printed. - Notice how each question mark has a matching period, and how the % - after the %pt is included literally by escaping it with a backslash. + This prompt would print the filename, if known. The filename is fol- + lowed by the line number, if known, otherwise the percent if known, + otherwise the byte offset if known. Otherwise, a dash is printed. No- + tice how each question mark has a matching period, and how the % after + the %pt is included literally by escaping it with a backslash. ?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\: %x..%t"; - This prints the filename if this is the first prompt in a file, fol- - lowed by the "file N of N" message if there is more than one input - file. Then, if we are at end-of-file, the string "(END)" is printed - followed by the name of the next file, if there is one. Finally, any + This prints the filename if this is the first prompt in a file, fol- + lowed by the "file N of N" message if there is more than one input + file. Then, if we are at end-of-file, the string "(END)" is printed + followed by the name of the next file, if there is one. Finally, any trailing spaces are truncated. This is the default prompt. For refer- - ence, here are the defaults for the other two prompts (-m and -M - respectively). Each is broken into two lines here for readability - only. + ence, here are the defaults for the other two prompts (-m and -M re- + spectively). Each is broken into two lines here for readability only. ?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\: %x.: - ?pB%pB\%:byte %bB?s/%s...%t + ?pB%pB\%:byte %bB?s/%s...%t ?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. : - byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t + byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t And here is the default message produced by the = command: ?f%f .?m(%T %i of %m) .?ltlines %lt-%lb?L/%L. . - byte %bB?s/%s. ?e(END) :?pB%pB\%..%t + byte %bB?s/%s. ?e(END) :?pB%pB\%..%t The prompt expansion features are also used for another purpose: if an environment variable LESSEDIT is defined, it is used as the command to - be executed when the v command is invoked. The LESSEDIT string is - expanded in the same way as the prompt strings. The default value for + be executed when the v command is invoked. The LESSEDIT string is ex- + panded in the same way as the prompt strings. The default value for LESSEDIT is: - %E ?lm+%lm. %g + %E ?lm+%lm. %g Note that this expands to the editor name, followed by a + and the line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invo- - cation syntax, the LESSEDIT variable can be changed to modify this - default. - + cation syntax, the LESSEDIT variable can be changed to modify this de- + fault. SECURITY When the environment variable LESSSECURE is set to 1, less runs in a @@ -1513,16 +1499,15 @@ LESS(1) General Commands Manual LESS(1) Less can also be compiled to be permanently in "secure" mode. - COMPATIBILITY WITH MORE If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", less behaves (mostly) in con- formance with the POSIX "more" command specification. In this mode, less behaves differently in these ways: - The -e option works differently. If the -e option is not set, less - behaves as if the -e option were set. If the -e option is set, less - behaves as if the -E option were set. + The -e option works differently. If the -e option is not set, less be- + haves as if the -e option were set. If the -e option is set, less be- + haves as if the -E option were set. The -m option works differently. If the -m option is not set, the medium prompt is used, and it is prefixed with the string "--More--". @@ -1537,33 +1522,31 @@ LESS(1) General Commands Manual LESS(1) The LESS environment variable is ignored, and the MORE environment variable is used in its place. - ENVIRONMENT VARIABLES Environment variables may be specified either in the system environment - as usual, or in a lesskey (1) file. If environment variables are - defined in more than one place, variables defined in a local lesskey - file take precedence over variables defined in the system environment, - which take precedence over variables defined in the system-wide lesskey - file. + as usual, or in a lesskey(1) file. If environment variables are de- + fined in more than one place, variables defined in a local lesskey file + take precedence over variables defined in the system environment, which + take precedence over variables defined in the system-wide lesskey file. COLUMNS Sets the number of columns on the screen. Takes precedence over - the number of columns specified by the TERM variable. (But if + the number of columns specified by the TERM variable. (But if you have a windowing system which supports TIOCGWINSZ or - WIOCGETD, the window system's idea of the screen size takes + WIOCGETD, the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables.) EDITOR The name of the editor (used for the v command). - HOME Name of the user's home directory (used to find a lesskey file + HOME Name of the user's home directory (used to find a lesskey file on Unix and OS/2 systems). HOMEDRIVE, HOMEPATH - Concatenation of the HOMEDRIVE and HOMEPATH environment vari- + Concatenation of the HOMEDRIVE and HOMEPATH environment vari- ables is the name of the user's home directory if the HOME vari- able is not set (only in the Windows version). - INIT Name of the user's init directory (used to find a lesskey file + INIT Name of the user's init directory (used to find a lesskey file on OS/2 systems). LANG Language for determining the character set. @@ -1574,12 +1557,12 @@ LESS(1) General Commands Manual LESS(1) LESS Options which are passed to less automatically. LESSANSIENDCHARS - Characters which may end an ANSI color escape sequence (default + Characters which may end an ANSI color escape sequence (default "m"). LESSANSIMIDCHARS - Characters which may appear between the ESC character and the - end character in an ANSI color escape sequence (default + Characters which may appear between the ESC character and the + end character in an ANSI color escape sequence (default "0123456789:;[?!"'#%()*+ ". LESSBINFMT @@ -1596,24 +1579,24 @@ LESS(1) General Commands Manual LESS(1) LESSECHO Name of the lessecho program (default "lessecho"). The lessecho - program is needed to expand metacharacters, such as * and ?, in + program is needed to expand metacharacters, such as * and ?, in filenames on Unix systems. LESSEDIT - Editor prototype string (used for the v command). See discus- + Editor prototype string (used for the v command). See discus- sion under PROMPTS. LESSGLOBALTAGS - Name of the command used by the -t option to find global tags. - Normally should be set to "global" if your system has the global - (1) command. If not set, global tags are not used. + Name of the command used by the -t option to find global tags. + Normally should be set to "global" if your system has the + global(1) command. If not set, global tags are not used. LESSHISTFILE - Name of the history file used to remember search commands and - shell commands between invocations of less. If set to "-" or - "/dev/null", a history file is not used. The default is - "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and - Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" + Name of the history file used to remember search commands and + shell commands between invocations of less. If set to "-" or + "/dev/null", a history file is not used. The default is + "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and + Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" on OS/2 systems. LESSHISTSIZE @@ -1621,19 +1604,19 @@ LESS(1) General Commands Manual LESS(1) default is 100. LESSKEY - Name of the default lesskey(1) file. + Name of the default lesskey(1) file. LESSKEY_SYSTEM - Name of the default system-wide lesskey(1) file. + Name of the default system-wide lesskey(1) file. LESSMETACHARS - List of characters which are considered "metacharacters" by the + List of characters which are considered "metacharacters" by the shell. LESSMETAESCAPE - Prefix which less will add before each metacharacter in a com- - mand sent to the shell. If LESSMETAESCAPE is an empty string, - commands containing metacharacters will not be passed to the + Prefix which less will add before each metacharacter in a com- + mand sent to the shell. If LESSMETAESCAPE is an empty string, + commands containing metacharacters will not be passed to the shell. LESSOPEN @@ -1643,58 +1626,55 @@ LESS(1) General Commands Manual LESS(1) Runs less in "secure" mode. See discussion under SECURITY. LESSSEPARATOR - String to be appended to a directory name in filename comple- + String to be appended to a directory name in filename comple- tion. LESSUTFBINFMT Format for displaying non-printable Unicode code points. LESS_IS_MORE - Emulate the more (1) command. + Emulate the more(1) command. - LINES Sets the number of lines on the screen. Takes precedence over + LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. (But if you - have a windowing system which supports TIOCGWINSZ or WIOCGETD, - the window system's idea of the screen size takes precedence + have a windowing system which supports TIOCGWINSZ or WIOCGETD, + the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables.) - MORE Options which are passed to less automatically when running in + MORE Options which are passed to less automatically when running in more compatible mode. - PATH User's search path (used to find a lesskey file on MS-DOS and + PATH User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). - SHELL The shell used to execute the ! command, as well as to expand + SHELL The shell used to execute the ! command, as well as to expand filenames. TERM The type of terminal on which less is being run. VISUAL The name of the editor (used for the v command). - SEE ALSO - lesskey(1) - + lesskey(1) COPYRIGHT Copyright (C) 1984-2020 Mark Nudelman - less is part of the GNU project and is free software. You can redis- - tribute it and/or modify it under the terms of either (1) the GNU Gen- - eral Public License as published by the Free Software Foundation; or + less is part of the GNU project and is free software. You can redis- + tribute it and/or modify it under the terms of either (1) the GNU Gen- + eral Public License as published by the Free Software Foundation; or (2) the Less License. See the file README in the less distribution for more details regarding redistribution. You should have received a copy - of the GNU General Public License along with the source for less; see - the file COPYING. If not, write to the Free Software Foundation, 59 - Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also + of the GNU General Public License along with the source for less; see + the file COPYING. If not, write to the Free Software Foundation, 59 + Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also have received a copy of the Less License; see the file LICENSE. less is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- - NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- + NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - AUTHOR Mark Nudelman Report bugs at https://github.com/gwsw/less/issues. @@ -1703,4 +1683,4 @@ LESS(1) General Commands Manual LESS(1) - Version 557: 21 Mar 2020 LESS(1) + Version 562: 19 May 2020 LESS(1) diff --git a/less.nro b/less.nro index 0552366..fe0ae4d 100644 --- a/less.nro +++ b/less.nro @@ -1,4 +1,5 @@ -.TH LESS 1 "Version 557: 21 Mar 2020" +'\" t +.TH LESS 1 "Version 562: 19 May 2020" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -21,19 +22,18 @@ less \- opposite of more .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) - +. .SH DESCRIPTION .I Less is a program similar to -.I more -(1), but which allows backward movement +.IR more (1), +but which allows backward movement in the file as well as forward movement. Also, .I less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like -.I vi -(1). +.IR vi (1). .I Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. @@ -48,7 +48,7 @@ and Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. - +. .SH COMMANDS In the following descriptions, ^X means control-X. ESC stands for the ESCAPE key; for example ESC-v means the @@ -376,7 +376,7 @@ this will reset the option to the "opposite" of its default setting and print a message describing the new setting. This does not work for numeric or string-valued options. .IP \-\-! -Like the \-! command, but takes a long option name +Like the \-!\& command, but takes a long option name rather than a single option letter. .IP _ (Underscore.) @@ -405,7 +405,7 @@ Exits The following four commands may or may not be valid, depending on your particular installation. -.PP +. .IP v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, @@ -434,7 +434,7 @@ If is \&.\& or newline, the current screen is piped. .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. -.PP +. .SH OPTIONS Command line options are described below. Most options may be changed while @@ -518,7 +518,7 @@ This was the default behavior in less versions prior to 441. Specifies the amount of buffer space .I less will use for each file, in units of kilobytes (1024 bytes). -By default 64\ K of buffer space is used for each file +By default 64\ KB of buffer space is used for each file (unless the file is a pipe; see the \-B option). The \-b option specifies instead that \fIn\fP kilobytes of buffer space should be used for each file. @@ -530,7 +530,7 @@ buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. The \-B option disables this automatic allocation of buffers for pipes, -so that only 64\ K +so that only 64\ KB (or the amount of space specified by the \-b option) is used for the pipe. Warning: use of \-B can result in erroneous display, since only the @@ -563,8 +563,9 @@ A single number \fIN\fP is the same as \fIN.M\fP, where \fIM\fP is the normal background color. The color may start or end with \fBu\fP to use underline (with the normal color, if by itself), if the system supports it (Windows only). -\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode). - +\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering +(SGR mode). +. .IP "\-e or \-\-quit-at-eof" Causes .I less @@ -654,8 +655,8 @@ The status column is also used if the \-w or \-W option is in effect. Causes .I less to open and interpret the named file as a -.I lesskey -(1) file. +.IR lesskey (1) +file. Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), @@ -746,7 +747,7 @@ to that string. \-Ph changes the prompt for the help screen. \-P= changes the message printed by the = command. \-Pw changes the message printed while waiting for data (in the F command). - +.sp 1 All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. @@ -813,12 +814,12 @@ will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", which was previously built by -.I ctags -(1) or an equivalent command. +.IR ctags (1) +or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be the name of a command compatible with -.I global -(1), and that command is executed to find the tag. +.IR global (1), +and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). The \-t option may also be specified from within .I less @@ -870,7 +871,7 @@ If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP. If multiple values separated by commas are specified, tab stops are set at those positions, and then continue with the same spacing as the last two. -For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. +For example, \fI\-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. The default for \fIn\fP is 8. .IP "\-X or \-\-no-init" Disables sending the termcap initialization and deinitialization strings @@ -969,7 +970,7 @@ Normally, a string may appear multiple times. This option changes the character used to mark truncated lines. It may begin with a two-character attribute indicator like LESSBINFMT does. If there is no attribute indicator, standout is used. -If set to "-", truncated lines are not marked. +If set to "\-", truncated lines are not marked. .IP "\-\-save-marks" Save marks in the history file, so marks are retained across different invocations of \fIless\fP. @@ -1001,7 +1002,7 @@ If the option starts with ++, the initial command applies to every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file. - +. .SH "LINE EDITING" When entering command line at the bottom of the screen (for example, a filename for the :e command, @@ -1069,13 +1070,12 @@ If you have changed your line-kill character in Unix to something other than ^U, that character is used instead of ^U. .IP "^G" Delete the entire command line and return to the main prompt. - +. .SH "KEY BINDINGS" You may define your own .I less commands by using the program -.I lesskey -(1) +.IR lesskey (1) to create a lesskey file. This file specifies a set of command keys and an action associated with each key. @@ -1125,7 +1125,7 @@ was built with a different sysconf directory than /usr/local/etc, that directory is where the sysless file is found.) On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless. On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. - +. .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for .IR less . @@ -1294,7 +1294,7 @@ Similarly, if the first two characters of LESSOPEN are vertical bar and dash the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. - +. .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: .IP "normal characters" @@ -1349,7 +1349,7 @@ In this case, the environment variable LESSCHARDEF can be used to define a character set. It should be set to a string where each character in the string represents one character in the character set. -The character "." is used for a normal character, "c" for control, +The character ".\&" is used for a normal character, "c" for control, and "b" for binary. A decimal number may be used for repetition. For example, "bccc4b.\&" would mean character 0 is binary, @@ -1361,26 +1361,22 @@ represent any real character set.) .PP This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: -.sp - ascii\ 8bcccbcc18b95.b -.br - dos\ \ \ 8bcccbcc12bc5b95.b. -.br - ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b -.br - \ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. -.br - IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc -.br - \ \ \ \ \ \ 191.b -.br - iso8859 8bcccbcc18b95.33b. -.br - koi8-r 8bcccbcc18b95.b128. -.br - latin1 8bcccbcc18b95.33b. -.br - next\ \ 8bcccbcc18b95.bb125.bb +. +.RS 5m +.TS +l l. +ascii 8bcccbcc18b95.b +dos 8bcccbcc12bc5b95.b. +ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b + 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. +IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc + 191.b +iso8859 8bcccbcc18b95.33b. +koi8-r 8bcccbcc18b95.b128. +latin1 8bcccbcc18b95.33b. +next 8bcccbcc18b95.bb125.bb +.TE +.RE .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" @@ -1429,11 +1425,11 @@ setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, will have priority. Problematic octets in a UTF-8 file (octets of a truncated sequence, -octets of a complete but non-shortest form sequence, illegal octets, +octets of a complete but non-shortest form sequence, invalid octets, and stray trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. - +. .SH "PROMPTS" The \-P option allows you to tailor the prompt to your preference. The string given to the \-P option replaces the specified prompt string. @@ -1500,7 +1496,8 @@ Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. .IP "%T" Normally expands to the word "file". -However if viewing files via a tags list using the \-t option, it expands to the word "tag". +However if viewing files via a tags list using the \-t option, +it expands to the word "tag". .IP "%x" Replaced by the name of the next input file in the list. .PP @@ -1620,7 +1617,7 @@ line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. - +. .SH SECURITY When the environment variable LESSSECURE is set to 1, .I less @@ -1641,14 +1638,14 @@ log files use of lesskey files .IP "\-t" use of tags files -.IP " " +.IP metacharacters in filenames, such as * -.IP " " +.IP filename completion (TAB, ^L) .RE .PP Less can also be compiled to be permanently in "secure" mode. - +. .SH "COMPATIBILITY WITH MORE" If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", @@ -1666,7 +1663,7 @@ behaves as if the \-E option were set. .PP The \-m option works differently. If the \-m option is not set, the medium prompt is used, -and it is prefixed with the string "--More--". +and it is prefixed with the string "\-\-More\-\-". If the \-m option is set, the short prompt is used. .PP The \-n option acts like the \-z option. @@ -1678,12 +1675,12 @@ command rather than a search pattern. .PP The LESS environment variable is ignored, and the MORE environment variable is used in its place. - +. .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment as usual, or in a -.I lesskey -(1) file. +.IR lesskey (1) +file. If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence @@ -1738,8 +1735,8 @@ See discussion under PROMPTS. .IP LESSGLOBALTAGS Name of the command used by the \-t option to find global tags. Normally should be set to "global" if your system has the -.I global -(1) command. If not set, global tags are not used. +.IR global (1) +command. If not set, global tags are not used. .IP LESSHISTFILE Name of the history file used to remember search commands and shell commands between invocations of @@ -1752,9 +1749,13 @@ on OS/2 systems. The maximum number of commands to save in the history file. The default is 100. .IP LESSKEY -Name of the default lesskey(1) file. +Name of the default +.IR lesskey (1) +file. .IP LESSKEY_SYSTEM -Name of the default system-wide lesskey(1) file. +Name of the default system-wide +.IR lesskey (1) +file. .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1773,8 +1774,8 @@ String to be appended to a directory name in filename completion. Format for displaying non-printable Unicode code points. .IP LESS_IS_MORE Emulate the -.I more -(1) command. +.IR more (1) +command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. @@ -1791,17 +1792,17 @@ compatible mode. User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL -The shell used to execute the ! command, as well as to expand filenames. +The shell used to execute the !\& command, as well as to expand filenames. .IP TERM The type of terminal on which .I less is being run. .IP VISUAL The name of the editor (used for the v command). - +. .SH "SEE ALSO" -lesskey(1) - +.BR lesskey (1) +. .SH COPYRIGHT Copyright (C) 1984-2020 Mark Nudelman .PP @@ -1823,9 +1824,9 @@ less is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - +. .SH AUTHOR -.PP +. Mark Nudelman .br Report bugs at https://github.com/gwsw/less/issues. diff --git a/lessecho.man b/lessecho.man index 30a0984..f703ed7 100644 --- a/lessecho.man +++ b/lessecho.man @@ -41,7 +41,7 @@ LESSECHO(1) General Commands Manual LESSECHO(1) that only arguments containing metacharacters are quoted SEE ALSO - less(1) + less(1) AUTHOR This manual page was written by Thomas Schoepf , @@ -51,4 +51,4 @@ LESSECHO(1) General Commands Manual LESSECHO(1) - Version 557: 21 Mar 2020 LESSECHO(1) + Version 562: 19 May 2020 LESSECHO(1) diff --git a/lessecho.nro b/lessecho.nro index 49339f4..9aae6b9 100644 --- a/lessecho.nro +++ b/lessecho.nro @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 557: 21 Mar 2020" +.TH LESSECHO 1 "Version 562: 19 May 2020" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS @@ -44,7 +44,7 @@ Specifies "n" to be the escape char for metachars, as an integer. Specifies that all arguments are to be quoted. The default is that only arguments containing metacharacters are quoted .SH "SEE ALSO" -less(1) +.BR less (1) .SH AUTHOR This manual page was written by Thomas Schoepf , for the Debian GNU/Linux system (but may be used by others). diff --git a/lesskey.man b/lesskey.man index b814d02..5fcbae5 100644 --- a/lesskey.man +++ b/lesskey.man @@ -12,14 +12,14 @@ LESSKEY(1) General Commands Manual LESSKEY(1) lesskey --version DESCRIPTION - Lesskey is used to specify a set of key bindings to be used by less. + Lesskey is used to specify a set of key bindings to be used by less. The input file is a text file which describes the key bindings. If the input file is "-", standard input is read. If no input file is speci- fied, a standard filename is used as the name of the input file, which depends on the system being used: On Unix systems, $HOME/.lesskey is used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. - The output file is a binary file which is used by less. If no output + The output file is a binary file which is used by less. If no output file is specified, and the environment variable LESSKEY is set, the value of LESSKEY is used as the name of the output file. Otherwise, a standard filename is used as the name of the output file, which depends @@ -47,7 +47,6 @@ LESSKEY(1) General Commands Manual LESSKEY(1) Blank lines and lines which start with a pound sign (#) are ignored, except for the special section header lines. - COMMAND SECTION The command section begins with the line @@ -100,144 +99,146 @@ LESSKEY(1) General Commands Manual LESSKEY(1) include caret, space, tab and the backslash itself. An action may be followed by an "extra" string. When such a command is - entered while running less, the action is performed, and then the extra - string is parsed, just as if it were typed in to less. This feature + entered while running less, the action is performed, and then the extra + string is parsed, just as if it were typed in to less. This feature can be used in certain cases to extend the functionality of a command. For example, see the "{" and ":t" commands in the example below. The extra string has a special meaning for the "quit" action: when less quits, first character of the extra string is used as its exit status. - EXAMPLE The following input file describes the set of default command keys used by less: + #command - \r forw-line - \n forw-line - e forw-line - j forw-line - \kd forw-line - ^E forw-line - ^N forw-line - k back-line - y back-line - ^Y back-line - ^K back-line - ^P back-line - J forw-line-force - K back-line-force - Y back-line-force - d forw-scroll - ^D forw-scroll - u back-scroll - ^U back-scroll - \40 forw-screen - f forw-screen - ^F forw-screen - ^V forw-screen - \kD forw-screen - b back-screen - ^B back-screen - \ev back-screen - \kU back-screen - z forw-window - w back-window - \e\40 forw-screen-force - F forw-forever - \eF forw-until-hilite - R repaint-flush - r repaint - ^R repaint - ^L repaint - \eu undo-hilite - g goto-line - \kh goto-line - < goto-line - \e< goto-line - p percent - % percent - \e[ left-scroll - \e] right-scroll - \e( left-scroll - \e) right-scroll - \kl left-scroll - \kr right-scroll - \e{ no-scroll - \e} end-scroll - { forw-bracket {} - } back-bracket {} - ( forw-bracket () - ) back-bracket () - [ forw-bracket [] - ] back-bracket [] - \e^F forw-bracket - \e^B back-bracket - G goto-end - \e> goto-end - > goto-end - \ke goto-end - \eG goto-end-buffered - = status - ^G status - :f status - / forw-search - ? back-search - \e/ forw-search * - \e? back-search * - n repeat-search - \en repeat-search-all - N reverse-search - \eN reverse-search-all - & filter - m set-mark - M set-mark-bottom - \em clear-mark - ' goto-mark - ^X^X goto-mark - E examine - :e examine - ^X^V examine - :n next-file - :p prev-file - t next-tag - T prev-tag - :x index-file - :d remove-file - - toggle-option - :t toggle-option t - s toggle-option o - _ display-option - | pipe - v visual - ! shell - + firstcmd - H help - h help - V version - 0 digit - 1 digit - 2 digit - 3 digit - 4 digit - 5 digit - 6 digit - 7 digit - 8 digit - 9 digit - q quit - Q quit - :q quit - :Q quit - ZZ quit + \r forw-line + \n forw-line + e forw-line + j forw-line + \kd forw-line + ^E forw-line + ^N forw-line + k back-line + y back-line + ^Y back-line + ^K back-line + ^P back-line + J forw-line-force + K back-line-force + Y back-line-force + d forw-scroll + ^D forw-scroll + + u back-scroll + ^U back-scroll + \40 forw-screen + f forw-screen + ^F forw-screen + ^V forw-screen + \kD forw-screen + b back-screen + ^B back-screen + \ev back-screen + \kU back-screen + z forw-window + w back-window + \e\40 forw-screen-force + F forw-forever + \eF forw-until-hilite + R repaint-flush + r repaint + ^R repaint + ^L repaint + \eu undo-hilite + g goto-line + \kh goto-line + < goto-line + \e< goto-line + p percent + % percent + \e[ left-scroll + \e] right-scroll + \e( left-scroll + \e) right-scroll + \kl left-scroll + \kr right-scroll + \e{ no-scroll + \e} end-scroll + { forw-bracket {} + } back-bracket {} + ( forw-bracket () + ) back-bracket () + [ forw-bracket [] + ] back-bracket [] + \e^F forw-bracket + \e^B back-bracket + G goto-end + \e> goto-end + > goto-end + \ke goto-end + \eG goto-end-buffered + = status + ^G status + :f status + / forw-search + ? back-search + \e/ forw-search * + \e? back-search * + n repeat-search + \en repeat-search-all + N reverse-search + \eN reverse-search-all + & filter + m set-mark + M set-mark-bottom + \em clear-mark + ' goto-mark + ^X^X goto-mark + + E examine + :e examine + ^X^V examine + :n next-file + :p prev-file + t next-tag + T prev-tag + :x index-file + :d remove-file + - toggle-option + :t toggle-option t + s toggle-option o + _ display-option + | pipe + v visual + ! shell + + firstcmd + H help + h help + V version + 0 digit + 1 digit + 2 digit + 3 digit + 4 digit + 5 digit + 6 digit + 7 digit + 8 digit + 9 digit + q quit + Q quit + :q quit + :Q quit + ZZ quit PRECEDENCE Commands specified by lesskey take precedence over the default com- mands. A default command key may be disabled by including it in the - input file with the action "invalid". Alternatively, a key may be - defined to do nothing by using the action "noaction". "noaction" is - similar to "invalid", but less will give an error beep for an "invalid" + input file with the action "invalid". Alternatively, a key may be de- + fined to do nothing by using the action "noaction". "noaction" is sim- + ilar to "invalid", but less will give an error beep for an "invalid" command, but not for a "noaction" command. In addition, ALL default commands may be disabled by adding this control line to the input file: @@ -251,7 +252,6 @@ LESSKEY(1) General Commands Manual LESSKEY(1) enable all necessary actions. For example, failure to provide a "quit" command can lead to frustration. - LINE EDITING SECTION The line-editing section begins with the line: @@ -262,41 +262,40 @@ LESSKEY(1) General Commands Manual LESSKEY(1) specified in the #command section. The line-editing section consists of a list of keys and actions, one per line as in the example below. - EXAMPLE The following input file describes the set of default line-editing keys used by less: - #line-edit - \t forw-complete - \17 back-complete - \e\t back-complete - ^L expand - ^V literal - ^A literal - \el right - \kr right - \eh left - \kl left - \eb word-left - \e\kl word-left - \ew word-right - \e\kr word-right - \ei insert - \ex delete - \kx delete - \eX word-delete - \ekx word-delete - \e\b word-backspace - \e0 home - \kh home - \e$ end - \ke end - \ek up - \ku up - \ej down - ^G abort + #line-edit + \t forw-complete + \17 back-complete + \e\t back-complete + ^L expand + ^V literal + ^A literal + \el right + \kr right + \eh left + \kl left + \eb word-left + \e\kl word-left + \ew word-right + \e\kr word-right + \ei insert + \ex delete + \kx delete + \eX word-delete + \ekx word-delete + \e\b word-backspace + \e0 home + \kh home + \e$ end + \ke end + \ek up + \ku up + \ej down + ^G abort LESS ENVIRONMENT VARIABLES @@ -308,34 +307,30 @@ LESSKEY(1) General Commands Manual LESSKEY(1) Each line consists of an environment variable name, an equals sign (=) and the value to be assigned to the environment variable. White space before and after the equals sign is ignored. Variables assigned in - this way are visible only to less. If a variable is specified in the + this way are visible only to less. If a variable is specified in the system environment and also in a lesskey file, the value in the lesskey file takes precedence. Although the lesskey file can be used to over- ride variables set in the environment, the main purpose of assigning variables in the lesskey file is simply to have all less configuration information stored in one file. - EXAMPLE The following input file sets the -i option whenever less is run, and specifies the character set to be "latin1": - #env - LESS = -i - LESSCHARSET = latin1 - + #env + LESS = -i + LESSCHARSET = latin1 SEE ALSO - less(1) - + less(1) WARNINGS On MS-DOS and OS/2 systems, certain keys send a sequence of characters which start with a NUL character (0). This NUL character should be represented as \340 in a lesskey file. - COPYRIGHT Copyright (C) 1984-2020 Mark Nudelman @@ -354,11 +349,10 @@ LESSKEY(1) General Commands Manual LESSKEY(1) NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - AUTHOR Mark Nudelman Send bug reports or comments to . - Version 557: 21 Mar 2020 LESSKEY(1) + Version 562: 19 May 2020 LESSKEY(1) diff --git a/lesskey.nro b/lesskey.nro index 910d787..650422e 100644 --- a/lesskey.nro +++ b/lesskey.nro @@ -1,20 +1,21 @@ -.TH LESSKEY 1 "Version 557: 21 Mar 2020" +'\" t +.TH LESSKEY 1 "Version 562: 19 May 2020" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS -.B "lesskey [-o output] [--] [input]" +.B "lesskey [\-o output] [\-\-] [input]" .br -.B "lesskey [--output=output] [--] [input]" +.B "lesskey [\-\-output=output] [\-\-] [input]" .br -.B "lesskey -V" +.B "lesskey \-V" .br -.B "lesskey --version" +.B "lesskey \-\-version" .SH DESCRIPTION .I Lesskey is used to specify a set of key bindings to be used by -.I less. +.IR less . The input file is a text file which describes the key bindings. -If the input file is "-", standard input is read. +If the input file is "\-", standard input is read. If no input file is specified, a standard filename is used as the name of the input file, which depends on the system being used: On Unix systems, $HOME/.lesskey is used; @@ -22,7 +23,7 @@ on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. The output file is a binary file which is used by -.I less. +.IR less . If no output file is specified, and the environment variable LESSKEY is set, the value of LESSKEY is used as the name of the output file. @@ -36,10 +37,10 @@ If the output file already exists, .I lesskey will overwrite it. .PP -The -V or --version option causes +The \-V or \-\-version option causes .I lesskey to print its version number and immediately exit. -If -V or --version is present, other options and arguments are ignored. +If \-V or \-\-version is present, other options and arguments are ignored. .PP The input file consists of one or more .I sections. @@ -54,7 +55,7 @@ Defines environment variables. .PP Blank lines and lines which start with a pound sign (#) are ignored, except for the special section header lines. - +. .SH "COMMAND SECTION" The command section begins with the line .sp @@ -112,10 +113,10 @@ caret, space, tab and the backslash itself. .PP An action may be followed by an "extra" string. When such a command is entered while running -.I less, +.IR less , the action is performed, and then the extra string is parsed, just as if it were typed in to -.I less. +.IR less . This feature can be used in certain cases to extend the functionality of a command. For example, see the "{" and ":t" commands in the example below. @@ -123,131 +124,134 @@ The extra string has a special meaning for the "quit" action: when .I less quits, first character of the extra string is used as its exit status. - +. .SH EXAMPLE The following input file describes the set of default command keys used by less: .sp -.nf - #command - \er forw-line - \en forw-line - e forw-line - j forw-line - \ekd forw-line - ^E forw-line - ^N forw-line - k back-line - y back-line - ^Y back-line - ^K back-line - ^P back-line - J forw-line-force - K back-line-force - Y back-line-force - d forw-scroll - ^D forw-scroll - u back-scroll - ^U back-scroll - \e40 forw-screen - f forw-screen - ^F forw-screen - ^V forw-screen - \ekD forw-screen - b back-screen - ^B back-screen - \eev back-screen - \ekU back-screen - z forw-window - w back-window - \ee\e40 forw-screen-force - F forw-forever - \eeF forw-until-hilite - R repaint-flush - r repaint - ^R repaint - ^L repaint - \eeu undo-hilite - g goto-line - \ekh goto-line - < goto-line - \ee< goto-line - p percent - % percent - \ee[ left-scroll - \ee] right-scroll - \ee( left-scroll - \ee) right-scroll - \ekl left-scroll - \ekr right-scroll - \ee{ no-scroll - \ee} end-scroll - { forw-bracket {} - } back-bracket {} - ( forw-bracket () - ) back-bracket () - [ forw-bracket [] - ] back-bracket [] - \ee^F forw-bracket - \ee^B back-bracket - G goto-end - \ee> goto-end - > goto-end - \eke goto-end - \eeG goto-end-buffered - = status - ^G status - :f status - / forw-search - ? back-search - \ee/ forw-search * - \ee? back-search * - n repeat-search - \een repeat-search-all - N reverse-search - \eeN reverse-search-all - & filter - m set-mark - M set-mark-bottom - \eem clear-mark - ' goto-mark - ^X^X goto-mark - E examine - :e examine - ^X^V examine - :n next-file - :p prev-file - t next-tag - T prev-tag - :x index-file - :d remove-file - - toggle-option - :t toggle-option t - s toggle-option o - _ display-option - | pipe - v visual - ! shell - + firstcmd - H help - h help - V version - 0 digit - 1 digit - 2 digit - 3 digit - 4 digit - 5 digit - 6 digit - 7 digit - 8 digit - 9 digit - q quit - Q quit - :q quit - :Q quit - ZZ quit -.fi +.RS 5m +.TS +l l. +#command +\er forw-line +\en forw-line +e forw-line +j forw-line +\ekd forw-line +^E forw-line +^N forw-line +k back-line +y back-line +^Y back-line +^K back-line +^P back-line +J forw-line-force +K back-line-force +Y back-line-force +d forw-scroll +^D forw-scroll +u back-scroll +^U back-scroll +\e40 forw-screen +f forw-screen +^F forw-screen +^V forw-screen +\ekD forw-screen +b back-screen +^B back-screen +\eev back-screen +\ekU back-screen +z forw-window +w back-window +\ee\e40 forw-screen-force +F forw-forever +\eeF forw-until-hilite +R repaint-flush +r repaint +^R repaint +^L repaint +\eeu undo-hilite +g goto-line +\ekh goto-line +< goto-line +\ee< goto-line +p percent +% percent +\ee[ left-scroll +\ee] right-scroll +\ee( left-scroll +\ee) right-scroll +\ekl left-scroll +\ekr right-scroll +\ee{ no-scroll +\ee} end-scroll +{ forw-bracket {} +} back-bracket {} +( forw-bracket () +) back-bracket () +[ forw-bracket [] +] back-bracket [] +\ee^F forw-bracket +\ee^B back-bracket +G goto-end +\ee> goto-end +> goto-end +\eke goto-end +\eeG goto-end-buffered +\&= status +^G status +:f status +/ forw-search +? back-search +\ee/ forw-search * +\ee? back-search * +n repeat-search +\een repeat-search-all +N reverse-search +\eeN reverse-search-all +& filter +m set-mark +M set-mark-bottom +\eem clear-mark +' goto-mark +^X^X goto-mark +E examine +:e examine +^X^V examine +:n next-file +:p prev-file +t next-tag +T prev-tag +:x index-file +:d remove-file +- toggle-option +:t toggle-option t +s toggle-option o +\&_ display-option +| pipe +v visual +! shell ++ firstcmd +H help +h help +V version +0 digit +1 digit +2 digit +3 digit +4 digit +5 digit +6 digit +7 digit +8 digit +9 digit +q quit +Q quit +:q quit +:Q quit +ZZ quit +.TE +.RE .sp .SH PRECEDENCE Commands specified by @@ -274,7 +278,7 @@ Since all default commands are disabled, you must provide sufficient commands before the #stop line to enable all necessary actions. For example, failure to provide a "quit" command can lead to frustration. - +. .SH "LINE EDITING SECTION" The line-editing section begins with the line: .sp @@ -285,44 +289,47 @@ in a manner similar to the way key bindings for ordinary commands are specified in the #command section. The line-editing section consists of a list of keys and actions, one per line as in the example below. - +. .SH EXAMPLE The following input file describes the set of default line-editing keys used by less: .sp -.nf - #line-edit - \et forw-complete - \e17 back-complete - \ee\et back-complete - ^L expand - ^V literal - ^A literal - \eel right - \ekr right - \eeh left - \ekl left - \eeb word-left - \ee\ekl word-left - \eew word-right - \ee\ekr word-right - \eei insert - \eex delete - \ekx delete - \eeX word-delete - \eekx word-delete - \ee\eb word-backspace - \ee0 home - \ekh home - \ee$ end - \eke end - \eek up - \eku up - \eej down - ^G abort -.fi +.RS 5m +.TS +l l. +#line-edit +\et forw-complete +\e17 back-complete +\ee\et back-complete +^L expand +^V literal +^A literal +\eel right +\ekr right +\eeh left +\ekl left +\eeb word-left +\ee\ekl word-left +\eew word-right +\ee\ekr word-right +\eei insert +\eex delete +\ekx delete +\eeX word-delete +\eekx word-delete +\ee\eb word-backspace +\ee0 home +\ekh home +\ee$ end +\eke end +\eek up +\eku up +\eej down +^G abort +.TE +.RE .sp - +. .SH "LESS ENVIRONMENT VARIABLES" The environment variable section begins with the line .sp @@ -333,7 +340,7 @@ Each line consists of an environment variable name, an equals sign (=) and the value to be assigned to the environment variable. White space before and after the equals sign is ignored. Variables assigned in this way are visible only to -.I less. +.IR less . If a variable is specified in the system environment and also in a lesskey file, the value in the lesskey file takes precedence. Although the lesskey file can be used to override variables set in the @@ -341,27 +348,27 @@ environment, the main purpose of assigning variables in the lesskey file is simply to have all .I less configuration information stored in one file. - +. .SH EXAMPLE -The following input file sets the -i option whenever +The following input file sets the \-i option whenever .I less is run, and specifies the character set to be "latin1": .sp .nf #env - LESS = -i + LESS = \-i LESSCHARSET = latin1 .fi .sp - +. .SH "SEE ALSO" -less(1) - +.BR less (1) +. .SH WARNINGS On MS-DOS and OS/2 systems, certain keys send a sequence of characters which start with a NUL character (0). This NUL character should be represented as \e340 in a lesskey file. - +. .SH COPYRIGHT Copyright (C) 1984-2020 Mark Nudelman .PP @@ -383,9 +390,9 @@ less is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - +. .SH AUTHOR -.PP +. Mark Nudelman .br Send bug reports or comments to . diff --git a/line.c b/line.c index ed29aa6..1cad6e6 100644 --- a/line.c +++ b/line.c @@ -226,7 +226,7 @@ plinenum(pos) else { c = ' '; - if (start_attnpos != NULL_POSITION && + if (start_attnpos != NULL_POSITION && pos >= start_attnpos && pos <= end_attnpos) a |= AT_HILITE; } @@ -1099,7 +1099,7 @@ pdone(endline, chopped, forw) */ if (column >= sc_width) { - /* Switch to normal attribute at end of line. */ + /* We've already written in the rightmost char. */ column = right_column; curr = right_curr; } diff --git a/optfunc.c b/optfunc.c index ae8f35f..8bc3b85 100644 --- a/optfunc.c +++ b/optfunc.c @@ -537,22 +537,16 @@ colordesc(s, fg_color, bg_color) int err; #if MSDOS_COMPILER==WIN32C int ul = 0; -#endif - if (*s == '.') - fg = nm_fg_color; - else + if (*s == 'u') { -#if MSDOS_COMPILER==WIN32C - if (*s == 'u') - { - ul = COMMON_LVB_UNDERSCORE; - ++s; - } + ul = COMMON_LVB_UNDERSCORE; + ++s; + } #endif - fg = getnum(&s, "D", &err); - if (err) - { + fg = getnum(&s, "D", &err); + if (err) + { #if MSDOS_COMPILER==WIN32C if (ul) fg = nm_fg_color; @@ -562,7 +556,6 @@ colordesc(s, fg_color, bg_color) error("Missing fg color in -D", NULL_PARG); return; } - } } if (*s != '.') bg = nm_bg_color; diff --git a/output.c b/output.c index a98f7ec..25e5476 100644 --- a/output.c +++ b/output.c @@ -41,10 +41,8 @@ extern int ul_fg_color, ul_bg_color; extern int so_fg_color, so_bg_color; extern int bl_fg_color, bl_bg_color; extern int sgr_mode; -#if MSDOS_COMPILER==WIN32C extern int have_full_ansi; #endif -#endif /* * Display the line which is in the line buffer. @@ -410,7 +408,7 @@ flush(VOID_PARAM) bgi = COMMON_LVB_UNDERSCORE >> 4; else #endif - bgi = 8; + bgi = 8; at |= 4; break; case 5: /* slow blink on */ @@ -565,7 +563,7 @@ flush(VOID_PARAM) } if (!is_ansi_end(*p) || p == p_next) break; - /* /* + /* * In SGR mode, the ANSI sequence is * always honored; otherwise if an attr * is used by itself ("\e[1m" versus diff --git a/position.c b/position.c index a73558f..6f55a7f 100644 --- a/position.c +++ b/position.c @@ -243,7 +243,7 @@ sindex_from_sline(sline) if (sline < 0) sline += sc_height; /* - * Can't be less than 1 or greater than sc_height-1. + * Can't be less than 1 or greater than sc_height. */ if (sline <= 0) sline = 1; diff --git a/regexp.c b/regexp.c index 17f6a83..4b51869 100644 --- a/regexp.c +++ b/regexp.c @@ -1109,12 +1109,12 @@ regexp *r; s = r->program + 1; while (op != END) { /* While that wasn't END last time... */ op = OP(s); - printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ + printf("%2ld%s", (long int)(s-r->program), regprop(s)); /* Where, what. */ next = regnext(s); if (next == NULL) /* Next ptr. */ printf("(0)"); else - printf("(%d)", (s-r->program)+(next-s)); + printf("(%ld)", (long int)((s-r->program)+(next-s))); s += 3; if (op == ANYOF || op == ANYBUT || op == EXACTLY) { /* Literal string, where present. */ @@ -1144,7 +1144,7 @@ static char * regprop(op) char *op; { - register char *p; + register char *p = 0; static char buf[50]; (void) strcpy(buf, ":"); diff --git a/screen.c b/screen.c index 1df359f..8dca04d 100644 --- a/screen.c +++ b/screen.c @@ -57,6 +57,12 @@ extern int fd0; #if HAVE_TERMCAP_H #include +#else +int tgetent (char *buffer, char *termtype); +int tgetflag (char *name); +int tgetnum (char *name); +char *tgetstr (char *name, char **area); +int tputs (char *string, int nlines, int (*outfun) ()); #endif #ifdef _OSK #include @@ -158,10 +164,7 @@ public int bl_bg_color; static int sy_fg_color; /* Color of system text (before less) */ static int sy_bg_color; public int sgr_mode; /* Honor ANSI sequences rather than using above */ -#if MSDOS_COMPILER==WIN32C public int have_full_ansi; /* Is full Windows ANSI SGR support available? */ -public int have_ul; /* Is underline available? */ -#endif #else /* @@ -255,6 +258,11 @@ extern int hilite_search; #endif #if MSDOS_COMPILER==WIN32C extern HANDLE tty; +extern DWORD console_mode; +#ifndef ENABLE_EXTENDED_FLAGS +#define ENABLE_EXTENDED_FLAGS 0x80 +#define ENABLE_QUICK_EDIT_MODE 0x40 +#endif #else extern int tty; #endif @@ -1119,6 +1127,7 @@ get_term(VOID_PARAM) bl_bg_color = -1; sgr_mode = 0; + have_full_ansi = 0; /* * Get size of the screen. @@ -1577,7 +1586,9 @@ init_mouse(VOID_PARAM) tputs(sc_s_mousecap, sc_height, putchr); #else #if MSDOS_COMPILER==WIN32C - SetConsoleMode(tty, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT); + SetConsoleMode(tty, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT + | ENABLE_EXTENDED_FLAGS /* disable quick edit */); + #endif #endif } @@ -1595,7 +1606,8 @@ deinit_mouse(VOID_PARAM) tputs(sc_e_mousecap, sc_height, putchr); #else #if MSDOS_COMPILER==WIN32C - SetConsoleMode(tty, ENABLE_PROCESSED_INPUT); + SetConsoleMode(tty, ENABLE_PROCESSED_INPUT | ENABLE_EXTENDED_FLAGS + | (console_mode & ENABLE_QUICK_EDIT_MODE)); #endif #endif } @@ -1631,8 +1643,13 @@ init(VOID_PARAM) line_left(); #else #if MSDOS_COMPILER==WIN32C - if (!no_init) - win32_init_term(); + if (!(quit_if_one_screen && one_screen)) + { + if (!no_init) + win32_init_term(); + init_mouse(); + + } #endif initcolor(); flush(); @@ -1661,8 +1678,12 @@ deinit(VOID_PARAM) /* Restore system colors. */ SETCOLORS(sy_fg_color, sy_bg_color); #if MSDOS_COMPILER==WIN32C - if (!no_init) - win32_deinit_term(); + if (!(quit_if_one_screen && one_screen)) + { + deinit_mouse(); + if (!no_init) + win32_deinit_term(); + } #else /* Need clreol to make SETCOLORS take effect. */ clreol(); diff --git a/search.c b/search.c index 2334a28..ca37049 100644 --- a/search.c +++ b/search.c @@ -350,8 +350,8 @@ undo_search(VOID_PARAM) { if (hilite_anchor.first == NULL) { - error("No previous regular expression", NULL_PARG); - return; + error("No previous regular expression", NULL_PARG); + return; } clr_hilite(); /* Next time, hilite_anchor.first will be NULL. */ } @@ -629,7 +629,7 @@ is_hilited(pos, epos, nohide, p_matches) /* * Kinda kludgy way to recognize that caller is checking for * hilite in status column. In this case we want to return - * Report matches, even if we're hiding highlights. + * hilite status even if hiliting is disabled or hidden. */ return (1); diff --git a/ttyin.c b/ttyin.c index e661c49..2101962 100644 --- a/ttyin.c +++ b/ttyin.c @@ -23,7 +23,7 @@ #define _WIN32_WINNT 0x400 #endif #include -static DWORD console_mode; +public DWORD console_mode; public HANDLE tty; #else public int tty; diff --git a/ubin.uni b/ubin.uni index 5f7e393..7391121 100644 --- a/ubin.uni +++ b/ubin.uni @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cc Cs Co Zl Zp -- unicode/UnicodeData.txt" on Thu Oct 17 10:15:55 PDT 2019 */ +/* Generated by "./mkutable -f2 Cc Cs Co Zl Zp -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x0000, 0x0007 }, /* Cc */ { 0x000b, 0x000b }, /* Cc */ { 0x000e, 0x001f }, /* Cc */ diff --git a/version.c b/version.c index 64a99b8..59415e6 100644 --- a/version.c +++ b/version.c @@ -800,10 +800,10 @@ v484 9/20/16 Update to Unicode 9.0.0 database. v485 10/21/16 Fix "nothing to search" bug when top/bottom line is empty; Display line numbers in bold. (thanks to Jason Hood); Fix incorrect display when entering double-width chars in - search string. + search string. v486 10/22/16 New commands ESC-{ and ESC-} to shift to start/end of displayed lines; new option -Da in Windows version to - enable SGR mode (thanks to Jason Hood). + enable SGR mode (thanks to Jason Hood). v487 10/23/16 configure --help formatting. ----------------------------------------------------------------- v488 2/23/17 Fix memory leaks in search (thanks to John Brooks). @@ -887,6 +887,12 @@ v554 1/19/20 Remove erroneous free(). v555 3/15/20 Display error msg immediately when toggle -o without stdin. v556 3/15/20 Update copyright. v557 3/21/20 Fix memory corruption with libtermcap. +v558 4/17/20 Don't init terminal if -F and file fits on one screen (WIN32). +v559 4/19/20 Handle deinit correctly on WIN32. +v560 5/3/20 Fix regression when command results in no movement; + fix some less.nro issues (thanks to Bjarni I. Gislason). +v561 5/11/20 Fix erroneous EOF calculation when F command is interrupted. +v562 5/19/20 Update Unicode tables; minor doc formatting. */ -char version[] = "557"; +char version[] = "562"; diff --git a/wide.uni b/wide.uni index 964974a..54d7b2d 100644 --- a/wide.uni +++ b/wide.uni @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f1 W F -- unicode/EastAsianWidth.txt" on Thu Aug 1 12:17:07 PDT 2019 */ +/* Generated by "./mkutable -f1 W F -- unicode/EastAsianWidth.txt" on Tue May 19 14:47:35 PDT 2020 */ { 0x1100, 0x115f }, /* W */ { 0x231a, 0x231b }, /* W */ { 0x2329, 0x232a }, /* W */ @@ -44,8 +44,7 @@ { 0x3099, 0x30ff }, /* W */ { 0x3105, 0x312f }, /* W */ { 0x3131, 0x318e }, /* W */ - { 0x3190, 0x31ba }, /* W */ - { 0x31c0, 0x31e3 }, /* W */ + { 0x3190, 0x31e3 }, /* W */ { 0x31f0, 0x321e }, /* W */ { 0x3220, 0x3247 }, /* W */ { 0x3250, 0x4dbf }, /* W */ @@ -60,9 +59,11 @@ { 0xfe68, 0xfe6b }, /* W */ { 0xff01, 0xff60 }, /* F */ { 0xffe0, 0xffe6 }, /* F */ - { 0x16fe0, 0x16fe3 }, /* W */ + { 0x16fe0, 0x16fe4 }, /* W */ + { 0x16ff0, 0x16ff1 }, /* W */ { 0x17000, 0x187f7 }, /* W */ - { 0x18800, 0x18af2 }, /* W */ + { 0x18800, 0x18cd5 }, /* W */ + { 0x18d00, 0x18d08 }, /* W */ { 0x1b000, 0x1b11e }, /* W */ { 0x1b150, 0x1b152 }, /* W */ { 0x1b164, 0x1b167 }, /* W */ @@ -97,19 +98,21 @@ { 0x1f680, 0x1f6c5 }, /* W */ { 0x1f6cc, 0x1f6cc }, /* W */ { 0x1f6d0, 0x1f6d2 }, /* W */ - { 0x1f6d5, 0x1f6d5 }, /* W */ + { 0x1f6d5, 0x1f6d7 }, /* W */ { 0x1f6eb, 0x1f6ec }, /* W */ - { 0x1f6f4, 0x1f6fa }, /* W */ + { 0x1f6f4, 0x1f6fc }, /* W */ { 0x1f7e0, 0x1f7eb }, /* W */ - { 0x1f90d, 0x1f971 }, /* W */ - { 0x1f973, 0x1f976 }, /* W */ - { 0x1f97a, 0x1f9a2 }, /* W */ - { 0x1f9a5, 0x1f9aa }, /* W */ - { 0x1f9ae, 0x1f9ca }, /* W */ + { 0x1f90c, 0x1f93a }, /* W */ + { 0x1f93c, 0x1f945 }, /* W */ + { 0x1f947, 0x1f978 }, /* W */ + { 0x1f97a, 0x1f9cb }, /* W */ { 0x1f9cd, 0x1f9ff }, /* W */ - { 0x1fa70, 0x1fa73 }, /* W */ + { 0x1fa70, 0x1fa74 }, /* W */ { 0x1fa78, 0x1fa7a }, /* W */ - { 0x1fa80, 0x1fa82 }, /* W */ - { 0x1fa90, 0x1fa95 }, /* W */ + { 0x1fa80, 0x1fa86 }, /* W */ + { 0x1fa90, 0x1faa8 }, /* W */ + { 0x1fab0, 0x1fab6 }, /* W */ + { 0x1fac0, 0x1fac2 }, /* W */ + { 0x1fad0, 0x1fad6 }, /* W */ { 0x20000, 0x2fffd }, /* W */ { 0x30000, 0x3fffd }, /* W */