home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / xinetd-2.1.1 / part26 / compile-src
Encoding:
Text File  |  1993-06-27  |  16.6 KB  |  682 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  5. #
  6.  
  7. #
  8. # $Id: compile-src,v 6.8 1993/06/17 16:56:30 panos Exp $
  9. #
  10.  
  11. script_name=`basename $0`
  12.  
  13. if test "$script_name" != "$0" -a "./$script_name" != "$0" ; then
  14.    echo This script must be executed from the top level directory 
  15.    exit 1
  16. fi
  17.  
  18. #
  19. # The order with which the libraries are listed is important.
  20. # It is also a problem; to understand why consider this:
  21. #        Library A depends (uses some functions from) library B
  22. #        Then, B must be compiled and installed before A so that
  23. #        A can find B's include files at the standard place.
  24. #        But when linking the program with A and B, if B precedes A
  25. #        then none of B's code will be included since nobody has yet
  26. #        tried to use it (since has not been encountered yet).
  27. #
  28. # Our solution is to list the libraries in the order they are compiled
  29. # and while compiling them also generate the reverse list which is the
  30. # order they have to be linked.
  31. #
  32. mandatory_libs="sio misc pset xlog str"
  33. optional_libs="pq timer"
  34.  
  35. catch_sigs="2 15"
  36. inc=/usr/include
  37.  
  38. #
  39. # The value of ccopt is used for setting the DEBUG makefile variable.
  40. # Therefore, it can be used to either enable debugging support (i.e. -g),
  41. # profiling support (i.e. -pg), or optimization support (i.e. -O)
  42. # The default is optimization.
  43. #
  44. ccopt=-O
  45.  
  46. while test $# -gt 0
  47. do
  48.     option=$1 ; shift
  49.     case $option in
  50.         -libc)
  51.                 if test $# -eq 0 ; then
  52.                     echo "Argument missing. Exiting..."
  53.                     exit 1
  54.                 fi
  55.                 libc=$1
  56.                 shift
  57.                 if test ! -r $libc ; then
  58.                     echo "File is not readable: $libc"
  59.                     exit 1
  60.                 fi
  61.                 ;;
  62.  
  63.         -signals)
  64.                 if test $# -eq 0 ; then
  65.                     echo "Argument missing. Exiting..."
  66.                     exit 1
  67.                 fi
  68.                 signal_handling=$1
  69.                 shift
  70.                 ;;
  71.  
  72.         -ccopt)
  73.                 if test $# -eq 0 ; then
  74.                     echo "Argument missing. Exiting..."
  75.                     exit 1
  76.                 fi
  77.                 ccopt=$1
  78.                 shift
  79.                 ;;
  80.  
  81.         -os)
  82.                 if test $# -eq 0 ; then
  83.                     echo "Argument missing. Exiting..."
  84.                     exit 1
  85.                 fi
  86.                 osversion=$1 ;
  87.                 shift
  88.                 ;;
  89.         
  90.         -auto)
  91.                 autoconfig=yes
  92.                 ;;
  93.  
  94.         -sf|-cf)
  95.                 if test $# -eq 0 ; then
  96.                     echo "Missing argument to $option. Exiting..."
  97.                     exit 1
  98.                 fi
  99.                     
  100.                 if test "$option" = "-sf" ; then
  101.                     v=yes
  102.                 else
  103.                     v=no
  104.                 fi
  105.  
  106.                 specified_flags=yes
  107.                 flag=$1
  108.                 shift
  109.  
  110.                 #
  111.                 # The first 2 lines are for xinetd.
  112.                 # The 3rd line has to do with the man pages (xinetd and libraries)
  113.                 # The rest of the lines are for the libraries
  114.                 #
  115.                 case "$flag" in
  116.                     old_wait|no_rpc|no_termios|no_posix_types)    eval $flag=$v ;;
  117.                     no_siglist)                                                eval $flag=$v ;;
  118.                     has_SB)                                                    eval $flag=$v ;;
  119.                     old_dir|no_ftw|no_timers|no_syslog)                eval $flag=$v ;;
  120.                     has_mmap|has_memops|has_bcopy)                  eval $flag=$v ;;
  121.                     has_isatty|has_bsdtty|has_sysvtty)              eval $flag=$v ;;
  122.                     has_onexit|has_atexit)                          eval $flag=$v ;;
  123.                     *)    echo "Bad flag name: $flag. Exiting..." ; exit 1
  124.                 esac
  125.                 ;;
  126.  
  127.         -custom)
  128.                 custom=yes
  129.                 ;;
  130.  
  131.         -verbose)
  132.                 verbose=yes
  133.                 ;;
  134.         #
  135.         # THIS IS THE SCRIPT DOCUMENTATION
  136.         #
  137.         -help)
  138.             echo "Usage: $script_name [options]"
  139.             echo "Options:"
  140.             echo "   -libc pathname : specifies the location of the C library"
  141.             echo "   -signals type  : type of signal handling"
  142.             echo "   -os osname     : specifies the OS name and version"
  143.             echo "   -auto          : automatic configuration"
  144.             echo "   -verbose       : display info about configuration"
  145.             echo "   -custom        : there is a custom xinetd configuration file"
  146.             echo "   -ccopt option  : option should be either -g for debugging"
  147.             echo "                    or -O for optimization"
  148.             echo "Possible arguments to -signals:"
  149.             echo "         posix, bsd, simple"
  150.             echo "Possible arguments to -os:"
  151.             echo "        sunos4, ultrix4"
  152.             echo "The -sf and -cf options set or clear flags that specify"
  153.             echo "what facilities are available from the operating system"
  154.             echo "Only one flag can be specified per -sf/-cf but these options"
  155.             echo "can be used multiple times."
  156.             echo "Available flags:"
  157.          echo "   no_timers      : BSD-type timers are not available"
  158.          echo "   no_rpc         : system does not support RPC"
  159.          echo "   no_termios     : termios(3) is not available"
  160.          echo "   no_siglist     : sys_siglist(3) is not available"
  161.          echo "   no_ftw         : ftw(3) is not available"
  162.          echo "   no_syslog      : syslog(3) is not available"
  163.          echo "   no_posix_types : POSIX types are not available"
  164.          echo "   has_isatty     : isatty(3) is available"
  165.          echo "   has_bsdtty     : system has BSD-type tty interface"
  166.          echo "   has_sysvtty    : system has SysV-type tty interface"
  167.          echo "   has_mmap       : mmap(2) is available"
  168.          echo "   has_memops     : memops(3) functions are available"
  169.          echo "   has_bcopy      : bcopy(3) is available"
  170.          echo "   has_onexit     : onexit(3) is available"
  171.          echo "   has_atexit     : atexit(3) is available"
  172.          echo "   old_wait       : wait(2) expects a 'union wait' argument"
  173.          echo "   old_dir        : old directory(3) package"
  174.          echo "   has_SB         : system supports .SB in man pages"
  175.          echo
  176.             echo "You can use the -os option to specify an operating system"
  177.             echo "and then you can use -sf/-cf for further mods."
  178.             exit 2
  179.             ;;
  180.  
  181.         *) echo "Bad argument: $1. Exiting..." ; exit 1
  182.     esac
  183. done
  184.  
  185. if test "$autoconfig" -a "$osversion" ; then
  186.     echo "Only one of -auto, -os can be specified"
  187.     exit 1
  188. fi
  189.  
  190. if test ! "$osversion" -a ! "$autoconfig" ; then
  191.     echo "I need to know the operating system you are using and the version."
  192.     echo "I know about"
  193.     echo "   SunOS 4.x (sunos4)"
  194.     echo "   Ultrix 4.x (ultrix4)"
  195.     echo "If your OS is among these, use the name in the parentheses, otherwise"
  196.     echo "just hit <return> and I will try to figure out how to properly"
  197.     echo -n "configure xinetd for your system --> "
  198.     read osversion
  199. fi
  200.  
  201. #
  202. # This if statement checks if we have a known osversion.
  203. # If we don't, we set the autoconfig flag.
  204. #
  205. if test "$osversion" ; then
  206.     case $osversion in
  207.         sunos4|ultrix4)
  208.             autoconfig= 
  209.             signal_handling=bsd
  210.             ;;
  211.         *) echo "I don't know anything about this OS. Exiting..." ; exit 1
  212.     esac
  213. else
  214.     autoconfig=yes
  215. fi
  216.  
  217. #
  218. # Get namelist of C library
  219. #
  220. if test "$autoconfig" ; then
  221.     echo "Obtaining name list of C library"
  222.  
  223.     if test ! "$libc" ; then
  224.         if test -r /lib/libc.a ; then
  225.             libc=/lib/libc.a
  226.         else
  227.             if test -r /usr/lib/libc.a ; then
  228.                 libc=/usr/lib/libc.a
  229.             else
  230.                 echo -n "Please give me the pathname of the C library -> "
  231.                 read libc
  232.                 if test ! "$libc" -o ! -r "$libc" ; then
  233.                     echo "Bad pathname. Exiting..."
  234.                     exit 1
  235.                 fi
  236.             fi
  237.         fi
  238.     fi
  239.     nmfile=/tmp/libc.nm.$$
  240.     nm $libc > $nmfile 2>/dev/null
  241.     if test $? -ne 0 ; then
  242.         if test ! -s $nmfile ; then
  243.             echo "Couldn't get the namelist of C library. Exiting..."
  244.             rm -f $nmfile
  245.             exit 1
  246.         else        # name list file is not empty
  247.             echo "WARNING: The 'nm' command returned a non-zero exit status"
  248.             echo "WARNING: so the namelist obtained from the C library may be incomplete"
  249.             echo "Continuing with auto-configuration"
  250.         fi
  251.     fi
  252. fi
  253.  
  254. if test "$specified_flags" -o "$autoconfig" ; then
  255.     lib_defs=
  256.     xinetd_defs=
  257.  
  258.     #
  259.     # Determine supported signal handing
  260.     #
  261.     if test "$autoconfig" -a ! "$signal_handling" ; then
  262.         if test "$verbose" ; then echo "Looking for sigaction" ; fi
  263.         found=`grep sigaction $nmfile | grep T`
  264.         if test "$found" ; then
  265.             signal_handling=posix
  266.         else
  267.             if test "$verbose" ; then echo "Looking for sigvec" ; fi
  268.             found=`grep sigvec $nmfile | grep T`
  269.             if test "$found" ; then 
  270.                 signal_handling=bsd
  271.             else
  272.                 signal_handling=simple
  273.             fi
  274.         fi
  275.     fi
  276.  
  277.     case "$signal_handling" in
  278.         posix)    v= ;;
  279.         bsd)        v="-DNO_POSIX_SIGS" ;;
  280.         simple)    v="-DNO_POSIX_SIGS -DNO_SIGVEC" ;;
  281.     esac
  282.     xinetd_defs="$xinetd_defs $v"
  283.  
  284.     #
  285.     # Check for setitimer(2)
  286.     #
  287.     case "$no_timers" in
  288.         yes)    v=-DNO_TIMERS ;;
  289.         no)    v= ;;
  290.         *)
  291.                 if test "$autoconfig" ; then
  292.                     if test "$verbose" ; then echo "Looking for setitimer" ; fi
  293.                     found=`grep setitimer $nmfile | grep T`
  294.                     if test ! "$found" ; then v=-DNO_TIMERS ; else v= ; fi
  295.                 else
  296.                     v=
  297.                 fi
  298.     esac
  299.     xinetd_defs="$xinetd_defs $v"
  300.  
  301.     #
  302.     # Check for sys_siglist
  303.     #
  304.     case "$no_siglist" in
  305.         yes)    v=-DNO_SIGLIST ;;
  306.         no)    v= ;;
  307.         *)
  308.                 if test "$autoconfig" ; then
  309.                     if test "$verbose" ; then echo "Looking for sys_siglist" ; fi
  310.                     found=`grep sys_siglist $nmfile | grep D`
  311.                     if test ! "$found" ; then v=-DNO_SIGLIST ; else v= ; fi
  312.                 else
  313.                     v=
  314.                 fi
  315.     esac
  316.     xinetd_defs="$xinetd_defs $v"
  317.  
  318.     #
  319.     # Check for RPC
  320.     #
  321.     case "$no_rpc" in
  322.         yes)    v=-DNO_RPC ;;
  323.         no)    v= ;;
  324.         *)
  325.                 if test "$autoconfig" ; then
  326.                     if test "$verbose" ; then echo "Looking for RPC" ; fi
  327.                     found=`grep rpcent $inc/netdb.h`
  328.                     if test ! "$found" ; then v=-DNO_RPC ; else v= ; fi
  329.                 else
  330.                     v=
  331.                 fi
  332.     esac
  333.     xinetd_defs="$xinetd_defs $v"
  334.  
  335.     #
  336.     # Check if this system supports the old wait
  337.     #
  338.     case "$old_wait" in
  339.         yes)    v=-DOLD_WAIT ;;
  340.         no)    v= ;;
  341.         *)
  342.             if test "$autoconfig" ; then
  343.                 if test "$verbose" ; then echo "Looking for WEXITSTATUS" ; fi
  344.                 found=`grep WEXITSTATUS $inc/sys/wait.h`
  345.                 if test ! "$found" ; then v=-DOLD_WAIT ; else v= ; fi
  346.             else
  347.                 v=
  348.             fi
  349.     esac
  350.     xinetd_defs="$xinetd_defs $v"
  351.  
  352.     #
  353.     # Check for pid_t
  354.     # 
  355.     case "$no_posix_types" in
  356.         yes)    v=-DNO_POSIX_TYPES ;;
  357.         no)    v= ;;
  358.         *)
  359.             if test "$autoconfig" ; then
  360.                 if test "$verbose" ; then echo "Looking for pid_t" ; fi
  361.                 found=`cd $inc/sys ; grep pid_t *.h | grep typedef`
  362.                 if test ! "$found" ; then v=-DNO_POSIX_TYPES ; else v= ; fi
  363.             else
  364.                 v=
  365.             fi
  366.     esac
  367.     xinetd_defs="$xinetd_defs $v"
  368.  
  369.     #
  370.     # Check for termios
  371.     #
  372.     case "$no_termios" in
  373.         yes)    v=-DNO_TERMIOS ;;
  374.         no)    v= ;;
  375.         *)
  376.             if test "$autoconfig" ; then
  377.                 if test -r $inc/sys/termios.h -o -r $inc/termios.h ; then
  378.                     v=
  379.                 else
  380.                     v=-DNO_TERMIOS
  381.                 fi
  382.             else
  383.                 v=
  384.             fi
  385.     esac
  386.     xinetd_defs="$xinetd_defs $v"
  387.  
  388.     #
  389.     # Check for new directory types
  390.     #
  391.     case "$old_dir" in
  392.         yes)    v=-DOLD_DIR ;;
  393.         no)    v= ;;
  394.         *)
  395.                 if test "$autoconfig" ; then
  396.                     if test -r $inc/dirent.h ; then
  397.                         v=
  398.                     else
  399.                         v=-DOLD_DIR
  400.                     fi
  401.                 else
  402.                     v=
  403.                 fi
  404.     esac
  405.     lib_defs="$lib_defs $v"
  406.  
  407.     #
  408.     # Check for ftw(3)
  409.     #
  410.     case "$no_ftw" in
  411.         yes)    v=-D__FTWX_NO_FTW ;;
  412.         no)    v= ;;
  413.         *)
  414.                 if test "$autoconfig" ; then
  415.                     if test -r $inc/ftw.h ; then 
  416.                         v=
  417.                     else
  418.                         v=-D__FTWX_NO_FTW
  419.                     fi
  420.                 else
  421.                     v=
  422.                 fi
  423.     esac
  424.     lib_defs="$lib_defs $v"
  425.  
  426.     #
  427.     # Check for syslog(3)
  428.     #
  429.     case "$no_syslog" in
  430.         yes)    v=-DNO_SYSLOG ;;
  431.         no)    v= ;;
  432.         *)
  433.                 if test "$autoconfig" ; then
  434.                     if test "$verbose" ; then echo "Looking for syslog" ; fi
  435.                     found=`grep syslog $nmfile | grep T`
  436.                     if test ! "$found" ; then v=-DNO_SYSLOG ; else v= ; fi
  437.                 else
  438.                     v=
  439.                 fi
  440.     esac
  441.     lib_defs="$lib_defs $v"
  442.  
  443.     #
  444.     # Check for mmap. Since it is not required, we do not try to find
  445.     # if the system supports it.
  446.     #
  447.     case "$has_mmap" in
  448.         yes)  v=-DHAS_MMAP ;;
  449.         *)    v= ;;
  450.     esac
  451.     lib_defs="$lib_defs $v"
  452.  
  453.    case "$has_onexit" in
  454.       yes)  v=-DHAS_ONEXIT ;;
  455.       no)   v= ;;
  456.       *)
  457.             if test "$autoconfig" ; then
  458.                if test "$verbose" ; then echo "Looking for on_exit" ; fi
  459.                found=`grep on_exit $nmfile | grep T`
  460.                if test "$found" ; then v=-DHAS_ONEXIT ; else v= ; fi
  461.             else
  462.                v=
  463.             fi
  464.    esac
  465.    lib_defs="$lib_defs $v"
  466.  
  467.    case "$has_atexit" in
  468.       yes)  v=-DHAS_ATEXIT ;;
  469.       no)   v= ;;
  470.       *)
  471.             if test "$autoconfig" ; then
  472.                if test "$verbose" ; then echo "Looking for atexit" ; fi
  473.                found=`grep atexit $nmfile | grep T`
  474.                if test "$found" ; then v=-DHAS_ATEXIT ; else v= ; fi
  475.             else
  476.                v=
  477.             fi
  478.    esac
  479.    lib_defs="$lib_defs $v"
  480.  
  481.    case "$has_memops" in
  482.       yes)  v=-DHAS_MEMOPS ;;
  483.       no)   v= ;;
  484.       *)
  485.             if test "$autoconfig" ; then
  486.                if test "$verbose" ; then echo "Looking for memcpy" ; fi
  487.                found=`grep memcpy $nmfile | grep T`
  488.                if test "$found" ; then v=-DHAS_MEMOPS ; else v= ; fi
  489.             else
  490.                v=
  491.             fi
  492.    esac
  493.    lib_defs="$lib_defs $v"
  494.  
  495.    case "$has_bcopy" in
  496.       yes)  v=-DHAS_BCOPY ;;
  497.       no)   v= ;;
  498.       *)
  499.             if test "$autoconfig" ; then
  500.                if test "$verbose" ; then echo "Looking for bcopy" ; fi
  501.                found=`grep bcopy $nmfile | grep T`
  502.                if test "$found" ; then v=-DHAS_BCOPY ; else v= ; fi
  503.             else
  504.                v=
  505.             fi
  506.    esac
  507.    lib_defs="$lib_defs $v"
  508.  
  509.    case "$has_isatty" in
  510.       yes)  v=-DHAS_ISATTY ;;
  511.       no)   v= ;;
  512.       *)
  513.             if test "$autoconfig" ; then
  514.                if test "$verbose" ; then echo "Looking for isatty" ; fi
  515.                found=`grep bcopy $nmfile | grep T`
  516.                if test "$found" ; then v=-DHAS_ISATTY ; else v= ; fi
  517.             else
  518.                v=
  519.             fi
  520.    esac
  521.    #
  522.    # Since SIO cannot compile without the isatty function, if isatty is not
  523.    # in the C library, we have to provide our own. For this, we need to know
  524.    # if the system supports BSD or SysV tty handling.
  525.    #
  526.    if test ! "$osversion" -a ! "$v" ; then
  527.       while test ! "$v"
  528.       do
  529.          echo "Is your OS based on System V or on BSD 4.x ? I am really"
  530.          echo -n "interested in terminal handling. You can say sysv or bsd -->"
  531.          read ans
  532.          case $ans in
  533.             sysv) v=-DHAS_SYSVTTY ;;
  534.             bsd)  v=-DHAS_BSDTTY ;;
  535.             *) echo "Please say either 'sysv' or 'bsd'"
  536.          esac
  537.       done
  538.    fi
  539.    lib_defs="$lib_defs $v"
  540. fi
  541.  
  542. if test "$autoconfig" ; then
  543.     rm -f $nmfile
  544. fi
  545.  
  546. #
  547. # If we know the OS, we can provide the appropriate flags for SIO
  548. #
  549. case "$osversion" in
  550.    sunos4) sio_defs="-DHAS_MMAP -DHAS_ONEXIT -DHAS_MEMOPS -DHAS_ISATTY" ;;
  551.    ultrix4) sio_defs="-DHAS_MEMOPS -DHAS_ATEXIT -DHAS_ISATTY" ;;
  552.    *) sio_defs="$lib_defs"
  553. esac
  554.  
  555. case "$no_timers" in
  556.     yes) lib_names="$mandatory_libs" ;;
  557.     *)
  558.         case "$signal_handling" in
  559.             posix)    lib_names="$mandatory_libs $optional_libs" ;;
  560.             bsd)        lib_names="$mandatory_libs $optional_libs"
  561.                         lib_defs="$lib_defs -DNO_POSIX_SIGS"
  562.                         ;;
  563.             *)            lib_names="$mandatory_libs"
  564.         esac
  565. esac
  566.  
  567. PWD=`pwd`
  568.  
  569. incdir=$PWD/libs/include
  570. mandir=$PWD/libs/man
  571. libdir=$PWD/libs/lib
  572.  
  573. #
  574. # Only Suns undestand .SB in man pages, so if we are not dealing with
  575. # a Sun we replace .SB with .B
  576. #
  577. if test "$osversion" = "sunos4" ; then
  578.     modify_manpages=
  579. else
  580.     case "$has_SB" in
  581.         yes) modify_manpages= ;;
  582.         no)  modify_manpages=yes ;;
  583.         *)
  584.         echo -n "Can your machine handle .SB in a man page ? (if you are not sure, say no) -->"
  585.         read x
  586.         if test "$x" = "n" -o "$x" = "no" ; then
  587.             modify_manpages=yes
  588.         else
  589.             modify_manpages=
  590.         fi
  591.     esac
  592. fi
  593.  
  594. if test "$modify_manpages" ; then
  595.     #
  596.     # We can't take any interrupts while processing the manpages
  597.     #
  598.     trap 'interrupt_occured=yes' $catch_sigs
  599.  
  600.     echo "Replacing .SB in library man pages with .B (if a man page is changed"
  601.     echo "the original will be kept by appending .orig to its name)"
  602.     for i in $lib_names
  603.     do
  604.         cd $PWD/libs/src/$i
  605.         for i in *.3
  606.         do
  607.             mv $i $i.orig                                            # save the original
  608.             sed 's/[.]SB/.B/' $i.orig > $i                    # do the replacement
  609.             cmp -s $i $i.orig                                        # are they the same ?
  610.             if test $? -eq 0 ; then rm $i.orig ; fi        # if yes, remove the copy
  611.         done
  612.         if test "$interrupt_occured" = "yes" ; then
  613.             echo "Interrupt: quiting"
  614.             exit 1
  615.         fi
  616.     done
  617.  
  618.     trap $catch_sigs        # no more trapping
  619. fi
  620.  
  621. #
  622. # Make the libraries
  623. # Also prepare the value of the LIBS variable in the xinetd Makefile
  624. #
  625. mvars="DEBUG=$ccopt MANDIR=$mandir INCLUDEDIR=$incdir LIBDIR=$libdir"
  626. for i in $lib_names
  627. do
  628.     libs="-l$i $libs"
  629.     cd $PWD/libs/src/$i
  630.     echo Making library: $i
  631.     #
  632.     # Remove the archive if it is already there; this is to avoid ld complaints
  633.     # that the table of contents is out of date.
  634.     #
  635.     rm -f lib$i.a
  636.     if test "$i" = "sio" ; then
  637.         make $mvars DEFS="$sio_defs" install
  638.     else
  639.         make $mvars DEFS="$lib_defs" install
  640.     fi
  641.     if test $? -ne 0 ; then
  642.         echo "Failed to create library: $i"
  643.         exit 2
  644.     fi
  645. done
  646.  
  647. #
  648. # Now make xinetd
  649. # We remove the xinetd executable, if there is one, in case the libraries
  650. # have changed
  651. #
  652. cd $PWD/xinetd
  653. rm -f xinetd
  654. mvars="DEBUG=$ccopt INCLUDEDIR=-I$incdir LDFLAGS=-L$libdir"
  655. if test "$custom" ; then xinetd_defs="$xinetd_defs -DCUSTOMCONF" ; fi
  656. make "DEFS=$xinetd_defs" "LIBS=$libs" $mvars
  657. if test $? -ne 0 ; then
  658.     echo Failed to create xinetd
  659.     exit 2
  660. fi
  661.  
  662. if test "$modify_manpages" ; then
  663.  
  664.     trap 'interrupt_occured=yes' $catch_sigs
  665.  
  666.     echo "Replacing .SB in xinetd man pages with .B"
  667.     for i in *.man
  668.     do
  669.         mv $i $i.orig
  670.         sed 's/[.]SB/.B/' $i.orig > $i
  671.         cmp -s $i $i.orig                                        # are they the same ?
  672.         if test $? -eq 0 ; then rm $i.orig ; fi        # if yes, remove the copy
  673.  
  674.         if test "$interrupt_occured" = "yes" ; then
  675.             echo "Interrupt: quiting"
  676.             exit 1
  677.         fi
  678.     done
  679.     trap $catch_sigs        # no more trapping
  680. fi
  681.  
  682.