📄 linstall
字号:
#! /bin/sh# 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 "as will the file \"defines.h\"."echo "Press RETURN to continue."read ansecho "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 ansECHO=./vechoif [ ! -f $ECHO ]then echo "One moment..." cc -o $ECHO vecho.c echo ""fi$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 ansxenix=0case "X$ans" inX1) 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 ""DATE=`date`cat >makefile <<EOF# Makefile for "less"# Generated $DATE by $0.EOFcat >>makefile <<"EOF"## 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".SHELL = /bin/shEOFcat >defines.h <<EOF/* Definition file for less *//* Generated $DATE by $0. */EOFcat >>defines.h <<EOF/* * Define XENIX if running under XENIX 3.0. */#define XENIX $xenixEOF$ECHO ""if [ "X$sys" = "Xunknown" ]then alldefault=0else 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 ""fiif [ $alldefault = 0 ]then alloptional=0else def=yes alloptional=1 $ECHO "Do you want to use all the optional features of less?" $ECHO " Less has several features which you may or may not" $ECHO " wish to include, such as shell escapes." $ECHO " Enter \"yes\" if you want to include ALL the optional features." $ECHO " Enter \"no\" if you want to select individual features. [$def] \c" read ans case "X$ans" in X[yY]*) alloptional=1 ;; X[nN]*) alloptional=0 ;; esac $ECHO ""fidef=yesx=1if [ $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 ""ficat >>defines.h <<EOF/* * VOID is 1 if your C compiler supports the "void" type, * 0 if it does not. */#define VOID $xEOFdef=yesx="void *"if [ $alldefault = 0 ]then $ECHO "Does your C compiler support the \"void *\" type? [$def] \c" read ans case "X$ans" in X[yY]*) x="void *" ;; X[nN]*) x="char *" ;; esac $ECHO ""ficat >>defines.h <<EOF/* * VOID_POINTER is the definition of a pointer to any object. */#define VOID_POINTER $xEOFdef=longif [ $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 ""ficat >>defines.h <<EOF/* * offset_t is the type which lseek() returns. * It is also the type of lseek()'s second argument. */#define offset_t $defEOFdef=yes; x=1if [ $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 ""ficat >>defines.h <<EOF/* * STAT is 1 if your system has the stat() call. */#define STAT $xEOFdef=yes; x=1if [ $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 ""ficat >>defines.h <<EOF/* * PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */#define PERROR $xEOFdef=yes; x=1if [ $alldefault = 0 ]then $ECHO "Most Unix systems provide the time() function." $ECHO "Does your system have time()? [$def] \c" read ans case "X$ans" in X[yY]*) x=1 ;; X[nN]*) x=0 ;; esac $ECHO ""ficat >>defines.h <<EOF/* * GET_TIME is 1 if your system has the time() call. */#define GET_TIME $xEOFif [ $x = 0 ]then $ECHO "What is the APPROXIMATE performance of your" $ECHO "machine, as a percentage of a Vax 11/750?" $ECHO "(Enter 100 if your machine is as fast as a Vax," $ECHO " 50 if it is half as fast, 200 if it is twice as fast, etc.)" $ECHO "The accuracy of this information is not critical." while : do $ECHO "Percent of Vax 11/750 [100]: \c" read ans if [ "X$ans" = "X" ] then ans=100 fi longloop=`expr "$ans" "*" 3` if [ $? = 0 ] then break fi $ECHO "Enter a number please!" done $ECHO "" cat >>defines.h <<EOF/* * LONGLOOP is the number of lines we should process in the line number * scan before displaying a warning that it will take a while. */#define LONGLOOP ($longloop)EOFfiif [ "$sys" = "bsd" ]then def=no; x=0else def=yes; x=1fiif [ $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 ""ficat >>defines.h <<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. */#define TERMIO $xEOFif [ "$sys" = "bsd" -a "$bsd41" = "0" ]then def=yes; x=1else def=no; x=0fiif [ $alldefault = 0 ]then $ECHO "Most BSD 4.2 and 4.3 systems have both _setjmp() and setjmp()." $ECHO "Most System V and BSD 4.1 systems have only setjmp()." $ECHO "Does your system have both _setjmp() and setjmp()? [$def] \c" read ans case "X$ans" in X[yY]*) x=1 ;; X[nN]*) x=0 ;; esac $ECHO ""ficat >>defines.h <<EOF/* * HAS__SETJMP is 1 if your system has the _setjmp() call. * This is normally the case only for BSD 4.2 and up, * not for BSD 4.1 or System 5. */#define HAS__SETJMP $xEOFif [ "$sys" = "bsd" -a "$bsd41" = "0" ]then def=yes; x=1else def=no; x=0fiif [ $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 ""ficat >>defines.h <<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. */#define SIGSETMASK $xEOFif [ "$sys" = "sys5" -a "$xenix" = "0" ]then def=yes; x=1else def=no; x=0fiif [ $alldefault = 0 ]then $ECHO "Some SCO System V systems need sys/ptem.h included to get" $ECHO "the size of the screen (struct winsize)." $ECHO "Does your system need sys/ptem.h? [$def] \c" read ans case "X$ans" in X[yY]*) x=1 ;; X[nN]*) x=0 ;; esac $ECHO ""ficat >>defines.h <<EOF/* * NEED_PTEM_H is 1 if your system needs sys/ptem.h to declare struct winsize. * This is normally the case only for SCOs System V. */#define NEED_PTEM_H $xEOFif [ "$sys" = "bsd" ]then def=2; REGCMP=0;RECOMP=1else def=1; REGCMP=1;RECOMP=0fiif [ $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:"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -