Dec 082017
'C' source code for LESS which is more than MORE for PC's.
File LESSSRC.ZIP from The Programmer’s Corner in
Category C Source Code
‘C’ source code for LESS which is more than MORE for PC’s.
File Name File Size Zip Size Zip Type
CH.C 6841 2494 deflated
COMMAND.C 9711 2995 deflated
DOS_PORT.H 390 243 deflated
FUNCS.H 1900 417 deflated
HELP.C 2235 855 deflated
INPUT.C 4079 1321 deflated
LESS.H 2051 966 deflated
LESS.PRJ 610 181 deflated
LINE.C 11264 3202 deflated
MAIN.C 5217 2056 deflated
OPTION.C 7572 2556 deflated
OUTPUT.C 3436 1351 deflated
POSITION.C 2040 788 deflated
POSITION.H 146 106 deflated
PRIM.C 12563 3803 deflated
PROMPT.C 3358 1095 deflated
README 6263 2853 deflated
REGERROR.C 260 198 deflated
REGEXP.C 27639 8867 deflated
REGEXP.H 574 295 deflated
REGMAGIC.H 153 128 deflated
SCRN.C 7306 2468 deflated
SCRN.H 160 97 deflated
SETARGV.C 5142 1807 deflated
SIGNAL.C 2167 874 deflated
TTYIN.C 1080 566 deflated
UUDECODE.C 4296 2033 deflated
VERSION.C 4414 1823 deflated

Download File LESSSRC.ZIP Here

Contents of the README file

Port of less to msdos:

Less is a program similar to the Unix more command but is much more
useful. Read for a good description of less and what it can
do for you.

A. Dick Keily's original porting information for MSC 4.0:

The files included here will result in a full version of less
for use on msdos. This version of less has been tested on all the pc
systems that I could get my hands on. This includes monochrome, graphics,
(that includes systems with graphics cards and mono monitors), and color

The following must be done to have less.exe work in its full glory:

1.Nothing if you don't want color when using a color monitor.
To get the color use the set command such as:

set less=C(Case sensitive; c is another option)

Do this prior to calling less. A command line option
less -C will also get you color.

NOTE: Only use the color option when using a color monitor.
All other configurations need no special action.

There are other less settings that can be used using the
set command. Read The one I use is less=mC on
an AT with enhanced monitor and ega card.

2.Less also has a v command that lets you can an editor from
within less to edit the file that you are viewing at the
time. The default is memacs which was taken from the Unix
mod.sources. If you don't have it use the dos set command
as follows to let less know which it is:

set editor=your_editor

4.It is best to include the set commands in your autoexec.bat
which will be executed when you boot up your system.

5.Less is a very useful utility. Read and when in
less the h command will put a description of the commands
on the screen for you.

6.This version of less is named less13.exe for distribution.
It replaces and other version that you have obtained from
my posting of the executable. Accept no substitutes. When
I get the time I will incorporate the changes to get up
the distributed Unix version 61. If you post this to any
bulletin board name any files associated with it with the
version 13.(referring to the MSDOS control).

[N.B. No longer correct. This version is
somewhere between version 61 and 73 in its

7.Less version 1.3 uses the system function but looks to see
if you are using the swchar program that allows you to use
the / rather than the \ character. The swchar state is changed
before the system call if you are and then resets it so that
it all becomes transparent to the user.

[N.B. This is still correct.]

8.The source code for less is being posted to Net.sources.
It is all ifdef'd so that it should compile on Unix systems
also as is.

[N.B. Probably not anymore. The ctrlbrk()
function will fail on Unix.]

9.Version 1.3 corrects the following:
The latest known to me fixes have been incorporated
in the regexpression routines written by Henry
Spencer and posted on the Unix news net.

Dick Keily
Eastman Kodak Company
work: (716)477-1001
unix: ...!seismo!rochester!kodak!keily

B. Revised port to TurboC:

1.The port now incorporates boldface and underline (useful
for viewing documents created with nroff -man). I've
chosen the monochrome attributes for these, 0x01 and 0xf0,
and for CGA color, 0x06 (yellow) and 0xf0 (bright white).
If you wish to use others, revise the SCRN.H and/or SCRN.C
file(s) appropriately.

2.This will compile in the "tiny" model, and the resulting
file can be converted to a '.com' file for loading and
execution speed. An appropriate 'LESS.PRJ' file is
included; be certain to define DOSPORT in 'Options/Compiler'
(interactive mode).

3.A bug was fixed in the 'v' command (escape
to the editor): on return to less, the original unmodified
file in memory was displayed, not the edited one. This
is worked around in command.c by causing an 'E\n' command
to be executed on return. 'E' (Examine) loads in a new
file, and if no filename is given it loads in the previous
file. (Indeed, this is useful if 'E' is used normally.
After examining a different file, you can return to the
previous one by invoking 'E' with no file name.)

4.A new command, 'L', is implemented. 'L' gives
all of the information that '^G' and '=' give (i.e.,
file name, number of bytes, approximate percentage into
the file) and in addition gives the number of the first
line appearing on the screen. This information is useful
if you wish to edit the file subsequently with a line-
oriented editor (e.g., vi, EDLIN, etc.); you know what
line to jump to. Unfortunately, it is a bit slow because
long ints are used in the calculation -- but a file might
exceed 65,000 lines!.

5.Sorry, I've not bothered to maintain downward compatibility
with Mr. Keily's MSC 4.0 port. I tried it both ways, and the
TurboC one is smaller and faster. If you want to do it with
MSC 4.0: (1) replace the ctrlbrk() command with an appropriate
signal() and interrupt handler; (2) compile it in the small
model; and (3) link with a /stack:4096 flag, linking in the
ssetargv.obj (small model) object file supplied by Microsoft
instead of the included setargv.c file.

6.If you haven't updated to TurboC 1.5, read the comments in
SETARGV.C. The variables _argc and _argv must be changed
throughout that file to __argc and __argv to work properly
in version 1.0. In any event, the SETARGV function is
needed only for DOS wildcard expansion, which is useful if
you want to specify multiple files for viewing with wildcards
and flip back and forth among them with 'N' and 'P'. If
you don't need the wildcard capability, omit SETARGV.

7.The public-domain REGEXP.C file supplied by Dick Keily
implements full regular expression matching a la
'egrep' (i.e., using the '+' for one or more matches and
the '|' for disjunctive matches) in addition to the more
limited 'ed'/'sed' pattern match metacharacters. This is
useful, and better than classical Unix REGEXP.

Mike Slomin

 December 8, 2017  Add comments

Leave a Reply