Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!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: Wed, 9-Sep-87 23:44:54 EDT Article-I.D.: uunet.1499 Posted: Wed Sep 9 23:44:54 1987 Date-Received: Sat, 12-Sep-87 00:40:34 EDT 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 \n ( ... ) " # # 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 <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>makefile <>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 \n ( ... ) " # # 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 \n ( ... ) " # # 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 \n ( ... ) " # # 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 \n ( ... ) " # # 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 \n ( ... ) " # # 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