home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume11 / less3 / part02 < prev    next >
Internet Message Format  |  1987-09-08  |  42KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v11i034:  The 'less' pager, Part02/03
  5. Message-ID: <1499@uunet.UU.NET>
  6. Date: 10 Sep 87 03:44:54 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 1532
  9. Approved: rs@uunet.UU.NET
  10.  
  11. Submitted-by: sun!intsc!convgt!mark@uunet.UU.NET
  12. Posting-number: Volume 11, Issue 34
  13. Archive-name: less3/Part02
  14.  
  15. [  Sorry about (a) the lag and (b) not posting
  16.    this part first.  It's been both Labor Day and
  17.    Moving Day around these parts.  --r$  ]
  18.  
  19.  
  20. This is the latest version (v.73) of less.  Less is a pager, like more or
  21. pg, only with more features then both of them.  Unpack and read the README
  22. file for installation instructions.  Changes since the last posted version
  23. (v.61) are:
  24.  
  25. *  Now allows !! to repeat previous shell escape.
  26. *  Now allows % as shorthand for the current file name 
  27.    in shell escapes.
  28. *  Now allows # in Examine command to examine previous file, and
  29.    return to the same place in that file.
  30. *  Changed -p option to -C, and added -c for compatibility with "more".
  31. *  -e flag now exits immediately after displaying if file 
  32.    is less than a screenful.
  33. *  Added -E (like -e, but exit FIRST time you hit end-of-file).
  34. *  Added -L (like -l, but unconditionally overwrite existing log file).
  35. *  Can now change number-valued command line options
  36.    from within less (via the "-" command).
  37. *  Added support for SIGWINCH (window size change signal in BSD 4.3).
  38. *  Added similar support for SIGWIND (same thing on the AT&T Unix PC).
  39. *  Better error messages if input cannot be opened or 
  40.    is not a "regular" file.
  41. *  Changed help command from h to H to avoid accidentally entering help.
  42. *  Fixed bug which caused problems on terminals with more 
  43.    than 24 lines.
  44.  
  45.  
  46. Mark Nudelman
  47. tektronix!nscpdc!convgt!mark
  48. ihnp4!nsc!nscpdc!convgt!mark
  49. : ---- cut here ---- cut here ---- cut here ---- cut here ---- cut here ----
  50. : This is a shell archive.
  51. : Unpack by running /bin/sh.
  52.  
  53. echo install
  54. cat >install <<'_SHAR_EOF_'
  55. :
  56. # Installation script for less.
  57. # This script prompts the operator for various information
  58. # and constructs a makefile.
  59.  
  60. echo "This script will build a makefile for less."
  61. echo "If you already have a file called \"makefile\" it will be overwritten."
  62. echo "Press RETURN to continue."
  63. read ans
  64.  
  65. echo "I will ask you some questions about your system."
  66. echo "If you do not know the answer to any question,"
  67. echo "just press RETURN and I will choose a default for you."
  68. echo "Press RETURN now."
  69. read ans
  70.  
  71. echo "Most Unix systems are derived from either System V"
  72. echo "or Berkeley BSD 4.1, 4.2, 4.3, etc."
  73. echo ""
  74. echo "Is your system closest to:"
  75. echo "  1. System V"
  76. echo "  2. BSD 4.1"
  77. echo "  3. BSD 4.2 or later"
  78. echo "  4. Xenix"
  79. echo "Enter a number, or just RETURN if you don't know: \c"
  80. read ans
  81. xenix=0
  82. case "X$ans" in
  83. X1) sys=sys5; sysname="System V" ;;
  84. X2) sys=bsd; bsd41=1; sysname="BSD 4.1" ;;
  85. X3) sys=bsd; bsd41=0; sysname="BSD 4.2" ;;
  86. X4) sys=sys5; xenix=1; sysname="Xenix" ;;
  87. *) sys=unknown ;;
  88. esac
  89. echo ""
  90.  
  91. cat >makefile <<"EOF"
  92. # Makefile for "less"
  93. #
  94. # Invoked as:
  95. #    make all
  96. #   or    make install
  97. # Plain "make" is equivalent to "make all".
  98. #
  99. # If you add or delete functions, remake funcs.h by doing:
  100. #    make newfuncs
  101. # This depends on the coding convention of function headers looking like:
  102. #    " \t public <function-type> \n <function-name> ( ... ) "
  103. #
  104. # Also provided:
  105. #    make lint    # Runs "lint" on all the sources.
  106. #    make clean    # Removes "less" and the .o files.
  107. #    make clobber    # Pretty much the same as make "clean".
  108.  
  109.  
  110. ##########################################################################
  111. # System-specific parameters
  112. ##########################################################################
  113.  
  114. EOF
  115.  
  116. cat >>makefile <<EOF
  117. # Define XENIX if running under XENIX 3.0
  118. XENIX = $xenix
  119.  
  120. EOF
  121. echo ""
  122.  
  123.  
  124.  
  125. if [ "X$sys" = "Xunknown" ]
  126. then
  127.     alldefault=0
  128. else
  129.     def=yes
  130.     alldefault=1
  131.     echo "Do you want to use ALL the defaults for $sysname?"
  132.     echo "  Enter \"yes\" if you have a STANDARD $sysname."
  133.     echo "  Enter \"no\" if you want to change any of the defaults. [$def] \c"
  134.     read ans
  135.     case "X$ans" in
  136.     X[yY]*) alldefault=1 ;;
  137.     X[nN]*) alldefault=0 ;;
  138.     esac
  139.     echo ""
  140. fi
  141.  
  142.  
  143.  
  144. def=yes
  145. x=1
  146. if [ $alldefault = 0 ]
  147. then
  148.     echo "Does your C compiler support the \"void\" type? [$def] \c"
  149.     read ans
  150.     case "X$ans" in
  151.     X[yY]*) x=1 ;;
  152.     X[nN]*) x=0 ;;
  153.     esac
  154.     echo ""
  155. fi
  156. cat >>makefile <<EOF
  157. # VOID is 1 if your C compiler supports the "void" type,
  158. # 0 if it does not.
  159. VOID = $x
  160.  
  161. EOF
  162.  
  163.  
  164.  
  165. def=long
  166. if [ $alldefault = 0 ]
  167. then
  168.     echo "What type is the \"offset\" argument to lseek? [$def] \c"
  169.     read ans
  170.     if [ "X$ans" != "X" ]
  171.     then
  172.         def=$ans
  173.     fi
  174.     echo ""
  175. fi
  176. cat >>makefile <<EOF
  177. # offset_t is the type which lseek() returns.
  178. # It is also the type of lseek()'s second argument.
  179. offset_t = $def
  180.  
  181. EOF
  182.  
  183.  
  184.  
  185.  
  186. def=yes; x=1
  187. if [ $alldefault = 0 ]
  188. then
  189.     echo "Most Unix systems provide the stat() function."
  190.     echo "Does your system have stat()? [$def] \c"
  191.     read ans
  192.     case "X$ans" in
  193.     X[yY]*) x=1 ;;
  194.     X[nN]*) x=0 ;;
  195.     esac
  196.     echo ""
  197. fi
  198. cat >>makefile <<EOF
  199. # STAT is 1 if your system has the stat() call.
  200. STAT = $x
  201.  
  202. EOF
  203.  
  204.  
  205.  
  206.  
  207. def=yes; x=1
  208. if [ $alldefault = 0 ]
  209. then
  210.     echo "Most Unix systems provide the perror() function."
  211.     echo "Does your system have perror()? [$def] \c"
  212.     read ans
  213.     case "X$ans" in
  214.     X[yY]*) x=1 ;;
  215.     X[nN]*) x=0 ;;
  216.     esac
  217.     echo ""
  218. fi
  219. cat >>makefile <<EOF
  220. # PERROR is 1 if your system has the perror() call.
  221. # (Actually, if it has sys_errlist, sys_nerr and errno.)
  222. PERROR = $x
  223.  
  224. EOF
  225.  
  226.  
  227.  
  228.  
  229. if [ "$sys" = "bsd" ]
  230. then
  231.     def=no; x=0
  232. else
  233.     def=yes; x=1
  234. fi
  235. if [ $alldefault = 0 ]
  236. then
  237.     echo "Most System V systems have termio.h, while most"
  238.     echo "Berkeley-derived systems have sgtty.h."
  239.     echo "Does your system have termio.h? [$def] \c"
  240.     read ans
  241.     case "X$ans" in
  242.     X[yY]*) x=1 ;;
  243.     X[nN]*) x=0 ;;
  244.     esac
  245.     echo ""
  246. fi
  247. cat >>makefile <<EOF
  248. # TERMIO is 1 if your system has /usr/include/termio.h.
  249. # This is normally the case for System 5.
  250. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  251. # This is normally the case for BSD.
  252. TERMIO = $x
  253.  
  254. EOF
  255.  
  256.  
  257.  
  258.  
  259. if [ "$sys" = "bsd" -a "$bsd41" = "0" ]
  260. then
  261.     def=yes; x=1
  262. else
  263.     def=no; x=0
  264. fi
  265. if [ $alldefault = 0 ]
  266. then
  267.     echo "Most BSD 4.2 and 4.3 systems have the sigsetmask() call."
  268.     echo "Most System V and BSD 4.1 systems do not."
  269.     echo "Does your system have sigsetmask()? [$def] \c"
  270.     read ans
  271.     case "X$ans" in
  272.     X[yY]*) x=1 ;;
  273.     X[nN]*) x=0 ;;
  274.     esac
  275.     echo ""
  276. fi
  277. cat >>makefile <<EOF
  278. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  279. # This is normally the case only for BSD 4.2,
  280. # not for BSD 4.1 or System 5.
  281. SIGSETMASK = $x
  282.  
  283. EOF
  284.  
  285. cat >>makefile <<EOF
  286. ##########################################################################
  287. # Optional and semi-optional features
  288. ##########################################################################
  289.  
  290. EOF
  291.  
  292.  
  293.  
  294.  
  295. if [ "$sys" = "bsd" ]
  296. then
  297.     def=2; REGCMP=0;RECOMP=1
  298. else
  299.     def=1; REGCMP=1;RECOMP=0
  300. fi
  301. if [ $alldefault = 0 ]
  302. then
  303.     echo "Most System V systems have the regcmp() function."
  304.     echo "Most Berkeley-derived systems have the re_comp() function."
  305.     echo "Does your system have:"
  306.     echo "  1. regcmp"
  307.     echo "  2. re_comp"
  308.     echo "  3. neither   [$def] \c"
  309.     read ans
  310.     case "X$ans" in
  311.     X1) REGCMP=1;RECOMP=0 ;;
  312.     X2) REGCMP=0;RECOMP=1 ;;
  313.     X3) REGCMP=0;RECOMP=0 ;;
  314.     esac
  315.     echo ""
  316. fi
  317. cat >>makefile <<EOF
  318. # REGCMP is 1 if your system has the regcmp() function.
  319. # This is normally the case for System 5.
  320. # RECOMP is 1 if your system has the re_comp() function.
  321. # This is normally the case for BSD.
  322. # If neither is 1, pattern matching is supported, but without metacharacters.
  323. REGCMP = $REGCMP
  324. RECOMP = $RECOMP
  325.  
  326. EOF
  327.  
  328.  
  329.  
  330.  
  331. def=yes
  332. x=1
  333. if [ $alldefault = 0 ]
  334. then
  335.     echo "Do you wish to allow shell escapes? [$def] \c"
  336.     read ans
  337.     case "X$ans" in
  338.     X[yY]*) x=1 ;;
  339.     X[nN]*) x=0 ;;
  340.     esac
  341.     echo ""
  342. fi
  343. cat >>makefile <<EOF
  344. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  345. # (This is possible only if your system supplies the system() function.)
  346. SHELL_ESCAPE = $x
  347.  
  348. EOF
  349.  
  350.  
  351.  
  352. def=yes
  353. x=1
  354. edname="vi"
  355. if [ $alldefault = 0 ]
  356. then
  357.     echo "Do you wish to allow editor escapes? [$def] \c"
  358.     read ans
  359.     case "X$ans" in
  360.     X[nN]*) x=0; edname="" ;;
  361.     X[yY]*) x=1
  362.         echo "What is the pathname of the default editor? [$edname] \c"
  363.         read ans 
  364.         if [ "x$ans" != "x" ]
  365.         then
  366.             edname=$ans
  367.         fi
  368.         ;;
  369.     esac
  370.     echo ""
  371. fi
  372. cat >>makefile <<EOF
  373. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  374. # (This is possible only if your system supplies the system() function.)
  375. # EDIT_PGM is the name of the (default) editor to be invoked.
  376. EDITOR = $x
  377. EDIT_PGM = $edname
  378.  
  379. EOF
  380.  
  381.  
  382.  
  383. def=yes
  384. x=1
  385. if [ $alldefault = 0 ]
  386. then
  387.     echo "If your system provides the popen() function and"
  388.     echo "the \"echo\" shell command, you may allow shell metacharacters" 
  389.     echo "to be expanded in filenames."
  390.     echo "Do you wish to allow shell metacharacters in filenames? [$def] \c"
  391.     read ans
  392.     case "X$ans" in
  393.     X[yY]*) x=1 ;;
  394.     X[nN]*) x=0 ;;
  395.     esac
  396.     echo ""
  397. fi
  398. cat >>makefile <<EOF
  399. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  400. # This will generally work if your system provides the "popen" function
  401. # and the "echo" shell command.
  402. GLOB = $x
  403.  
  404. EOF
  405.  
  406.  
  407.  
  408. def=yes
  409. x=1
  410. if [ $alldefault = 0 ]
  411. then
  412.     echo "Do you wish to allow log files (-l option)? [$def] \c"
  413.     read ans
  414.     case "X$ans" in
  415.     X[yY]*) x=1 ;;
  416.     X[nN]*) x=0 ;;
  417.     esac
  418.     echo ""
  419. fi
  420. cat >>makefile <<EOF
  421. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  422. LOGFILE = $x
  423.  
  424. EOF
  425.  
  426. cat >>makefile <<EOF
  427. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  428. # will continue past an error message.
  429. # Otherwise, any key will continue past an error message.
  430. ONLY_RETURN = 0
  431.  
  432.  
  433. ##########################################################################
  434. # Compilation environment.
  435. ##########################################################################
  436.  
  437. EOF
  438.  
  439.  
  440.  
  441. if [ "$xenix" = "1" ]
  442. then
  443.     LIBS="-ltermlib"
  444. elif [ "$sys" = "bsd" ]
  445. then
  446.     LIBS="-ltermcap"
  447. else
  448.     LIBS="-lcurses -ltermcap -lPW"
  449. fi
  450. if [ $alldefault = 0 ]
  451. then
  452.     echo "To build \"less\", you must link with libraries supplied by your system."
  453.     echo "(If this needs to be changed later, edit the makefile"
  454.     echo "and change the definition of LIBS.)"
  455.     echo "What libraries should be used [$LIBS] \c"
  456.     read ans
  457.     if [ "X$ans" != "X" ]
  458.     then
  459.         LIBS="$ans"
  460.     fi
  461.     echo ""
  462. fi
  463. cat >>makefile <<EOF
  464. # LIBS is the list of libraries needed.
  465. LIBS = $LIBS
  466.  
  467. EOF
  468.  
  469.  
  470.  
  471. INSTALL_LESS="/usr/local/bin/less"
  472. INSTALL_HELP="/usr/local/bin/less.help"
  473. INSTALL_MAN="/usr/man/man1/less.1"
  474. MANUAL="less.nro"
  475. if [ $alldefault = 0 ]
  476. then
  477.     echo "What is the name of the \"public\" (installed) version of less?"
  478.     echo " [$INSTALL_LESS] \c"
  479.     read ans
  480.     if [ "X$ans" != "X" ]
  481.     then
  482.         INSTALL_LESS="$ans"
  483.     fi
  484.     echo "What is the name of the \"public\" (installed) version of the help file?"
  485.     echo " [$INSTALL_HELP] \c"
  486.     read ans
  487.     if [ "X$ans" != "X" ]
  488.     then
  489.         INSTALL_HELP="$ans"
  490.     fi
  491.     echo "What is the name of the \"public\" (installed) version of the manual page?"
  492.     echo " [$INSTALL_MAN] \c"
  493.     read ans
  494.     if [ "X$ans" != "X" ]
  495.     then
  496.         INSTALL_MAN="$ans"
  497.     fi
  498.     echo ""
  499. fi
  500. cat >>makefile <<EOF
  501. # INSTALL_LESS is a list of the public versions of less.
  502. # INSTALL_HELP is a list of the public version of the help file.
  503. # INSTALL_MAN is a list of the public versions of the manual page.
  504. INSTALL_LESS =    \$(ROOT)$INSTALL_LESS
  505. INSTALL_HELP =    \$(ROOT)$INSTALL_HELP
  506. INSTALL_MAN =    \$(ROOT)$INSTALL_MAN
  507. MANUAL =    $MANUAL
  508. HELPFILE =    $INSTALL_HELP
  509.  
  510.  
  511. EOF
  512.  
  513.  
  514.  
  515. cat >>makefile <<"EOF"
  516. # OPTIM is passed to the compiler and the loader.
  517. # It is normally "-O" but may be, for example, "-g".
  518. OPTIM = -O
  519.  
  520.  
  521. ##########################################################################
  522. # Files
  523. ##########################################################################
  524.  
  525. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  526. SRC2 =    screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
  527. SRC =    $(SRC1) $(SRC2)
  528. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  529.     prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
  530.  
  531.  
  532. ##########################################################################
  533. # Rules
  534. ##########################################################################
  535.  
  536. DEFS =    "-DTERMIO=$(TERMIO)" \
  537.     "-DSIGSETMASK=$(SIGSETMASK)" \
  538.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  539.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  540.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  541.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  542.     "-DHELPFILE=\"$(HELPFILE)\"" \
  543.     "-DLOGFILE=$(LOGFILE)" \
  544.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  545.     "-DGLOB=$(GLOB)" \
  546.     "-DSTAT=$(STAT)" \
  547.     "-DPERROR=$(PERROR)" \
  548.     "-DXENIX=$(XENIX)"
  549.  
  550. CFLAGS = $(OPTIM) $(DEFS)
  551.  
  552.  
  553. all: less
  554.  
  555. less: $(OBJ)
  556.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
  557.  
  558. # install: install_less install_help install_man
  559. install: install_less install_help
  560.  
  561. install_less: less
  562.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  563.     touch install_less
  564.  
  565. install_help: less.help
  566.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  567.     touch install_help
  568.  
  569. install_man: $(MANUAL)
  570.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  571.     touch install_man
  572.  
  573. $(OBJ): less.h funcs.h
  574.  
  575. # help.o depends on makefile for the definition of HELPFILE.
  576. help.o: makefile
  577.  
  578. lint:
  579.     lint -hp $(DEFS) $(SRC)
  580.  
  581. newfuncs:
  582.     mv funcs.h funcs.h.OLD
  583.     awk -f mkfuncs.awk $(SRC) >funcs.h
  584.  
  585. clean:
  586.     rm -f $(OBJ) less
  587.  
  588. clobber:
  589.     rm -f *.o less install_less install_man install_help
  590.  
  591. shar:
  592.     shar -v install less.man makefile.* > less.shar.a
  593.     shar -v less.nro $(SRC1) > less.shar.b
  594.     shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
  595. EOF
  596. echo ""
  597.  
  598. echo "The makefile has been built."
  599. echo "You should check it to make sure everything is as you want it to be."
  600. echo "When you are satisfied with the makefile, just type \"make\""
  601. echo "and \"less\" will be built."
  602. _SHAR_EOF_
  603. chmod +x install
  604.  
  605. echo makefile.bak
  606. cat >makefile.bak <<'_SHAR_EOF_'
  607. #    Convergent Technologies - System V - Jan 1987
  608. #ident    "%W% :%P% %G% %U%"
  609.  
  610. # Makefile for "less"
  611. #
  612. # Invoked as:
  613. #    make all
  614. #   or    make install
  615. # Plain "make" is equivalent to "make all".
  616. #
  617. # If you add or delete functions, remake funcs.h by doing:
  618. #    make newfuncs
  619. # This depends on the coding convention of function headers looking like:
  620. #    " \t public <function-type> \n <function-name> ( ... ) "
  621. #
  622. # Also provided:
  623. #    make lint    # Runs "lint" on all the sources.
  624. #    make clean    # Removes "less" and the .o files.
  625. #    make clobber    # Pretty much the same as make "clean".
  626.  
  627.  
  628. ##########################################################################
  629. # System-specific parameters
  630. ##########################################################################
  631.  
  632. # Define XENIX if running under XENIX 3.0
  633. XENIX = 0
  634.  
  635. # VOID is 1 if your C compiler supports the "void" type,
  636. # 0 if it does not.
  637. VOID = 1
  638.  
  639. # offset_t is the type which lseek() returns.
  640. # It is also the type of lseek()'s second argument.
  641. offset_t = long
  642.  
  643. # STAT is 1 if your system has the stat() call.
  644. STAT = 1
  645.  
  646. # TERMIO is 1 if your system has /usr/include/termio.h.
  647. # This is normally the case for System 5.
  648. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  649. # This is normally the case for BSD.
  650. TERMIO = 1
  651.  
  652. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  653. # This is normally the case only for BSD 4.2,
  654. # not for BSD 4.1 or System 5.
  655. SIGSETMASK = 0
  656.  
  657. ##########################################################################
  658. # Optional and semi-optional features
  659. ##########################################################################
  660.  
  661. # REGCMP is 1 if your system has the regcmp() function.
  662. # This is normally the case for System 5.
  663. # RECOMP is 1 if your system has the re_comp() function.
  664. # This is normally the case for BSD.
  665. # If neither is 1, pattern matching is supported, but without metacharacters.
  666. REGCMP = 1
  667. RECOMP = 0
  668.  
  669. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  670. # (This is possible only if your system supplies the system() function.)
  671. SHELL_ESCAPE = 1
  672.  
  673. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  674. # (This is possible only if your system supplies the system() function.)
  675. # EDIT_PGM is the name of the (default) editor to be invoked.
  676. EDITOR = 1
  677. EDIT_PGM = vi
  678.  
  679. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  680. # This will generally work if your system provides the "popen" function
  681. # and the "echo" shell command.
  682. GLOB = 1
  683.  
  684. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  685. LOGFILE = 1
  686.  
  687. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  688. # will continue past an error message.
  689. # Otherwise, any key will continue past an error message.
  690. ONLY_RETURN = 0
  691.  
  692.  
  693. ##########################################################################
  694. # Compilation environment.
  695. ##########################################################################
  696.  
  697. # LIBS is the list of libraries needed.
  698. LIBS = -lcurses -ltermcap -lPW
  699.  
  700. # INSTALL_LESS is a list of the public versions of less.
  701. # INSTALL_HELP is a list of the public version of the help file.
  702. # INSTALL_MAN is a list of the public versions of the manual page.
  703. INSTALL_LESS =    /usr/local/bin/less
  704. INSTALL_HELP =    /usr/local/bin/less.help
  705. INSTALL_MAN =    /usr/man/man1/less.1
  706. MANUAL =    less.nro
  707. HELPFILE =    /usr/local/bin/less.help
  708.  
  709.  
  710. # OPTIM is passed to the compiler and the loader.
  711. # It is normally "-O" but may be, for example, "-g".
  712. OPTIM = -O
  713.  
  714.  
  715. ##########################################################################
  716. # Files
  717. ##########################################################################
  718.  
  719. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  720. SRC2 =    screen.c prompt.c line.c signal.c help.c ttyin.c command.c version.c
  721. SRC =    $(SRC1) $(SRC2)
  722. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  723.     prompt.o line.o signal.o help.o ttyin.o command.o version.o
  724.  
  725.  
  726. ##########################################################################
  727. # Rules
  728. ##########################################################################
  729.  
  730. DEFS =    "-DTERMIO=$(TERMIO)" \
  731.     "-DSIGSETMASK=$(SIGSETMASK)" \
  732.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  733.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  734.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  735.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  736.     "-DHELPFILE=\"$(HELPFILE)\"" \
  737.     "-DLOGFILE=$(LOGFILE)" \
  738.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  739.     "-DGLOB=$(GLOB)" \
  740.     "-DSTAT=$(STAT)" \
  741.     "-DXENIX=$(XENIX)"
  742.  
  743. CFLAGS = $(OPTIM) $(DEFS)
  744.  
  745.  
  746. all: less
  747.  
  748. less: $(OBJ)
  749.     cc $(OPTIM) -o less $(OBJ) $(LIBS)
  750.  
  751. install: install_man install_less install_help
  752.  
  753. install_less: less
  754.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  755.     touch install_less
  756.  
  757. install_help: less.help
  758.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  759.     touch install_help
  760.  
  761. install_man: $(MANUAL)
  762.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  763.     touch install_man
  764.  
  765. $(OBJ): less.h funcs.h
  766.  
  767. # help.o depends on makefile for the definition of HELPFILE.
  768. help.o: makefile
  769.  
  770. lint:
  771.     lint -hp $(DEFS) $(SRC)
  772.  
  773. newfuncs:
  774.     mv funcs.h funcs.h.OLD
  775.     awk -f mkfuncs.awk $(SRC) >funcs.h
  776.  
  777. clean:
  778.     rm -f $(OBJ) less
  779.  
  780. clobber:
  781.     rm -f *.o less install_less install_man
  782.  
  783. shar:
  784.     shar -v README install less.man less.help makefile.* *.h *.awk > less.shar.a
  785.     shar -v less.nro $(SRC1) > less.shar.b
  786.     shar -v $(SRC2) > less.shar.c
  787. _SHAR_EOF_
  788.  
  789. echo makefile.bsd41
  790. cat >makefile.bsd41 <<'_SHAR_EOF_'
  791. # Makefile for "less"
  792. #
  793. # Invoked as:
  794. #    make all
  795. #   or    make install
  796. # Plain "make" is equivalent to "make all".
  797. #
  798. # If you add or delete functions, remake funcs.h by doing:
  799. #    make newfuncs
  800. # This depends on the coding convention of function headers looking like:
  801. #    " \t public <function-type> \n <function-name> ( ... ) "
  802. #
  803. # Also provided:
  804. #    make lint    # Runs "lint" on all the sources.
  805. #    make clean    # Removes "less" and the .o files.
  806. #    make clobber    # Pretty much the same as make "clean".
  807.  
  808.  
  809. ##########################################################################
  810. # System-specific parameters
  811. ##########################################################################
  812.  
  813. # Define XENIX if running under XENIX 3.0
  814. XENIX = 0
  815.  
  816. # VOID is 1 if your C compiler supports the "void" type,
  817. # 0 if it does not.
  818. VOID = 1
  819.  
  820. # offset_t is the type which lseek() returns.
  821. # It is also the type of lseek()'s second argument.
  822. offset_t = long
  823.  
  824. # STAT is 1 if your system has the stat() call.
  825. STAT = 1
  826.  
  827. # PERROR is 1 if your system has the perror() call.
  828. # (Actually, if it has sys_errlist, sys_nerr and errno.)
  829. PERROR = 1
  830.  
  831. # TERMIO is 1 if your system has /usr/include/termio.h.
  832. # This is normally the case for System 5.
  833. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  834. # This is normally the case for BSD.
  835. TERMIO = 0
  836.  
  837. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  838. # This is normally the case only for BSD 4.2,
  839. # not for BSD 4.1 or System 5.
  840. SIGSETMASK = 0
  841.  
  842. ##########################################################################
  843. # Optional and semi-optional features
  844. ##########################################################################
  845.  
  846. # REGCMP is 1 if your system has the regcmp() function.
  847. # This is normally the case for System 5.
  848. # RECOMP is 1 if your system has the re_comp() function.
  849. # This is normally the case for BSD.
  850. # If neither is 1, pattern matching is supported, but without metacharacters.
  851. REGCMP = 0
  852. RECOMP = 1
  853.  
  854. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  855. # (This is possible only if your system supplies the system() function.)
  856. SHELL_ESCAPE = 1
  857.  
  858. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  859. # (This is possible only if your system supplies the system() function.)
  860. # EDIT_PGM is the name of the (default) editor to be invoked.
  861. EDITOR = 1
  862. EDIT_PGM = vi
  863.  
  864. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  865. # This will generally work if your system provides the "popen" function
  866. # and the "echo" shell command.
  867. GLOB = 1
  868.  
  869. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  870. LOGFILE = 1
  871.  
  872. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  873. # will continue past an error message.
  874. # Otherwise, any key will continue past an error message.
  875. ONLY_RETURN = 0
  876.  
  877.  
  878. ##########################################################################
  879. # Compilation environment.
  880. ##########################################################################
  881.  
  882. # LIBS is the list of libraries needed.
  883. LIBS = -ltermcap
  884.  
  885. # INSTALL_LESS is a list of the public versions of less.
  886. # INSTALL_HELP is a list of the public version of the help file.
  887. # INSTALL_MAN is a list of the public versions of the manual page.
  888. INSTALL_LESS =    $(ROOT)/usr/local/bin/less
  889. INSTALL_HELP =    $(ROOT)/usr/local/bin/less.help
  890. INSTALL_MAN =    $(ROOT)/usr/man/man1/less.1
  891. MANUAL =    less.nro
  892. HELPFILE =    /usr/local/bin/less.help
  893.  
  894.  
  895. # OPTIM is passed to the compiler and the loader.
  896. # It is normally "-O" but may be, for example, "-g".
  897. OPTIM = -O
  898.  
  899.  
  900. ##########################################################################
  901. # Files
  902. ##########################################################################
  903.  
  904. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  905. SRC2 =    screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
  906. SRC =    $(SRC1) $(SRC2)
  907. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  908.     prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
  909.  
  910.  
  911. ##########################################################################
  912. # Rules
  913. ##########################################################################
  914.  
  915. DEFS =    "-DTERMIO=$(TERMIO)" \
  916.     "-DSIGSETMASK=$(SIGSETMASK)" \
  917.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  918.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  919.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  920.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  921.     "-DHELPFILE=\"$(HELPFILE)\"" \
  922.     "-DLOGFILE=$(LOGFILE)" \
  923.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  924.     "-DGLOB=$(GLOB)" \
  925.     "-DSTAT=$(STAT)" \
  926.     "-DPERROR=$(PERROR)" \
  927.     "-DXENIX=$(XENIX)"
  928.  
  929. CFLAGS = $(OPTIM) $(DEFS)
  930.  
  931.  
  932. all: less
  933.  
  934. less: $(OBJ)
  935.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
  936.  
  937. # install: install_less install_help install_man
  938. install: install_less install_help
  939.  
  940. install_less: less
  941.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  942.     touch install_less
  943.  
  944. install_help: less.help
  945.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  946.     touch install_help
  947.  
  948. install_man: $(MANUAL)
  949.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  950.     touch install_man
  951.  
  952. $(OBJ): less.h funcs.h
  953.  
  954. # help.o depends on makefile for the definition of HELPFILE.
  955. help.o: makefile
  956.  
  957. lint:
  958.     lint -hp $(DEFS) $(SRC)
  959.  
  960. newfuncs:
  961.     mv funcs.h funcs.h.OLD
  962.     awk -f mkfuncs.awk $(SRC) >funcs.h
  963.  
  964. clean:
  965.     rm -f $(OBJ) less
  966.  
  967. clobber:
  968.     rm -f *.o less install_less install_man install_help
  969.  
  970. shar:
  971.     shar -v install less.man makefile.* > less.shar.a
  972.     shar -v less.nro $(SRC1) > less.shar.b
  973.     shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
  974. _SHAR_EOF_
  975.  
  976. echo makefile.bsd42
  977. cat >makefile.bsd42 <<'_SHAR_EOF_'
  978. # Makefile for "less"
  979. #
  980. # Invoked as:
  981. #    make all
  982. #   or    make install
  983. # Plain "make" is equivalent to "make all".
  984. #
  985. # If you add or delete functions, remake funcs.h by doing:
  986. #    make newfuncs
  987. # This depends on the coding convention of function headers looking like:
  988. #    " \t public <function-type> \n <function-name> ( ... ) "
  989. #
  990. # Also provided:
  991. #    make lint    # Runs "lint" on all the sources.
  992. #    make clean    # Removes "less" and the .o files.
  993. #    make clobber    # Pretty much the same as make "clean".
  994.  
  995.  
  996. ##########################################################################
  997. # System-specific parameters
  998. ##########################################################################
  999.  
  1000. # Define XENIX if running under XENIX 3.0
  1001. XENIX = 0
  1002.  
  1003. # VOID is 1 if your C compiler supports the "void" type,
  1004. # 0 if it does not.
  1005. VOID = 1
  1006.  
  1007. # offset_t is the type which lseek() returns.
  1008. # It is also the type of lseek()'s second argument.
  1009. offset_t = long
  1010.  
  1011. # STAT is 1 if your system has the stat() call.
  1012. STAT = 1
  1013.  
  1014. # PERROR is 1 if your system has the perror() call.
  1015. # (Actually, if it has sys_errlist, sys_nerr and errno.)
  1016. PERROR = 1
  1017.  
  1018. # TERMIO is 1 if your system has /usr/include/termio.h.
  1019. # This is normally the case for System 5.
  1020. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  1021. # This is normally the case for BSD.
  1022. TERMIO = 0
  1023.  
  1024. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  1025. # This is normally the case only for BSD 4.2,
  1026. # not for BSD 4.1 or System 5.
  1027. SIGSETMASK = 1
  1028.  
  1029. ##########################################################################
  1030. # Optional and semi-optional features
  1031. ##########################################################################
  1032.  
  1033. # REGCMP is 1 if your system has the regcmp() function.
  1034. # This is normally the case for System 5.
  1035. # RECOMP is 1 if your system has the re_comp() function.
  1036. # This is normally the case for BSD.
  1037. # If neither is 1, pattern matching is supported, but without metacharacters.
  1038. REGCMP = 0
  1039. RECOMP = 1
  1040.  
  1041. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  1042. # (This is possible only if your system supplies the system() function.)
  1043. SHELL_ESCAPE = 1
  1044.  
  1045. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  1046. # (This is possible only if your system supplies the system() function.)
  1047. # EDIT_PGM is the name of the (default) editor to be invoked.
  1048. EDITOR = 1
  1049. EDIT_PGM = vi
  1050.  
  1051. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  1052. # This will generally work if your system provides the "popen" function
  1053. # and the "echo" shell command.
  1054. GLOB = 1
  1055.  
  1056. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  1057. LOGFILE = 1
  1058.  
  1059. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  1060. # will continue past an error message.
  1061. # Otherwise, any key will continue past an error message.
  1062. ONLY_RETURN = 0
  1063.  
  1064.  
  1065. ##########################################################################
  1066. # Compilation environment.
  1067. ##########################################################################
  1068.  
  1069. # LIBS is the list of libraries needed.
  1070. LIBS = -ltermcap
  1071.  
  1072. # INSTALL_LESS is a list of the public versions of less.
  1073. # INSTALL_HELP is a list of the public version of the help file.
  1074. # INSTALL_MAN is a list of the public versions of the manual page.
  1075. INSTALL_LESS =    $(ROOT)/usr/local/bin/less
  1076. INSTALL_HELP =    $(ROOT)/usr/local/bin/less.help
  1077. INSTALL_MAN =    $(ROOT)/usr/man/man1/less.1
  1078. MANUAL =    less.nro
  1079. HELPFILE =    /usr/local/bin/less.help
  1080.  
  1081.  
  1082. # OPTIM is passed to the compiler and the loader.
  1083. # It is normally "-O" but may be, for example, "-g".
  1084. OPTIM = -O
  1085.  
  1086.  
  1087. ##########################################################################
  1088. # Files
  1089. ##########################################################################
  1090.  
  1091. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  1092. SRC2 =    screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
  1093. SRC =    $(SRC1) $(SRC2)
  1094. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  1095.     prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
  1096.  
  1097.  
  1098. ##########################################################################
  1099. # Rules
  1100. ##########################################################################
  1101.  
  1102. DEFS =    "-DTERMIO=$(TERMIO)" \
  1103.     "-DSIGSETMASK=$(SIGSETMASK)" \
  1104.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  1105.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  1106.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  1107.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  1108.     "-DHELPFILE=\"$(HELPFILE)\"" \
  1109.     "-DLOGFILE=$(LOGFILE)" \
  1110.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  1111.     "-DGLOB=$(GLOB)" \
  1112.     "-DSTAT=$(STAT)" \
  1113.     "-DPERROR=$(PERROR)" \
  1114.     "-DXENIX=$(XENIX)"
  1115.  
  1116. CFLAGS = $(OPTIM) $(DEFS)
  1117.  
  1118.  
  1119. all: less
  1120.  
  1121. less: $(OBJ)
  1122.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
  1123.  
  1124. # install: install_less install_help install_man
  1125. install: install_less install_help
  1126.  
  1127. install_less: less
  1128.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  1129.     touch install_less
  1130.  
  1131. install_help: less.help
  1132.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  1133.     touch install_help
  1134.  
  1135. install_man: $(MANUAL)
  1136.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  1137.     touch install_man
  1138.  
  1139. $(OBJ): less.h funcs.h
  1140.  
  1141. # help.o depends on makefile for the definition of HELPFILE.
  1142. help.o: makefile
  1143.  
  1144. lint:
  1145.     lint -hp $(DEFS) $(SRC)
  1146.  
  1147. newfuncs:
  1148.     mv funcs.h funcs.h.OLD
  1149.     awk -f mkfuncs.awk $(SRC) >funcs.h
  1150.  
  1151. clean:
  1152.     rm -f $(OBJ) less
  1153.  
  1154. clobber:
  1155.     rm -f *.o less install_less install_man install_help
  1156.  
  1157. shar:
  1158.     shar -v install less.man makefile.* > less.shar.a
  1159.     shar -v less.nro $(SRC1) > less.shar.b
  1160.     shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
  1161. _SHAR_EOF_
  1162.  
  1163. echo makefile.sys5
  1164. cat >makefile.sys5 <<'_SHAR_EOF_'
  1165. # Makefile for "less"
  1166. #
  1167. # Invoked as:
  1168. #    make all
  1169. #   or    make install
  1170. # Plain "make" is equivalent to "make all".
  1171. #
  1172. # If you add or delete functions, remake funcs.h by doing:
  1173. #    make newfuncs
  1174. # This depends on the coding convention of function headers looking like:
  1175. #    " \t public <function-type> \n <function-name> ( ... ) "
  1176. #
  1177. # Also provided:
  1178. #    make lint    # Runs "lint" on all the sources.
  1179. #    make clean    # Removes "less" and the .o files.
  1180. #    make clobber    # Pretty much the same as make "clean".
  1181.  
  1182.  
  1183. ##########################################################################
  1184. # System-specific parameters
  1185. ##########################################################################
  1186.  
  1187. # Define XENIX if running under XENIX 3.0
  1188. XENIX = 0
  1189.  
  1190. # VOID is 1 if your C compiler supports the "void" type,
  1191. # 0 if it does not.
  1192. VOID = 1
  1193.  
  1194. # offset_t is the type which lseek() returns.
  1195. # It is also the type of lseek()'s second argument.
  1196. offset_t = long
  1197.  
  1198. # STAT is 1 if your system has the stat() call.
  1199. STAT = 1
  1200.  
  1201. # PERROR is 1 if your system has the perror() call.
  1202. # (Actually, if it has sys_errlist, sys_nerr and errno.)
  1203. PERROR = 1
  1204.  
  1205. # TERMIO is 1 if your system has /usr/include/termio.h.
  1206. # This is normally the case for System 5.
  1207. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  1208. # This is normally the case for BSD.
  1209. TERMIO = 1
  1210.  
  1211. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  1212. # This is normally the case only for BSD 4.2,
  1213. # not for BSD 4.1 or System 5.
  1214. SIGSETMASK = 0
  1215.  
  1216. ##########################################################################
  1217. # Optional and semi-optional features
  1218. ##########################################################################
  1219.  
  1220. # REGCMP is 1 if your system has the regcmp() function.
  1221. # This is normally the case for System 5.
  1222. # RECOMP is 1 if your system has the re_comp() function.
  1223. # This is normally the case for BSD.
  1224. # If neither is 1, pattern matching is supported, but without metacharacters.
  1225. REGCMP = 1
  1226. RECOMP = 0
  1227.  
  1228. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  1229. # (This is possible only if your system supplies the system() function.)
  1230. SHELL_ESCAPE = 1
  1231.  
  1232. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  1233. # (This is possible only if your system supplies the system() function.)
  1234. # EDIT_PGM is the name of the (default) editor to be invoked.
  1235. EDITOR = 1
  1236. EDIT_PGM = vi
  1237.  
  1238. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  1239. # This will generally work if your system provides the "popen" function
  1240. # and the "echo" shell command.
  1241. GLOB = 1
  1242.  
  1243. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  1244. LOGFILE = 1
  1245.  
  1246. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  1247. # will continue past an error message.
  1248. # Otherwise, any key will continue past an error message.
  1249. ONLY_RETURN = 0
  1250.  
  1251.  
  1252. ##########################################################################
  1253. # Compilation environment.
  1254. ##########################################################################
  1255.  
  1256. # LIBS is the list of libraries needed.
  1257. LIBS = -lcurses -ltermcap -lPW
  1258.  
  1259. # INSTALL_LESS is a list of the public versions of less.
  1260. # INSTALL_HELP is a list of the public version of the help file.
  1261. # INSTALL_MAN is a list of the public versions of the manual page.
  1262. INSTALL_LESS =    $(ROOT)/usr/local/bin/less
  1263. INSTALL_HELP =    $(ROOT)/usr/local/bin/less.help
  1264. INSTALL_MAN =    $(ROOT)/usr/man/man1/less.1
  1265. MANUAL =    less.nro
  1266. HELPFILE =    /usr/local/bin/less.help
  1267.  
  1268.  
  1269. # OPTIM is passed to the compiler and the loader.
  1270. # It is normally "-O" but may be, for example, "-g".
  1271. OPTIM = -O
  1272.  
  1273.  
  1274. ##########################################################################
  1275. # Files
  1276. ##########################################################################
  1277.  
  1278. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  1279. SRC2 =    screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
  1280. SRC =    $(SRC1) $(SRC2)
  1281. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  1282.     prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
  1283.  
  1284.  
  1285. ##########################################################################
  1286. # Rules
  1287. ##########################################################################
  1288.  
  1289. DEFS =    "-DTERMIO=$(TERMIO)" \
  1290.     "-DSIGSETMASK=$(SIGSETMASK)" \
  1291.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  1292.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  1293.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  1294.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  1295.     "-DHELPFILE=\"$(HELPFILE)\"" \
  1296.     "-DLOGFILE=$(LOGFILE)" \
  1297.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  1298.     "-DGLOB=$(GLOB)" \
  1299.     "-DSTAT=$(STAT)" \
  1300.     "-DPERROR=$(PERROR)" \
  1301.     "-DXENIX=$(XENIX)"
  1302.  
  1303. CFLAGS = $(OPTIM) $(DEFS)
  1304.  
  1305.  
  1306. all: less
  1307.  
  1308. less: $(OBJ)
  1309.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
  1310.  
  1311. # install: install_less install_help install_man
  1312. install: install_less install_help
  1313.  
  1314. install_less: less
  1315.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  1316.     touch install_less
  1317.  
  1318. install_help: less.help
  1319.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  1320.     touch install_help
  1321.  
  1322. install_man: $(MANUAL)
  1323.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  1324.     touch install_man
  1325.  
  1326. $(OBJ): less.h funcs.h
  1327.  
  1328. # help.o depends on makefile for the definition of HELPFILE.
  1329. help.o: makefile
  1330.  
  1331. lint:
  1332.     lint -hp $(DEFS) $(SRC)
  1333.  
  1334. newfuncs:
  1335.     mv funcs.h funcs.h.OLD
  1336.     awk -f mkfuncs.awk $(SRC) >funcs.h
  1337.  
  1338. clean:
  1339.     rm -f $(OBJ) less
  1340.  
  1341. clobber:
  1342.     rm -f *.o less install_less install_man install_help
  1343.  
  1344. shar:
  1345.     shar -v install less.man makefile.* > less.shar.a
  1346.     shar -v less.nro $(SRC1) > less.shar.b
  1347.     shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
  1348. _SHAR_EOF_
  1349.  
  1350. echo makefile.xen
  1351. cat >makefile.xen <<'_SHAR_EOF_'
  1352. # Makefile for "less"
  1353. #
  1354. # Invoked as:
  1355. #    make all
  1356. #   or    make install
  1357. # Plain "make" is equivalent to "make all".
  1358. #
  1359. # If you add or delete functions, remake funcs.h by doing:
  1360. #    make newfuncs
  1361. # This depends on the coding convention of function headers looking like:
  1362. #    " \t public <function-type> \n <function-name> ( ... ) "
  1363. #
  1364. # Also provided:
  1365. #    make lint    # Runs "lint" on all the sources.
  1366. #    make clean    # Removes "less" and the .o files.
  1367. #    make clobber    # Pretty much the same as make "clean".
  1368.  
  1369.  
  1370. ##########################################################################
  1371. # System-specific parameters
  1372. ##########################################################################
  1373.  
  1374. # Define XENIX if running under XENIX 3.0
  1375. XENIX = 1
  1376.  
  1377. # VOID is 1 if your C compiler supports the "void" type,
  1378. # 0 if it does not.
  1379. VOID = 1
  1380.  
  1381. # offset_t is the type which lseek() returns.
  1382. # It is also the type of lseek()'s second argument.
  1383. offset_t = long
  1384.  
  1385. # STAT is 1 if your system has the stat() call.
  1386. STAT = 1
  1387.  
  1388. # PERROR is 1 if your system has the perror() call.
  1389. # (Actually, if it has sys_errlist, sys_nerr and errno.)
  1390. PERROR = 1
  1391.  
  1392. # TERMIO is 1 if your system has /usr/include/termio.h.
  1393. # This is normally the case for System 5.
  1394. # If TERMIO is 0 your system must have /usr/include/sgtty.h.
  1395. # This is normally the case for BSD.
  1396. TERMIO = 1
  1397.  
  1398. # SIGSETMASK is 1 if your system has the sigsetmask() call.
  1399. # This is normally the case only for BSD 4.2,
  1400. # not for BSD 4.1 or System 5.
  1401. SIGSETMASK = 0
  1402.  
  1403. ##########################################################################
  1404. # Optional and semi-optional features
  1405. ##########################################################################
  1406.  
  1407. # REGCMP is 1 if your system has the regcmp() function.
  1408. # This is normally the case for System 5.
  1409. # RECOMP is 1 if your system has the re_comp() function.
  1410. # This is normally the case for BSD.
  1411. # If neither is 1, pattern matching is supported, but without metacharacters.
  1412. REGCMP = 1
  1413. RECOMP = 0
  1414.  
  1415. # SHELL_ESCAPE is 1 if you wish to allow shell escapes.
  1416. # (This is possible only if your system supplies the system() function.)
  1417. SHELL_ESCAPE = 1
  1418.  
  1419. # EDITOR is 1 if you wish to allow editor invocation (the "v" command).
  1420. # (This is possible only if your system supplies the system() function.)
  1421. # EDIT_PGM is the name of the (default) editor to be invoked.
  1422. EDITOR = 1
  1423. EDIT_PGM = vi
  1424.  
  1425. # GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
  1426. # This will generally work if your system provides the "popen" function
  1427. # and the "echo" shell command.
  1428. GLOB = 1
  1429.  
  1430. # LOGFILE is 1 if you wish to allow the -l option (to create log files).
  1431. LOGFILE = 1
  1432.  
  1433. # ONLY_RETURN is 1 if you want RETURN to be the only input which
  1434. # will continue past an error message.
  1435. # Otherwise, any key will continue past an error message.
  1436. ONLY_RETURN = 0
  1437.  
  1438.  
  1439. ##########################################################################
  1440. # Compilation environment.
  1441. ##########################################################################
  1442.  
  1443. # LIBS is the list of libraries needed.
  1444. LIBS = -ltermlib
  1445.  
  1446. # INSTALL_LESS is a list of the public versions of less.
  1447. # INSTALL_HELP is a list of the public version of the help file.
  1448. # INSTALL_MAN is a list of the public versions of the manual page.
  1449. INSTALL_LESS =    $(ROOT)/usr/local/bin/less
  1450. INSTALL_HELP =    $(ROOT)/usr/local/bin/less.help
  1451. INSTALL_MAN =    $(ROOT)/usr/man/man1/less.1
  1452. MANUAL =    less.nro
  1453. HELPFILE =    /usr/local/bin/less.help
  1454.  
  1455.  
  1456. # OPTIM is passed to the compiler and the loader.
  1457. # It is normally "-O" but may be, for example, "-g".
  1458. OPTIM = -O
  1459.  
  1460.  
  1461. ##########################################################################
  1462. # Files
  1463. ##########################################################################
  1464.  
  1465. SRC1 =    main.c option.c prim.c ch.c position.c input.c output.c 
  1466. SRC2 =    screen.c prompt.c line.c signal.c os.c help.c ttyin.c command.c version.c
  1467. SRC =    $(SRC1) $(SRC2)
  1468. OBJ =    main.o option.o prim.o ch.o position.o input.o output.o screen.o \
  1469.     prompt.o line.o signal.o os.o help.o ttyin.o command.o version.o
  1470.  
  1471.  
  1472. ##########################################################################
  1473. # Rules
  1474. ##########################################################################
  1475.  
  1476. DEFS =    "-DTERMIO=$(TERMIO)" \
  1477.     "-DSIGSETMASK=$(SIGSETMASK)" \
  1478.     "-Doffset_t=$(offset_t)" "-DVOID=$(VOID)" \
  1479.     "-DREGCMP=$(REGCMP)" "-DRECOMP=$(RECOMP)" \
  1480.     "-DSHELL_ESCAPE=$(SHELL_ESCAPE)" \
  1481.     "-DEDITOR=$(EDITOR)" "-DEDIT_PGM=\"$(EDIT_PGM)\"" \
  1482.     "-DHELPFILE=\"$(HELPFILE)\"" \
  1483.     "-DLOGFILE=$(LOGFILE)" \
  1484.     "-DONLY_RETURN=$(ONLY_RETURN)" \
  1485.     "-DGLOB=$(GLOB)" \
  1486.     "-DSTAT=$(STAT)" \
  1487.     "-DPERROR=$(PERROR)" \
  1488.     "-DXENIX=$(XENIX)"
  1489.  
  1490. CFLAGS = $(OPTIM) $(DEFS)
  1491.  
  1492.  
  1493. all: less
  1494.  
  1495. less: $(OBJ)
  1496.     $(CC) $(LDFLAGS) $(OPTIM) -o less $(OBJ) $(LIBS)
  1497.  
  1498. # install: install_less install_help install_man
  1499. install: install_less install_help
  1500.  
  1501. install_less: less
  1502.     for f in $(INSTALL_LESS); do  rm -f $$f; cp less $$f;  done
  1503.     touch install_less
  1504.  
  1505. install_help: less.help
  1506.     for f in $(INSTALL_HELP); do  rm -f $$f; cp less.help $$f;  done
  1507.     touch install_help
  1508.  
  1509. install_man: $(MANUAL)
  1510.     for f in $(INSTALL_MAN); do  rm -f $$f; cp $(MANUAL) $$f;  done
  1511.     touch install_man
  1512.  
  1513. $(OBJ): less.h funcs.h
  1514.  
  1515. # help.o depends on makefile for the definition of HELPFILE.
  1516. help.o: makefile
  1517.  
  1518. lint:
  1519.     lint -hp $(DEFS) $(SRC)
  1520.  
  1521. newfuncs:
  1522.     mv funcs.h funcs.h.OLD
  1523.     awk -f mkfuncs.awk $(SRC) >funcs.h
  1524.  
  1525. clean:
  1526.     rm -f $(OBJ) less
  1527.  
  1528. clobber:
  1529.     rm -f *.o less install_less install_man install_help
  1530.  
  1531. shar:
  1532.     shar -v install less.man makefile.* > less.shar.a
  1533.     shar -v less.nro $(SRC1) > less.shar.b
  1534.     shar -v README less.help *.h *.awk $(SRC2) > less.shar.c
  1535. _SHAR_EOF_
  1536.  
  1537.  
  1538. -- 
  1539.  
  1540. Rich $alz
  1541. Cronus Project, BBN Labs            rsalz@bbn.com
  1542. Moderator, comp.sources.unix            sources@uunet.uu.net
  1543.