home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume11
/
less3
/
part02
< prev
next >
Wrap
Internet Message Format
|
1987-09-08
|
42KB
Path: uunet!rs
From: rs@uunet.UU.NET (Rich Salz)
Newsgroups: comp.sources.unix
Subject: v11i034: The 'less' pager, Part02/03
Message-ID: <1499@uunet.UU.NET>
Date: 10 Sep 87 03:44:54 GMT
Organization: UUNET Communications Services, Arlington, VA
Lines: 1532
Approved: rs@uunet.UU.NET
Submitted-by: sun!intsc!convgt!mark@uunet.UU.NET
Posting-number: Volume 11, Issue 34
Archive-name: less3/Part02
[ Sorry about (a) the lag and (b) not posting
this part first. It's been both Labor Day and
Moving Day around these parts. --r$ ]
This is the latest version (v.73) of less. Less is a pager, like more or
pg, only with more features then both of them. Unpack and read the README
file for installation instructions. Changes since the last posted version
(v.61) are:
* Now allows !! to repeat previous shell escape.
* Now allows % as shorthand for the current file name
in shell escapes.
* Now allows # in Examine command to examine previous file, and
return to the same place in that file.
* Changed -p option to -C, and added -c for compatibility with "more".
* -e flag now exits immediately after displaying if file
is less than a screenful.
* Added -E (like -e, but exit FIRST time you hit end-of-file).
* Added -L (like -l, but unconditionally overwrite existing log file).
* Can now change number-valued command line options
from within less (via the "-" command).
* Added support for SIGWINCH (window size change signal in BSD 4.3).
* Added similar support for SIGWIND (same thing on the AT&T Unix PC).
* Better error messages if input cannot be opened or
is not a "regular" file.
* Changed help command from h to H to avoid accidentally entering help.
* Fixed bug which caused problems on terminals with more
than 24 lines.
Mark Nudelman
tektronix!nscpdc!convgt!mark
ihnp4!nsc!nscpdc!convgt!mark
: ---- cut here ---- cut here ---- cut here ---- cut here ---- cut here ----
: This is a shell archive.
: Unpack by running /bin/sh.
echo install
cat >install <<'_SHAR_EOF_'
:
# Installation script for less.
# This script prompts the operator for various information
# and constructs a makefile.
echo "This script will build a makefile for less."
echo "If you already have a file called \"makefile\" it will be overwritten."
echo "Press RETURN to continue."
read ans
echo "I will ask you some questions about your system."
echo "If you do not know the answer to any question,"
echo "just press RETURN and I will choose a default for you."
echo "Press RETURN now."
read ans
echo "Most Unix systems are derived from either System V"
echo "or Berkeley BSD 4.1, 4.2, 4.3, etc."
echo ""
echo "Is your system closest to:"
echo " 1. System V"
echo " 2. BSD 4.1"
echo " 3. BSD 4.2 or later"
echo " 4. Xenix"
echo "Enter a number, or just RETURN if you don't know: \c"
read ans
xenix=0
case "X$ans" in
X1) sys=sys5; sysname="System V" ;;
X2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;;
X3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;;
X4) sys=sys5; xenix=1; sysname="Xenix" ;;
*) sys=unknown ;;
esac
echo ""
cat >makefile <<"EOF"
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
EOF
cat >>makefile <<EOF
# Define XENIX if running under XENIX 3.0
XENIX = $xenix
EOF
echo ""
if [ "X$sys" = "Xunknown" ]
then
alldefault=0
else
def=yes
alldefault=1
echo "Do you want to use ALL the defaults for $sysname?"
echo " Enter \"yes\" if you have a STANDARD $sysname."
echo " Enter \"no\" if you want to change any of the defaults. [$def] \c"
read ans
case "X$ans" in
X[yY]*) alldefault=1 ;;
X[nN]*) alldefault=0 ;;
esac
echo ""
fi
def=yes
x=1
if [ $alldefault = 0 ]
then
echo "Does your C compiler support the \"void\" type? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = $x
EOF
def=long
if [ $alldefault = 0 ]
then
echo "What type is the \"offset\" argument to lseek? [$def] \c"
read ans
if [ "X$ans" != "X" ]
then
def=$ans
fi
echo ""
fi
cat >>makefile <<EOF
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = $def
EOF
def=yes; x=1
if [ $alldefault = 0 ]
then
echo "Most Unix systems provide the stat() function."
echo "Does your system have stat()? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# STAT is 1 if your system has the stat() call.
STAT = $x
EOF
def=yes; x=1
if [ $alldefault = 0 ]
then
echo "Most Unix systems provide the perror() function."
echo "Does your system have perror()? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# PERROR is 1 if your system has the perror() call.
# (Actually, if it has sys_errlist, sys_nerr and errno.)
PERROR = $x
EOF
if [ "$sys" = "bsd" ]
then
def=no; x=0
else
def=yes; x=1
fi
if [ $alldefault = 0 ]
then
echo "Most System V systems have termio.h, while most"
echo "Berkeley-derived systems have sgtty.h."
echo "Does your system have termio.h? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = $x
EOF
if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
then
def=yes; x=1
else
def=no; x=0
fi
if [ $alldefault = 0 ]
then
echo "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
echo "Most System V and BSD 4.1 systems do not."
echo "Does your system have sigsetmask()? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = $x
EOF
cat >>makefile <<EOF
##########################################################################
# Optional and semi-optional features
##########################################################################
EOF
if [ "$sys" = "bsd" ]
then
def=2; REGCMP=0;RECOMP=1
else
def=1; REGCMP=1;RECOMP=0
fi
if [ $alldefault = 0 ]
then
echo "Most System V systems have the regcmp() function."
echo "Most Berkeley-derived systems have the re_comp() function."
echo "Does your system have:"
echo " 1. regcmp"
echo " 2. re_comp"
echo " 3. neither [$def] \c"
read ans
case "X$ans" in
X1) REGCMP=1;RECOMP=0 ;;
X2) REGCMP=0;RECOMP=1 ;;
X3) REGCMP=0;RECOMP=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = $REGCMP
RECOMP = $RECOMP
EOF
def=yes
x=1
if [ $alldefault = 0 ]
then
echo "Do you wish to allow shell escapes? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = $x
EOF
def=yes
x=1
edname="vi"
if [ $alldefault = 0 ]
then
echo "Do you wish to allow editor escapes? [$def] \c"
read ans
case "X$ans" in
X[nN]*) x=0; edname="" ;;
X[yY]*) x=1
echo "What is the pathname of the default editor? [$edname] \c"
read ans
if [ "x$ans" != "x" ]
then
edname=$ans
fi
;;
esac
echo ""
fi
cat >>makefile <<EOF
# 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.
EDITOR = $x
EDIT_PGM = $edname
EOF
def=yes
x=1
if [ $alldefault = 0 ]
then
echo "If your system provides the popen() function and"
echo "the \"echo\" shell command, you may allow shell metacharacters"
echo "to be expanded in filenames."
echo "Do you wish to allow shell metacharacters in filenames? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# 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.
GLOB = $x
EOF
def=yes
x=1
if [ $alldefault = 0 ]
then
echo "Do you wish to allow log files (-l option)? [$def] \c"
read ans
case "X$ans" in
X[yY]*) x=1 ;;
X[nN]*) x=0 ;;
esac
echo ""
fi
cat >>makefile <<EOF
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = $x
EOF
cat >>makefile <<EOF
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
EOF
if [ "$xenix" = "1" ]
then
LIBS="-ltermlib"
elif [ "$sys" = "bsd" ]
then
LIBS="-ltermcap"
else
LIBS="-lcurses -ltermcap -lPW"
fi
if [ $alldefault = 0 ]
then
echo "To build \"less\", you must link with libraries supplied by your system."
echo "(If this needs to be changed later, edit the makefile"
echo "and change the definition of LIBS.)"
echo "What libraries should be used [$LIBS] \c"
read ans
if [ "X$ans" != "X" ]
then
LIBS="$ans"
fi
echo ""
fi
cat >>makefile <<EOF
# LIBS is the list of libraries needed.
LIBS = $LIBS
EOF
INSTALL_LESS="/usr/local/bin/less"
INSTALL_HELP="/usr/local/bin/less.help"
INSTALL_MAN="/usr/man/man1/less.1"
MANUAL="less.nro"
if [ $alldefault = 0 ]
then
echo "What is the name of the \"public\" (installed) version of less?"
echo " [$INSTALL_LESS] \c"
read ans
if [ "X$ans" != "X" ]
then
INSTALL_LESS="$ans"
fi
echo "What is the name of the \"public\" (installed) version of the help file?"
echo " [$INSTALL_HELP] \c"
read ans
if [ "X$ans" != "X" ]
then
INSTALL_HELP="$ans"
fi
echo "What is the name of the \"public\" (installed) version of the manual page?"
echo " [$INSTALL_MAN] \c"
read ans
if [ "X$ans" != "X" ]
then
INSTALL_MAN="$ans"
fi
echo ""
fi
cat >>makefile <<EOF
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = \$(ROOT)$INSTALL_LESS
INSTALL_HELP = \$(ROOT)$INSTALL_HELP
INSTALL_MAN = \$(ROOT)$INSTALL_MAN
MANUAL = $MANUAL
HELPFILE = $INSTALL_HELP
EOF
cat >>makefile <<"EOF"
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DPERROR=$(PERROR)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
# install: install_less install_help install_man
install: install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man install_help
shar:
shar -v install less.man makefile.* > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
EOF
echo ""
echo "The makefile has been built."
echo "You should check it to make sure everything is as you want it to be."
echo "When you are satisfied with the makefile, just type \"make\""
echo "and \"less\" will be built."
_SHAR_EOF_
chmod +x install
echo makefile.bak
cat >makefile.bak <<'_SHAR_EOF_'
# Convergent Technologies - System V - Jan 1987
#ident "%W% :%P% %G% %U%"
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
# Define XENIX if running under XENIX 3.0
XENIX = 0
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = 1
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = long
# STAT is 1 if your system has the stat() call.
STAT = 1
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = 1
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = 0
##########################################################################
# Optional and semi-optional features
##########################################################################
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = 1
RECOMP = 0
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = 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.
EDITOR = 1
EDIT_PGM = vi
# 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.
GLOB = 1
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = 1
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
# LIBS is the list of libraries needed.
LIBS = -lcurses -ltermcap -lPW
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = /usr/local/bin/less
INSTALL_HELP = /usr/local/bin/less.help
INSTALL_MAN = /usr/man/man1/less.1
MANUAL = less.nro
HELPFILE = /usr/local/bin/less.help
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
cc $(OPTIM) -o less $(OBJ) $(LIBS)
install: install_man install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man
shar:
shar -v README install less.man less.help makefile.* *.h *.awk > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v $(SRC2) > less.shar.c
_SHAR_EOF_
echo makefile.bsd41
cat >makefile.bsd41 <<'_SHAR_EOF_'
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
# Define XENIX if running under XENIX 3.0
XENIX = 0
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = 1
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = long
# STAT is 1 if your system has the stat() call.
STAT = 1
# PERROR is 1 if your system has the perror() call.
# (Actually, if it has sys_errlist, sys_nerr and errno.)
PERROR = 1
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = 0
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = 0
##########################################################################
# Optional and semi-optional features
##########################################################################
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = 0
RECOMP = 1
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = 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.
EDITOR = 1
EDIT_PGM = vi
# 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.
GLOB = 1
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = 1
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
# LIBS is the list of libraries needed.
LIBS = -ltermcap
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = $(ROOT)/usr/local/bin/less
INSTALL_HELP = $(ROOT)/usr/local/bin/less.help
INSTALL_MAN = $(ROOT)/usr/man/man1/less.1
MANUAL = less.nro
HELPFILE = /usr/local/bin/less.help
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DPERROR=$(PERROR)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
# install: install_less install_help install_man
install: install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man install_help
shar:
shar -v install less.man makefile.* > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
_SHAR_EOF_
echo makefile.bsd42
cat >makefile.bsd42 <<'_SHAR_EOF_'
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
# Define XENIX if running under XENIX 3.0
XENIX = 0
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = 1
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = long
# STAT is 1 if your system has the stat() call.
STAT = 1
# PERROR is 1 if your system has the perror() call.
# (Actually, if it has sys_errlist, sys_nerr and errno.)
PERROR = 1
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = 0
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = 1
##########################################################################
# Optional and semi-optional features
##########################################################################
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = 0
RECOMP = 1
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = 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.
EDITOR = 1
EDIT_PGM = vi
# 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.
GLOB = 1
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = 1
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
# LIBS is the list of libraries needed.
LIBS = -ltermcap
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = $(ROOT)/usr/local/bin/less
INSTALL_HELP = $(ROOT)/usr/local/bin/less.help
INSTALL_MAN = $(ROOT)/usr/man/man1/less.1
MANUAL = less.nro
HELPFILE = /usr/local/bin/less.help
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DPERROR=$(PERROR)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
# install: install_less install_help install_man
install: install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man install_help
shar:
shar -v install less.man makefile.* > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
_SHAR_EOF_
echo makefile.sys5
cat >makefile.sys5 <<'_SHAR_EOF_'
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
# Define XENIX if running under XENIX 3.0
XENIX = 0
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = 1
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = long
# STAT is 1 if your system has the stat() call.
STAT = 1
# PERROR is 1 if your system has the perror() call.
# (Actually, if it has sys_errlist, sys_nerr and errno.)
PERROR = 1
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = 1
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = 0
##########################################################################
# Optional and semi-optional features
##########################################################################
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = 1
RECOMP = 0
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = 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.
EDITOR = 1
EDIT_PGM = vi
# 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.
GLOB = 1
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = 1
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
# LIBS is the list of libraries needed.
LIBS = -lcurses -ltermcap -lPW
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = $(ROOT)/usr/local/bin/less
INSTALL_HELP = $(ROOT)/usr/local/bin/less.help
INSTALL_MAN = $(ROOT)/usr/man/man1/less.1
MANUAL = less.nro
HELPFILE = /usr/local/bin/less.help
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DPERROR=$(PERROR)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
# install: install_less install_help install_man
install: install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man install_help
shar:
shar -v install less.man makefile.* > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
_SHAR_EOF_
echo makefile.xen
cat >makefile.xen <<'_SHAR_EOF_'
# Makefile for "less"
#
# Invoked as:
# make all
# or make install
# Plain "make" is equivalent to "make all".
#
# If you add or delete functions, remake funcs.h by doing:
# make newfuncs
# This depends on the coding convention of function headers looking like:
# " \t public <function-type> \n <function-name> ( ... ) "
#
# Also provided:
# make lint # Runs "lint" on all the sources.
# make clean # Removes "less" and the .o files.
# make clobber # Pretty much the same as make "clean".
##########################################################################
# System-specific parameters
##########################################################################
# Define XENIX if running under XENIX 3.0
XENIX = 1
# VOID is 1 if your C compiler supports the "void" type,
# 0 if it does not.
VOID = 1
# offset_t is the type which lseek() returns.
# It is also the type of lseek()'s second argument.
offset_t = long
# STAT is 1 if your system has the stat() call.
STAT = 1
# PERROR is 1 if your system has the perror() call.
# (Actually, if it has sys_errlist, sys_nerr and errno.)
PERROR = 1
# TERMIO is 1 if your system has /usr/include/termio.h.
# This is normally the case for System 5.
# If TERMIO is 0 your system must have /usr/include/sgtty.h.
# This is normally the case for BSD.
TERMIO = 1
# SIGSETMASK is 1 if your system has the sigsetmask() call.
# This is normally the case only for BSD 4.2,
# not for BSD 4.1 or System 5.
SIGSETMASK = 0
##########################################################################
# Optional and semi-optional features
##########################################################################
# REGCMP is 1 if your system has the regcmp() function.
# This is normally the case for System 5.
# RECOMP is 1 if your system has the re_comp() function.
# This is normally the case for BSD.
# If neither is 1, pattern matching is supported, but without metacharacters.
REGCMP = 1
RECOMP = 0
# SHELL_ESCAPE is 1 if you wish to allow shell escapes.
# (This is possible only if your system supplies the system() function.)
SHELL_ESCAPE = 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.
EDITOR = 1
EDIT_PGM = vi
# 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.
GLOB = 1
# LOGFILE is 1 if you wish to allow the -l option (to create log files).
LOGFILE = 1
# ONLY_RETURN is 1 if you want RETURN to be the only input which
# will continue past an error message.
# Otherwise, any key will continue past an error message.
ONLY_RETURN = 0
##########################################################################
# Compilation environment.
##########################################################################
# LIBS is the list of libraries needed.
LIBS = -ltermlib
# INSTALL_LESS is a list of the public versions of less.
# INSTALL_HELP is a list of the public version of the help file.
# INSTALL_MAN is a list of the public versions of the manual page.
INSTALL_LESS = $(ROOT)/usr/local/bin/less
INSTALL_HELP = $(ROOT)/usr/local/bin/less.help
INSTALL_MAN = $(ROOT)/usr/man/man1/less.1
MANUAL = less.nro
HELPFILE = /usr/local/bin/less.help
# OPTIM is passed to the compiler and the loader.
# It is normally "-O" but may be, for example, "-g".
OPTIM = -O
##########################################################################
# Files
##########################################################################
SRC1 = main.c option.c prim.c ch.c position.c input.c output.c
SRC2 = screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
SRC = $(SRC1) $(SRC2)
OBJ = main.o option.o prim.o ch.o position.o input.o output.o screen.o \
prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
##########################################################################
# Rules
##########################################################################
DEFS = "-DTERMIO=$(TERMIO)" \
"-DSIGSETMASK=$(SIGSETMASK)" \
"-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
"-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
"-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
"-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
"-DHELPFILE=\"$(HELPFILE)\"" \
"-DLOGFILE=$(LOGFILE)" \
"-DONLY_RETURN=$(ONLY_RETURN)" \
"-DGLOB=$(GLOB)" \
"-DSTAT=$(STAT)" \
"-DPERROR=$(PERROR)" \
"-DXENIX=$(XENIX)"
CFLAGS = $(OPTIM) $(DEFS)
all: less
less: $(OBJ)
$(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
# install: install_less install_help install_man
install: install_less install_help
install_less: less
for f in $(INSTALL_LESS); do rm -f $$f; cp less $$f; done
touch install_less
install_help: less.help
for f in $(INSTALL_HELP); do rm -f $$f; cp less.help $$f; done
touch install_help
install_man: $(MANUAL)
for f in $(INSTALL_MAN); do rm -f $$f; cp $(MANUAL) $$f; done
touch install_man
$(OBJ): less.h funcs.h
# help.o depends on makefile for the definition of HELPFILE.
help.o: makefile
lint:
lint -hp $(DEFS) $(SRC)
newfuncs:
mv funcs.h funcs.h.OLD
awk -f mkfuncs.awk $(SRC) >funcs.h
clean:
rm -f $(OBJ) less
clobber:
rm -f *.o less install_less install_man install_help
shar:
shar -v install less.man makefile.* > less.shar.a
shar -v less.nro $(SRC1) > less.shar.b
shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
_SHAR_EOF_
--
Rich $alz
Cronus Project, BBN Labs rsalz@bbn.com
Moderator, comp.sources.unix sources@uunet.uu.net