home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-16 | 45.8 KB | 1,727 lines |
- Newsgroups: comp.sources.unix
- From: dickey@clark.net (T.E.Dickey)
- Subject: v28i064: diffstat - compute histograms of diff output, Part01/01
- Message-id: <1.771829971.3595@gw.home.vix.com>
- Sender: unix-sources-moderator@gw.home.vix.com
- Approved: vixie@gw.home.vix.com
-
- Submitted-By: dickey@clark.net (T.E.Dickey)
- Posting-Number: Volume 28, Issue 64
- Archive-Name: diffstat/part01
-
- This program is a simple filter that reads the output of the 'diff' program,
- and produces a histogram of the total number of lines that were changed. It
- is useful for scanning a patch file to see which files were changed.
-
- #!/bin/sh
- # This is diffstat, a shell archive (produced by shar 3.50)
- # To extract the files from this archive, save it to a file, remove
- # everything above the "!/bin/sh" line above, and type "sh file_name".
- #
- # made 06/15/1994 00:31 UTC by tom@dickey_ppp
- # Source directory /home/tom/src/misc/diffstat
- #
- # existing files will NOT be overwritten unless -c is specified
- #
- #
- #
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 24898 -rwxr-xr-x configure
- # 299 -r--r--r-- README
- # 8620 -r--r--r-- diffstat.c
- # 2467 -r--r--r-- diffstat.1
- # 249 -r--r--r-- config_h.in
- # 649 -r-xr-xr-x mkdirs.sh
- # 2152 -r--r--r-- makefile.in
- # 753 -r--r--r-- configure.in
- #
- TOUCH=true
- rm -f 1231235999
- if touch -am 1231235999 1231235970
- then
- if test -f 1231235970 -a ! -f 1231235999
- then TOUCH=touch
- fi
- fi
- rm -f 1231235999 1231235970
- if test -r _shar_seq_.tmp; then
- echo 'Must unpack archives in sequence!'
- echo Please unpack part `cat _shar_seq_.tmp` next
- exit 1
- fi
- # ============= configure ==============
- if test -f 'configure' -a X"$1" != X"-c"; then
- echo 'x - skipping configure (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting configure (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'configure' &&
- #!/bin/sh
- # From configure.in Revision: 1.3
- X
- #!/bin/sh
- # Guess values for system-dependent variables and create Makefiles.
- # Generated automatically using autoconf version 1.11
- # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
- X
- # This configure script is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License as published
- # by the Free Software Foundation; either version 2, or (at your option)
- # any later version.
- X
- # This script is distributed in the hope that it will be useful, but
- # WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- # Public License for more details.
- X
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X
- # Save the original args to write them into config.status later.
- configure_args="$*"
- X
- # Only options that might do something get documented.
- ac_usage="Usage: configure [options] [host]
- Options: [defaults in brackets after descriptions]
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --exec-prefix=PREFIX install host dependent files in PREFIX [/usr/local]
- --help print this message
- --host=HOST configure for HOST [guessed]
- --prefix=PREFIX install host independent files in PREFIX [/usr/local]
- --quiet, --silent do not print \`checking for...' messages
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --target=TARGET configure for TARGET [TARGET=HOST]
- --verbose print results of checks
- --version print the version of autoconf that created configure
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR"
- X
- # Initialize some variables set by options.
- # The variables have the same names as the options, with
- # dashes changed to underlines.
- build=NONE
- exec_prefix=
- host=NONE
- no_create=
- nonopt=NONE
- norecursion=
- prefix=
- program_prefix=
- program_suffix=
- program_transform_name=
- silent=
- srcdir=
- target=NONE
- verbose=
- x_includes=
- x_libraries=
- X
- ac_prev=
- for ac_option
- do
- X
- X # If the previous option needs an argument, assign it.
- X if test -n "$ac_prev"; then
- X eval "$ac_prev=\$ac_option"
- X ac_prev=
- X continue
- X fi
- X
- X # Accept (but ignore some of) the important Cygnus configure
- X # options, so we can diagnose typos.
- X
- X case "$ac_option" in
- X -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- X *) ac_optarg= ;;
- X esac
- X
- X case "$ac_option" in
- X
- X -build | --build | --buil | --bui | --bu | --b)
- X ac_prev=build ;;
- X -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
- X build="$ac_optarg" ;;
- X
- X -disable-* | --disable-*)
- X ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- X # Reject names that aren't valid shell variable names.
- X if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- X echo "configure: $ac_feature: invalid feature name" >&2; exit 1
- X fi
- X ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- X eval "enable_${ac_feature}=no" ;;
- X
- X -enable-* | --enable-*)
- X ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- X # Reject names that aren't valid shell variable names.
- X if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- X echo "configure: $ac_feature: invalid feature name" >&2; exit 1
- X fi
- X ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- X case "$ac_option" in
- X *=*) ;;
- X *) ac_optarg=yes ;;
- X esac
- X eval "enable_${ac_feature}='$ac_optarg'" ;;
- X
- X # For backward compatibility, recognize -exec-prefix and --exec_prefix.
- X -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- X | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- X | --exec | --exe | --ex)
- X ac_prev=exec_prefix ;;
- X -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- X | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- X | --exec=* | --exe=* | --ex=*)
- X exec_prefix="$ac_optarg" ;;
- X
- X -gas | --gas | --ga | --g)
- X with_gas=yes ;; # Obsolete; use --with-gas.
- X
- X -help | --help | --hel | --he)
- X cat << EOF
- $ac_usage
- EOF
- X exit 0 ;;
- X
- X -host | --host | --hos | --ho)
- X ac_prev=host ;;
- X -host=* | --host=* | --hos=* | --ho=*)
- X host="$ac_optarg" ;;
- X
- X -nfp | --nfp | --nf)
- X with_fp=no ;; # Obsolete; use --without-fp.
- X
- X -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- X | --no-cr | --no-c)
- X no_create=yes ;;
- X
- X -norecursion | --norecursion | --norecursio | --norecursi \
- X | --norecurs | --norecur | --norecu | --norec | --nore | --nor)
- X norecursion=yes ;;
- X
- X -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- X ac_prev=prefix ;;
- X -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- X prefix="$ac_optarg" ;;
- X
- X -program-prefix | --program-prefix | --program-prefi | --program-pref \
- X | --program-pre | --program-pr | --program-p)
- X ac_prev=program_prefix ;;
- X -program-prefix=* | --program-prefix=* | --program-prefi=* \
- X | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- X program_prefix="$ac_optarg" ;;
- X
- X -program-suffix | --program-suffix | --program-suffi | --program-suff \
- X | --program-suf | --program-su | --program-s)
- X ac_prev=program_suffix ;;
- X -program-suffix=* | --program-suffix=* | --program-suffi=* \
- X | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- X program_suffix="$ac_optarg" ;;
- X
- X -program-transform-name | --program-transform-name \
- X | --program-transform-nam | --program-transform-na \
- X | --program-transform-n | --program-transform- \
- X | --program-transform | --program-transfor \
- X | --program-transfo | --program-transf \
- X | --program-trans | --program-tran \
- X | --progr-tra | --program-tr | --program-t)
- X ac_prev=program_transform_name ;;
- X -program-transform-name=* | --program-transform-name=* \
- X | --program-transform-nam=* | --program-transform-na=* \
- X | --program-transform-n=* | --program-transform-=* \
- X | --program-transform=* | --program-transfor=* \
- X | --program-transfo=* | --program-transf=* \
- X | --program-trans=* | --program-tran=* \
- X | --progr-tra=* | --program-tr=* | --program-t=*)
- X program_transform_name="$ac_optarg" ;;
- X
- X -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- X | -silent | --silent | --silen | --sile | --sil)
- X silent=yes ;;
- X
- X -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- X ac_prev=srcdir ;;
- X -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- X srcdir="$ac_optarg" ;;
- X
- X -target | --target | --targe | --targ | --tar | --ta | --t)
- X ac_prev=target ;;
- X -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- X target="$ac_optarg" ;;
- X
- X -v | -verbose | --verbose | --verbos | --verbo | --verb)
- X verbose=yes ;;
- X
- X -version | --version | --versio | --versi | --vers)
- X echo "configure generated by autoconf version 1.11"
- X exit 0 ;;
- X
- X -with-* | --with-*)
- X ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- X # Reject names that aren't valid shell variable names.
- X if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- X echo "configure: $ac_package: invalid package name" >&2; exit 1
- X fi
- X ac_package=`echo $ac_package| sed 's/-/_/g'`
- X case "$ac_option" in
- X *=*) ;;
- X *) ac_optarg=yes ;;
- X esac
- X eval "with_${ac_package}='$ac_optarg'" ;;
- X
- X -without-* | --without-*)
- X ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- X # Reject names that aren't valid shell variable names.
- X if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- X echo "configure: $ac_package: invalid package name" >&2; exit 1
- X fi
- X ac_package=`echo $ac_package| sed 's/-/_/g'`
- X eval "with_${ac_package}=no" ;;
- X
- X --x) with_x=yes ;; # Obsolete; use --with-x.
- X
- X -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- X | --x-incl | --x-inc | --x-in | --x-i)
- X ac_prev=x_includes ;;
- X -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- X | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- X x_includes="$ac_optarg" ;;
- X
- X -x-libraries | --x-libraries | --x-librarie | --x-librari \
- X | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- X ac_prev=x_libraries ;;
- X -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- X | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- X x_libraries="$ac_optarg" ;;
- X
- X -*) echo "configure: $ac_option: invalid option; use --help to show usage" >&2; exit 1
- X ;;
- X
- X *)
- X if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- X echo "configure: warning: $ac_option: invalid host type" >&2
- X fi
- X if test "x$nonopt" != xNONE; then
- X echo "configure: can only configure for one host and one target at a time" >&2; exit 1
- X fi
- X nonopt="$ac_option"
- X ;;
- X
- X esac
- done
- X
- if test -n "$ac_prev"; then
- X echo "configure: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" >&2; exit 1
- fi
- X
- trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
- trap 'rm -fr confdefs* $ac_clean_files' 0
- X
- # Save the original args if we used an alternate arg parser.
- ac_configure_temp="${configure_args-$*}"
- # Strip out --no-create and --norecursion so they don't pile up.
- configure_args=
- for ac_arg in $ac_configure_temp; do
- X case "$ac_arg" in
- X -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- X | --no-cr | --no-c) ;;
- X -norecursion | --norecursion | --norecursio | --norecursi \
- X | --norecurs | --norecur | --norecu | --norec | --nore | --nor) ;;
- X *) configure_args="$configure_args $ac_arg" ;;
- X esac
- done
- X
- # NLS nuisances.
- # These must not be set unconditionally because not all systems understand
- # e.g. LANG=C (notably SCO).
- if test "${LC_ALL+set}" = 'set'; then LC_ALL=C; export LC_ALL; fi
- if test "${LANG+set}" = 'set'; then LANG=C; export LANG; fi
- X
- # confdefs.h avoids OS command line length limits that DEFS can exceed.
- rm -rf conftest* confdefs.h
- # AIX cpp loses on an empty file, so make sure it contains at least a newline.
- echo > confdefs.h
- X
- # A filename unique to this package, relative to the directory that
- # configure is in, which we can look for to find out if srcdir is correct.
- ac_unique_file=diffstat.c
- X
- # Find the source files, if location was not specified.
- if test -z "$srcdir"; then
- X ac_srcdir_defaulted=yes
- X # Try the directory containing this script, then `..'.
- X ac_prog=$0
- X ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- X test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- X srcdir=$ac_confdir
- X if test ! -r $srcdir/$ac_unique_file; then
- X srcdir=..
- X fi
- fi
- if test ! -r $srcdir/$ac_unique_file; then
- X if test x$ac_srcdir_defaulted = xyes; then
- X echo "configure: can not find sources in ${ac_confdir} or .." >&2; exit 1
- X else
- X echo "configure: can not find sources in ${srcdir}" >&2; exit 1
- X fi
- fi
- ac_ext=c
- # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
- ac_cpp='${CPP}'
- ac_compile='${CC-cc} $CFLAGS $LDFLAGS conftest.${ac_ext} -o conftest $LIBS >/dev/null 2>&1'
- X
- X
- if test -z "$CC"; then
- X # Extract the first word of `gcc', so it can be a program name with args.
- X set ac_dummy gcc; ac_word=$2
- X test -n "$silent" || echo "checking for $ac_word"
- X IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- X for ac_dir in $PATH; do
- X test -z "$ac_dir" && ac_dir=.
- X if test -f $ac_dir/$ac_word; then
- X CC="gcc"
- X break
- X fi
- X done
- X IFS="$ac_save_ifs"
- fi
- test -z "$CC" && CC="cc"
- test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC"
- X
- # Find out if we are using GNU C, under whatever name.
- cat > conftest.c <<EOF
- #ifdef __GNUC__
- X yes
- #endif
- EOF
- ${CC-cc} -E conftest.c > conftest.out 2>&1
- if egrep yes conftest.out >/dev/null 2>&1; then
- X GCC=1 # For later tests.
- fi
- rm -f conftest*
- X
- # Make sure to not get the incompatible SysV /etc/install and
- # /usr/sbin/install, which might be in PATH before a BSD-like install,
- # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
- # or the AFS install, which mishandles nonexistent args, or
- # /usr/ucb/install on SVR4, which tries to use the nonexistent group
- # `staff', or /sbin/install on IRIX which has incompatible command-line
- # syntax. Sigh.
- #
- # On most BSDish systems install is in /usr/bin, not /usr/ucb
- # anyway.
- # This turns out not to be true, so the mere pathname isn't an indication
- # of whether the program works. What we really need is a set of tests for
- # the install program to see if it actually works in all the required ways.
- #
- # Avoid using ./install, which might have been erroneously created
- # by make from ./install.sh.
- if test -z "${INSTALL}"; then
- X test -n "$silent" || echo "checking for a BSD compatible install"
- X IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- X for ac_dir in $PATH; do
- X case "$ac_dir" in
- X ''|.|/etc|/sbin|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
- X *)
- X # OSF1 and SCO ODT 3.0 have their own names for install.
- X for ac_prog in installbsd scoinst install; do
- X if test -f $ac_dir/$ac_prog; then
- X if test $ac_prog = install &&
- X grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- X # AIX install. It has an incompatible calling convention.
- X # OSF/1 installbsd also uses dspmsg, but is usable.
- X :
- X else
- X INSTALL="$ac_dir/$ac_prog -c"
- X break 2
- X fi
- X fi
- X done
- X ;;
- X esac
- X done
- X IFS="$ac_save_ifs"
- fi
- X
- if test -z "$INSTALL"; then
- X # As a last resort, use the slow shell script.
- X for ac_dir in ${srcdir} ${srcdir}/.. ${srcdir}/../..; do
- X if test -f $ac_dir/install.sh; then
- X INSTALL="$ac_dir/install.sh -c"; break
- X fi
- X done
- fi
- if test -z "$INSTALL"; then
- X echo "configure: can not find install.sh in ${srcdir} or ${srcdir}/.. or ${srcdir}/../.." >&2; exit 1
- fi
- test -n "$verbose" && echo " setting INSTALL to $INSTALL"
- X
- # Use test -z because SunOS4 sh mishandles ${INSTALL_PROGRAM-'${INSTALL}'}.
- # It thinks the first close brace ends the variable substitution.
- test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
- test -n "$verbose" && echo " setting INSTALL_PROGRAM to $INSTALL_PROGRAM"
- X
- test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
- test -n "$verbose" && echo " setting INSTALL_DATA to $INSTALL_DATA"
- X
- test -n "$silent" || echo "checking how to run the C preprocessor"
- if test -z "$CPP"; then
- X # This must be in double quotes, not single quotes, because CPP may get
- X # substituted into the Makefile and ``${CC-cc}'' will simply confuse
- X # make. It must be expanded now.
- X CPP="${CC-cc} -E"
- X cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <stdio.h>
- Syntax Error
- EOF
- # Some shells (Coherent) do redirections in the wrong order, so need
- # the parens.
- ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- if test -z "$ac_err"; then
- X :
- else
- X rm -rf conftest*
- X CPP="${CC-cc} -E -traditional-cpp"
- X cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <stdio.h>
- Syntax Error
- EOF
- # Some shells (Coherent) do redirections in the wrong order, so need
- # the parens.
- ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- if test -z "$ac_err"; then
- X :
- else
- X rm -rf conftest*
- X CPP=/lib/cpp
- fi
- rm -f conftest*
- fi
- rm -f conftest*
- fi
- test -n "$verbose" && echo " setting CPP to $CPP"
- X
- if test -n "$GCC"; then
- X test -n "$silent" || echo "checking whether -traditional is needed"
- X ac_pattern="Autoconf.*'x'"
- X ac_prog='#include <sgtty.h>
- Autoconf TIOCGETP'
- X cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- $ac_prog
- EOF
- eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
- X rm -rf conftest*
- X ac_need_trad=1
- X
- fi
- rm -f conftest*
- X
- X
- X if test -z "$ac_need_trad"; then
- X ac_prog='#include <termio.h>
- Autoconf TCGETA'
- X cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- $ac_prog
- EOF
- eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- if egrep "$ac_pattern" conftest.out >/dev/null 2>&1; then
- X rm -rf conftest*
- X ac_need_trad=1
- X
- fi
- rm -f conftest*
- X
- X fi
- X test -n "$ac_need_trad" && CC="$CC -traditional"
- fi
- X
- X
- if test -n "$GCC"
- then
- CFLAGS='-O -Wall -Wshadow -Wconversion -Wstrict-prototypes -Wmissing-prototypes'
- fi
- X
- X
- X
- ac_prog='/* Ultrix mips cc rejects this. */
- typedef int charset[2]; const charset x;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *ccp;
- char **p;
- /* AIX XL C 1.02.0.0 rejects this.
- X It does not let you subtract one const X* pointer from another in an arm
- X of an if-expression whose if-part is not a constant expression */
- const char *g = "string";
- ccp = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++ccp;
- p = (char**) ccp;
- ccp = (char const *const *) p;
- { /* SCO 3.2v4 cc rejects this. */
- X char *t;
- X char const *s = 0 ? (char *) 0 : (char const *) 0;
- X
- X *t++ = 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- X int x[] = {25,17};
- X const int *foo = &x[0];
- X ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- X typedef const int *iptr;
- X iptr p = 0;
- X ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- X "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- X struct s { int j; const int *ap[3]; };
- X struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- X const int foo = 10;
- }'
- test -n "$silent" || echo "checking for lack of working const"
- cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- X
- int main() { return 0; }
- int t() { $ac_prog; return 0; }
- EOF
- if eval $ac_compile; then
- X :
- else
- X rm -rf conftest*
- X
- {
- test -n "$verbose" && \
- echo " defining" const to be empty
- echo "#define" const "" >> confdefs.h
- DEFS="$DEFS -Dconst="
- }
- X
- fi
- rm -f conftest*
- X
- test -n "$silent" || echo "checking for ANSI C header files"
- cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <stdlib.h>
- #include <stdarg.h>
- #include <string.h>
- #include <float.h>
- EOF
- # Some shells (Coherent) do redirections in the wrong order, so need
- # the parens.
- ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- if test -z "$ac_err"; then
- X rm -rf conftest*
- X # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- echo '#include "confdefs.h"
- #include <string.h>' > conftest.${ac_ext}
- eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- if egrep "memchr" conftest.out >/dev/null 2>&1; then
- X rm -rf conftest*
- X # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <ctype.h>
- #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
- #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
- #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
- int main () { int i; for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
- exit (0); }
- X
- EOF
- eval $ac_compile
- if test -s conftest && (./conftest; exit) 2>/dev/null; then
- X # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- echo '#include "confdefs.h"
- #include <stdlib.h>' > conftest.${ac_ext}
- eval "$ac_cpp conftest.${ac_ext} > conftest.out 2>&1"
- if egrep "free" conftest.out >/dev/null 2>&1; then
- X rm -rf conftest*
- X
- {
- test -n "$verbose" && \
- echo " defining STDC_HEADERS"
- echo "#define" STDC_HEADERS "1" >> confdefs.h
- DEFS="$DEFS -DSTDC_HEADERS=1"
- }
- X
- X
- fi
- rm -f conftest*
- X
- X
- fi
- rm -fr conftest*
- X
- fi
- rm -f conftest*
- X
- X
- fi
- rm -f conftest*
- X
- for ac_hdr in stdlib.h unistd.h
- do
- ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
- test -n "$silent" || echo "checking for ${ac_hdr}"
- cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <${ac_hdr}>
- EOF
- # Some shells (Coherent) do redirections in the wrong order, so need
- # the parens.
- ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- if test -z "$ac_err"; then
- X rm -rf conftest*
- X
- {
- test -n "$verbose" && \
- echo " defining ${ac_tr_hdr}"
- echo "#define" ${ac_tr_hdr} "1" >> confdefs.h
- DEFS="$DEFS -D${ac_tr_hdr}=1"
- }
- X
- X
- fi
- rm -f conftest*
- done
- X
- for ac_hdr in getopt.h string.h malloc.h
- do
- ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`
- test -n "$silent" || echo "checking for ${ac_hdr}"
- cat > conftest.${ac_ext} <<EOF
- #include "confdefs.h"
- #include <${ac_hdr}>
- EOF
- # Some shells (Coherent) do redirections in the wrong order, so need
- # the parens.
- ac_err=`eval "($ac_cpp conftest.${ac_ext} >/dev/null) 2>&1"`
- if test -z "$ac_err"; then
- X rm -rf conftest*
- X
- {
- test -n "$verbose" && \
- echo " defining ${ac_tr_hdr}"
- echo "#define" ${ac_tr_hdr} "1" >> confdefs.h
- DEFS="$DEFS -D${ac_tr_hdr}=1"
- }
- X
- X
- fi
- rm -f conftest*
- done
- X
- X
- ### output makefile and config.h
- X
- # The preferred way to propogate these variables is regular @ substitutions.
- if test -n "$prefix"; then
- X ac_prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
- else
- X prefix=/usr/local
- fi
- if test -n "$exec_prefix"; then
- X ac_prsub="$ac_prsub
- s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
- else
- X exec_prefix='${prefix}' # Let make expand it.
- fi
- X
- # Any assignment to VPATH causes Sun make to only execute
- # the first set of double-colon rules, so remove it if not needed.
- # If there is a colon in the path, we need to keep it.
- if test "x$srcdir" = x.; then
- X ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
- fi
- X
- # Quote sed substitution magic chars in DEFS.
- cat >conftest.def <<EOF
- $DEFS
- EOF
- ac_escape_ampersand_and_backslash='s%[&\\]%\\&%g'
- DEFS=`sed "$ac_escape_ampersand_and_backslash" <conftest.def`
- rm -f conftest.def
- # Substitute for predefined variables.
- X
- trap 'rm -f config.status; exit 1' 1 2 15
- echo creating config.status
- rm -f config.status
- cat > config.status <<EOF
- #!/bin/sh
- # Generated automatically by configure.
- # Run this file to recreate the current configuration.
- # This directory was configured as follows,
- # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
- #
- # $0 $configure_args
- X
- ac_cs_usage="Usage: config.status [--recheck] [--version] [--help]"
- for ac_option
- do
- X case "\$ac_option" in
- X -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- X echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create
- X exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args --no-create ;;
- X -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- X echo "config.status generated by autoconf version 1.11"
- X exit 0 ;;
- X -help | --help | --hel | --he | --h)
- X echo "\$ac_cs_usage"; exit 0 ;;
- X *) echo "\$ac_cs_usage"; exit 1 ;;
- X esac
- done
- X
- trap 'rm -f makefile config_h; exit 1' 1 2 15
- CC='$CC'
- INSTALL='$INSTALL'
- INSTALL_PROGRAM='$INSTALL_PROGRAM'
- INSTALL_DATA='$INSTALL_DATA'
- CPP='$CPP'
- CFLAGS='$CFLAGS'
- LIBS='$LIBS'
- srcdir='$srcdir'
- top_srcdir='$top_srcdir'
- prefix='$prefix'
- exec_prefix='$exec_prefix'
- DEFS='$DEFS'
- ac_prsub='$ac_prsub'
- ac_vpsub='$ac_vpsub'
- extrasub='$extrasub'
- EOF
- cat >> config.status <<\EOF
- X
- ac_given_srcdir=$srcdir
- X
- CONFIG_FILES=${CONFIG_FILES-"makefile config_h"}
- for ac_file in .. ${CONFIG_FILES}; do if test "x$ac_file" != x..; then
- X # Remove last slash and all that follows it. Not all systems have dirname.
- X ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- X if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- X # The file is in a subdirectory.
- X test ! -d "$ac_dir" && mkdir "$ac_dir"
- X ac_dir_suffix="/$ac_dir"
- X else
- X ac_dir_suffix=
- X fi
- X
- X # A "../" for each directory in $ac_dir_suffix.
- X ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- X case "$ac_given_srcdir" in
- X .) srcdir=.
- X if test -z "$ac_dir_suffix"; then top_srcdir=.
- X else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- X /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- X *) # Relative path.
- X srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- X top_srcdir="$ac_dots$ac_given_srcdir" ;;
- X esac
- X
- X echo creating "$ac_file"
- X rm -f "$ac_file"
- X comment_str="Generated automatically from `echo $ac_file|sed 's|.*/||'`.in by configure."
- X case "$ac_file" in
- X *.c | *.h | *.C | *.cc | *.m ) echo "/* $comment_str */" > "$ac_file" ;;
- X * ) echo "# $comment_str" > "$ac_file" ;;
- X esac
- X sed -e "
- $ac_prsub
- $ac_vpsub
- $extrasub
- s%@CC@%$CC%g
- s%@INSTALL@%$INSTALL%g
- s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
- s%@INSTALL_DATA@%$INSTALL_DATA%g
- s%@CPP@%$CPP%g
- s%@CFLAGS@%$CFLAGS%g
- s%@LIBS@%$LIBS%g
- s%@srcdir@%$srcdir%g
- s%@top_srcdir@%$top_srcdir%g
- s%@prefix@%$prefix%g
- s%@exec_prefix@%$exec_prefix%g
- s%@DEFS@%$DEFS%
- " $ac_given_srcdir/${ac_file}.in >> $ac_file
- fi; done
- X
- X
- echo creating config.h
- sed -e '/^# /d' \
- X -e 's/ -D/\
- #define /g' \
- X -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
- X config_h >config.h
- X
- echo removing config_h
- rm config_h
- X
- Xexit 0
- EOF
- chmod +x config.status
- # Some shells look in PATH for config.status without the "./".
- test -n "$no_create" || ${CONFIG_SHELL-/bin/sh} ./config.status
- X
- SHAR_EOF
- $TOUCH -am 0613210094 'configure' &&
- chmod 0755 configure ||
- echo 'restore of configure failed'
- Wc_c="`wc -c < 'configure'`"
- test 24898 -eq "$Wc_c" ||
- echo 'configure: original size 24898, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= README ==============
- if test -f 'README' -a X"$1" != X"-c"; then
- echo 'x - skipping README (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting README (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'README' &&
- $Id: README,v 1.2 1994/06/13 23:43:17 tom Exp $
- X
- Readme file for DiffStat.
- X
- This program is a simple filter that reads the output of the 'diff' program,
- and produces a histogram of the total number of lines that were changed. It is
- useful for scanning a patch file to see which files were changed.
- SHAR_EOF
- $TOUCH -am 0613194394 'README' &&
- chmod 0444 README ||
- echo 'restore of README failed'
- Wc_c="`wc -c < 'README'`"
- test 299 -eq "$Wc_c" ||
- echo 'README: original size 299, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= diffstat.c ==============
- if test -f 'diffstat.c' -a X"$1" != X"-c"; then
- echo 'x - skipping diffstat.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting diffstat.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'diffstat.c' &&
- /******************************************************************************
- X * Copyright (c) 1994 by Thomas E. Dickey. All Rights Reserved. *
- X * *
- X * You may freely copy or redistribute this software, so long as there is no *
- X * profit made from its use, sale trade or reproduction. You may not change *
- X * this copyright notice, and it must be included in any copy made. *
- X ******************************************************************************/
- #if !defined(NO_IDENT)
- static char *Id = "$Id: diffstat.c,v 1.12 1994/06/13 00:43:20 tom Exp $";
- #endif
- X
- /*
- X * Title: diffstat.c
- X * Author: T.E.Dickey
- X * Created: 02 Feb 1992
- X * Modified:
- X * 12 Jun 1994, recognize unified diff, and output of makepatch.
- X * 04 Oct 1993, merge multiple diff-files, busy message when the
- X * output is piped to a file.
- X *
- X * Function: this program reads the output of 'diff' and displays a histogram
- X * of the insertions/deletions/modifications per-file.
- X */
- X
- #if defined(HAVE_CONFIG_H)
- #include "config.h"
- #endif
- X
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- X
- #if HAVE_STDLIB_H
- #include <stdlib.h>
- #else
- extern int atoi();
- #endif
- X
- #if HAVE_UNISTD_H
- #include <unistd.h>
- #else
- extern int isatty();
- #endif
- X
- #if HAVE_MALLOC_H
- #include <malloc.h>
- #else
- extern char *malloc();
- #endif
- X
- #if HAVE_GETOPT_H
- #include <getopt.h>
- #else
- extern int getopt();
- extern char *optarg;
- extern int optind;
- #endif
- X
- #if !defined(TRUE) || (TRUE != 1)
- #undef TRUE
- #undef FALSE
- #define TRUE 1
- #define FALSE 0
- #endif
- X
- #if !defined(EXIT_SUCCESS)
- #define EXIT_SUCCESS 0
- #define EXIT_FAILURE 1
- #endif
- X
- /******************************************************************************/
- X
- #define PATHSEP '/'
- #define EOS '\0'
- #define BLANK ' '
- X
- typedef enum comment { Normal, Only, Binary } Comment;
- X
- typedef struct _data {
- X struct _data *link;
- X char *name;
- X Comment cmt;
- X long ins, /* "+" count inserted lines */
- X del, /* "-" count deleted lines */
- X mod; /* "!" count modified lines */
- X } DATA;
- X
- static DATA *all_data;
- static int piped_output;
- static int max_width; /* the specified width-limit */
- static int name_wide; /* the amount reserved for filenames */
- static int plot_width; /* the amount left over for histogram */
- X
- /******************************************************************************/
- #if __STDC__
- static void failed (char *s);
- static void blip (int c);
- static char * new_string(char *s);
- static DATA * new_data(char *name);
- static int match(char *s, char *p);
- static void do_file(FILE *fp);
- static void plot(long num, long max, int c);
- static void summarize(void);
- static void usage(void);
- X int main(int argc, char *argv[]);
- #endif
- /******************************************************************************/
- X
- static
- void failed(s)
- X char *s;
- {
- X perror(s);
- X exit(EXIT_FAILURE);
- }
- X
- static
- void blip(c)
- X int c;
- {
- X if (piped_output) {
- X (void)fputc(c, stderr);
- X (void)fflush(stderr);
- X }
- }
- X
- static
- char * new_string(s)
- X char *s;
- {
- X return strcpy(malloc((unsigned)(strlen(s)+1)), s);
- }
- X
- static
- DATA * new_data(name)
- X char *name;
- {
- X register DATA *p, *q, *r;
- X
- X /* insert into sorted list */
- X for (p = all_data, q = 0; p != 0; q = p, p = p->link) {
- X int cmp = strcmp(p->name, name);
- X if (cmp == 0)
- X return p;
- X if (cmp > 0) {
- X break;
- X }
- X }
- X r = (DATA *)malloc(sizeof(DATA));
- X if (q != 0)
- X q->link = r;
- X else
- X all_data = r;
- X
- X r->link = p;
- X r->name = new_string(name);
- X r->cmt = Normal;
- X r->ins =
- X r->del =
- X r->mod = 0;
- X
- X return r;
- }
- X
- /* like strncmp, but without the 3rd argument */
- static
- int match(s, p)
- X char *s;
- X char *p;
- {
- X while (*s != EOS) {
- X if (*p == EOS)
- X break;
- X if (*s++ != *p++)
- X return FALSE;
- X }
- X return TRUE;
- }
- X
- static
- void do_file(fp)
- X FILE *fp;
- {
- X DATA dummy, *this = &dummy;
- X char buffer[BUFSIZ];
- X int ok = FALSE;
- X register char *s;
- X
- X while (fgets(buffer, sizeof(buffer), fp)) {
- X for (s = buffer + strlen(buffer); s > buffer; s--) {
- X if (isspace(s[-1]))
- X s[-1] = EOS;
- X else
- X break;
- X }
- X
- X /*
- X * The markers for unified diff are a little different from the
- X * normal context-diff:
- X */
- X if (match(buffer, "+++ ")
- X || match(buffer, "--- "))
- X (void)strncpy(buffer, "***", 3);
- X
- X /*
- X * Use the first character of the input line to determine its
- X * type:
- X */
- X switch (*buffer) {
- X case 'O': /* Only */
- X if (match(buffer, "Only in ")) {
- X char *path = buffer + 8;
- X int found = FALSE;
- X for (s = path; *s != EOS; s++) {
- X if (match(s, ": ")) {
- X found = TRUE;
- X *s++ = PATHSEP;
- X while ((s[0] = s[1]) != EOS)
- X s++;
- X break;
- X }
- X }
- X if (found) {
- X blip('.');
- X this = new_data(path);
- X this->cmt = Only;
- X ok = TRUE;
- X }
- X }
- X break;
- X
- X case 'I': /* Index (e.g., from makepatch) */
- X if (!match(buffer, "Index: "))
- X break;
- X if ((s = strrchr(buffer, BLANK)) != 0) {
- X blip('.');
- X this = new_data(s+1);
- X ok = TRUE;
- X }
- X break;
- X
- X case 'd': /* diff command trace */
- X if (!match(buffer, "diff "))
- X break;
- X if ((s = strrchr(buffer, BLANK)) != 0) {
- X blip('.');
- X this = new_data(s+1);
- X ok = TRUE;
- X }
- X break;
- X
- X case '*':
- X if (ok <= 0) {
- X char fname[BUFSIZ];
- X char wday[BUFSIZ], mmm[BUFSIZ];
- X int ddd, hour, minute, second, year;
- X
- X if (sscanf(buffer,
- X "*** %[^\t]\t%[^ ] %[^ ] %d %d:%d:%d %d",
- X fname,
- X wday, mmm, &ddd,
- X &hour, &minute, &second, &year) == 8) {
- X ok = -TRUE;
- X if (!(s = strrchr(fname, PATHSEP)))
- X s = fname;
- X else
- X s++;
- X this = new_data(s);
- X }
- X }
- X break;
- X
- X case '+':
- X /* fall-thru */
- X case '>':
- X if (!ok)
- X break;
- X this->ins += 1;
- X break;
- X
- X case '-':
- X if (!ok)
- X break;
- X if (buffer[1] == '-')
- X break;
- X /* fall-thru */
- X case '<':
- X if (!ok)
- X break;
- X this->del += 1;
- X break;
- X
- X case '!':
- X if (!ok)
- X break;
- X this->mod += 1;
- X break;
- X
- X case 'B': /* Binary */
- X /* fall-thru */
- X case 'b': /* binary */
- X if (match(buffer+1, "inary files "))
- X this->cmt = Binary;
- X break;
- X }
- X }
- X blip('\n');
- }
- X
- static
- void plot(num, max, c)
- X long num;
- X long max;
- X int c;
- {
- X num = (((plot_width * num) + (plot_width/2)) / max);
- X while (--num >= 0)
- X (void)putchar(c);
- }
- X
- static
- void summarize()
- {
- X register DATA *p;
- X long scale = 0,
- X total_ins = 0,
- X total_del = 0,
- X total_mod = 0,
- X temp;
- X int num_files = 0;
- X
- X for (p = all_data; p; p = p->link) {
- X int len = strlen(p->name);
- X if (len > name_wide)
- X name_wide = len;
- X num_files++;
- X total_ins += p->ins;
- X total_del += p->del;
- X total_mod += p->mod;
- X temp = p->ins + p->del + p->mod;
- X if (temp > scale)
- X scale = temp;
- X }
- X
- X name_wide++; /* make sure it's nonzero */
- X plot_width = (max_width - name_wide - 8);
- X if (plot_width < 10)
- X plot_width = 10;
- X
- X for (p = all_data; p; p = p->link) {
- X printf(" %-*.*s|", name_wide, name_wide, p->name);
- X if (p->cmt == Normal) {
- X printf("%5ld ", p->ins + p->del + p->mod);
- X plot(p->ins, scale, '+');
- X plot(p->del, scale, '-');
- X plot(p->mod, scale, '!');
- X } else if (p->cmt == Binary) {
- X printf("binary");
- X } else if (p->cmt == Only) {
- X printf("only");
- X }
- X printf("\n");
- X }
- X
- X printf(" %d files changed", num_files);
- X if (total_ins) printf(", %ld insertions", total_ins);
- X if (total_del) printf(", %ld deletions", total_del);
- X if (total_mod) printf(", %ld modifications", total_mod);
- X printf("\n");
- }
- X
- static
- void usage()
- {
- X static char *msg[] = {
- X "Usage: diffstat [options] [files]",
- X "",
- X "Reads from one or more input files which contain output from 'diff',",
- X "producing a histgram of total lines changed for each file referenced.",
- X "If no filename is given on the command line, reads from stdin.",
- X "",
- X "Options:",
- X " -w NUM specify maximum width of the output (default: 80)"
- X };
- X register int j;
- X for (j = 0; j < sizeof(msg)/sizeof(msg[0]); j++)
- X fprintf(stderr, "%s\n", msg[j]);
- X exit (EXIT_FAILURE);
- }
- X
- int main(argc, argv)
- X int argc;
- X char *argv[];
- {
- X register int j;
- X
- X max_width = 80;
- X piped_output = !isatty(fileno(stdout))
- X && isatty(fileno(stderr));
- X
- X while ((j = getopt(argc, argv, "w:")) != EOF) {
- X switch (j) {
- X case 'w':
- X max_width = atoi(optarg);
- X break;
- X default:
- X usage();
- X /*NOTREACHED*/
- X }
- X }
- X
- X if (optind < argc) {
- X while (optind < argc) {
- X FILE *fp;
- X char *name = argv[optind++];
- X if ((fp = fopen(name, "r")) != 0) {
- X if (piped_output) {
- X (void)fprintf(stderr, "%s\n", name);
- X (void)fflush(stderr);
- X }
- X do_file(fp);
- X } else {
- X failed(name);
- X }
- X }
- X } else {
- X do_file(stdin);
- X }
- X summarize();
- X exit(EXIT_SUCCESS);
- X /*NOTREACHED*/
- X return (EXIT_SUCCESS);
- }
- SHAR_EOF
- $TOUCH -am 0612204394 'diffstat.c' &&
- chmod 0444 diffstat.c ||
- echo 'restore of diffstat.c failed'
- Wc_c="`wc -c < 'diffstat.c'`"
- test 8620 -eq "$Wc_c" ||
- echo 'diffstat.c: original size 8620, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= diffstat.1 ==============
- if test -f 'diffstat.1' -a X"$1" != X"-c"; then
- echo 'x - skipping diffstat.1 (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting diffstat.1 (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'diffstat.1' &&
- .\"*****************************************************************************
- .\" Copyright (c) 1994 by Thomas E. Dickey. All Rights Reserved. *
- .\" *
- .\" You may freely copy or redistribute this software, so long as there is no *
- .\" profit made from its use, sale trade or reproduction. You may not change *
- .\" this copyright notice, and it must be included in any copy made. *
- .\"*****************************************************************************
- .\" $Id: diffstat.1,v 1.2 1994/06/13 23:38:35 tom Exp $
- .de DS
- .RS
- .nf
- .sp
- ..
- .de DE
- .fi
- .RE
- .sp .5
- ..
- .TH DIFFSTAT 1
- .
- .SH NAME
- \fBdiffstat\fR \- make histogram from diff-output
- .
- .SH USAGE
- \fBdiffstat\fI [options] [file-specifications]
- .
- .SH SYNOPSIS
- This program reads the output of \fBdiff\fR and displays a histogram
- of the insertions, deletions, and modifications per-file.
- .
- .SH DESCRIPTION
- Diffstat is a program that is useful for reviewing large, complex patch files.
- It reads from one or more input files which contain output from \fBdiff\fR,
- producing a histogram of the total lines changed for each file referenced.
- .
- .PP
- Diffstat recognizes the most popular types of output from diff:
- .
- .RS
- .TP
- unified
- preferred by the \fBpatch\fR utility.
- .
- .TP
- context
- best for readability, but not very compact.
- .
- .TP
- default
- not good for much, but simple to generate.
- .RE
- .
- .PP
- \fBDiffstat\fR detects the lines that are output by \fBdiff\fR to
- tell which files are compared, and then counts the markers in the
- first column that denote the type of change (insertion, deletion
- or modification).
- These are shown in the histogram as "+", "-" and "!" characters.
- .
- .PP
- If no filename is given on the command line,
- \fBdiffstat\fR reads the differences from the standard input.
- .
- .SH OPTIONS
- .TP
- .BI \-w " number"
- specify the maximum width of the histogram.
- The plot will never be shorter than 10 columns, just in case
- the filenames get too large.
- .
- .SH ENVIRONMENT
- .PP
- \fBDiffstat\fR runs in a portable UNIX\*R environment.
- .SH FILES
- .PP
- \fBDiffstat\fR is a single binary module, which uses no auxiliary files.
- .
- .SH BUGS
- .PP
- \fBDiffstat\fR makes a lot of assumptions about the format of a \fBdiff\fR file.
- .PP
- There's no easy way to determine the degree of overlap between the
- "before" and "after" displays of modified lines.
- .
- .SH SEE ALSO
- .PP
- diff (1).
- .SH AUTHOR
- .PP
- Thomas Dickey (dickey@clark.net).
- SHAR_EOF
- $TOUCH -am 0613193894 'diffstat.1' &&
- chmod 0444 diffstat.1 ||
- echo 'restore of diffstat.1 failed'
- Wc_c="`wc -c < 'diffstat.1'`"
- test 2467 -eq "$Wc_c" ||
- echo 'diffstat.1: original size 2467, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= config_h.in ==============
- if test -f 'config_h.in' -a X"$1" != X"-c"; then
- echo 'x - skipping config_h.in (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting config_h.in (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'config_h.in' &&
- /*
- X * $Id: config_h.in,v 1.1 1994/06/12 23:48:18 tom Exp $
- X * config_h.in is a template file used by configure to produce config.h.
- X * config_h is then transformed (by config.status) into the header file
- X * config.h -- Kevin Buettner.
- X */
- X
- @DEFS@
- SHAR_EOF
- $TOUCH -am 0612194894 'config_h.in' &&
- chmod 0444 config_h.in ||
- echo 'restore of config_h.in failed'
- Wc_c="`wc -c < 'config_h.in'`"
- test 249 -eq "$Wc_c" ||
- echo 'config_h.in: original size 249, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mkdirs.sh ==============
- if test -f 'mkdirs.sh' -a X"$1" != X"-c"; then
- echo 'x - skipping mkdirs.sh (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mkdirs.sh (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mkdirs.sh' &&
- #!/bin/sh
- # mkinstalldirs --- make directory hierarchy
- # Author: Noah Friedman <friedman@prep.ai.mit.edu>
- # Created: 1993-05-16
- # Last modified: 1994-03-25
- # Public domain
- X
- errstatus=0
- X
- for file in ${1+"$@"} ; do
- X set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- X shift
- X
- X pathcomp=
- X for d in ${1+"$@"} ; do
- X pathcomp="$pathcomp$d"
- X case "$pathcomp" in
- X -* ) pathcomp=./$pathcomp ;;
- X esac
- X
- X if test ! -d "$pathcomp"; then
- X echo "mkdir $pathcomp" 1>&2
- X mkdir "$pathcomp" || errstatus=$?
- X fi
- X
- X pathcomp="$pathcomp/"
- X done
- done
- X
- exit $errstatus
- X
- # mkinstalldirs ends here
- SHAR_EOF
- $TOUCH -am 0521140894 'mkdirs.sh' &&
- chmod 0555 mkdirs.sh ||
- echo 'restore of mkdirs.sh failed'
- Wc_c="`wc -c < 'mkdirs.sh'`"
- test 649 -eq "$Wc_c" ||
- echo 'mkdirs.sh: original size 649, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= makefile.in ==============
- if test -f 'makefile.in' -a X"$1" != X"-c"; then
- echo 'x - skipping makefile.in (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting makefile.in (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'makefile.in' &&
- # $Id: makefile.in,v 1.7 1994/06/14 00:55:55 tom Exp $
- # Makefile-template for 'diffstat'
- X
- THIS = diffstat
- X
- #### Start of system configuration section. ####
- X
- srcdir = @srcdir@
- VPATH = @srcdir@
- X
- CC = @CC@
- LINK = $(CC)
- INSTALL = @INSTALL@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
- INSTALL_DATA = @INSTALL_DATA@
- X
- LIBS = @LIBS@
- CFLAGS = @CFLAGS@
- X
- prefix = /usr/local
- exec_prefix = $(prefix)
- X
- bindir = $(exec_prefix)/bin
- libdir = $(exec_prefix)/lib
- mandir = $(prefix)/man/man1
- manext = 1
- X
- #### End of system configuration section. ####
- X
- SHELL = /bin/sh
- X
- CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H
- X
- LDFLAGS =
- X
- .c.o:
- X $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
- X
- SRC = README $(THIS).c $(THIS).1 config_h.in mkdirs.sh makefile.in configure.in
- X
- OBJ = $(THIS).o
- X
- DISTFILES = configure $(SRC)
- X
- all: $(THIS)
- X
- $(THIS): $(OBJ)
- X -mv $(THIS) o$(THIS)
- X $(LINK) $(LDFLAGS) -o $(THIS) $(OBJ) $(LIBS)
- X
- install: all installdirs
- X $(INSTALL_PROGRAM) $(THIS) $(bindir)/$(THIS)
- X $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(mandir)/$(THIS).$(manext)
- X
- installdirs:
- X $(SHELL) ${srcdir}/mkdirs.sh $(bindir) $(libdir) $(mandir)
- X
- uninstall:
- X rm -f $(bindir)/$(THIS) $(mandir)/$(THIS).$(manext)
- X
- makefile: makefile.in config.status
- X ./config.status
- X
- config.h: configure
- X ./configure
- X
- config.status: configure
- X ./config.status --recheck
- X
- mostlyclean:
- X rm -f *.o o$(THIS) core *~ *.BAK
- X
- clean: mostlyclean
- X rm -f $(THIS)
- X
- distclean: clean
- X rm -f makefile config.status config.h
- X
- realclean: distclean
- X rm -f tags TAGS # don't remove configure!
- X
- lint:
- X lint $(THIS).c
- X
- tags:
- X ctags $(THIS).c $(HDRS)
- X
- TAGS:
- X etags $(THIS).c $(HDRS)
- X
- dist: makefile $(DISTFILES)
- X echo $(THIS)-`sed \
- X -e '/"$$[A-Za-z]*: $(THIS)\.c.*$$"/!d' \
- X -e 's/^.*$(THIS)[^ ]*[ ]*//' \
- X -e 's/[ ].*$$//' \
- X -e q $(srcdir)/$(THIS).c` > .fname
- X rm -rf `cat .fname`
- X mkdir `cat .fname`
- X for file in $(DISTFILES); do \
- X ln $(srcdir)/$$file `cat .fname` \
- X || { echo copying $$file instead; cp -p $$file `cat .fname`; }; \
- X done
- X tar -cf - `cat .fname` | gzip >`cat .fname`.tgz
- X rm -rf `cat .fname` .fname
- X
- shar: $(DISTFILES)
- X shar -a -m -M -L50 -n$(THIS) -oPart $(DISTFILES)
- X
- $(THIS).o: config.h
- X
- $(SRC): ; checkout $@
- SHAR_EOF
- $TOUCH -am 0613205594 'makefile.in' &&
- chmod 0444 makefile.in ||
- echo 'restore of makefile.in failed'
- Wc_c="`wc -c < 'makefile.in'`"
- test 2152 -eq "$Wc_c" ||
- echo 'makefile.in: original size 2152, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= configure.in ==============
- if test -f 'configure.in' -a X"$1" != X"-c"; then
- echo 'x - skipping configure.in (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting configure.in (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'configure.in' &&
- dnl Process this file with 'autoconf' to produce a 'configure' script
- dnl $Id: configure.in,v 1.3 1994/06/14 00:06:44 tom Exp $
- AC_REVISION($Revision: 1.3 $)
- AC_INIT(diffstat.c)
- AC_PROG_CC
- AC_PROG_INSTALL
- AC_GCC_TRADITIONAL
- X
- if test -n "$GCC"
- then
- CFLAGS='-O -Wall -Wshadow -Wconversion -Wstrict-prototypes -Wmissing-prototypes'
- fi
- AC_SUBST(CFLAGS)
- AC_SUBST(LIBS)
- X
- AC_CONST
- AC_STDC_HEADERS
- AC_HAVE_HEADERS(stdlib.h unistd.h)
- AC_HAVE_HEADERS(getopt.h string.h malloc.h)
- X
- ### output makefile and config.h
- changequote({,})dnl
- AC_OUTPUT(makefile config_h,
- {
- echo creating config.h
- sed -e '/^# /d' \
- X -e 's/ -D/\
- #define /g' \
- X -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
- X config_h >config.h
- }
- echo removing config_h
- rm config_h
- )
- changequote([,])dnl
- SHAR_EOF
- $TOUCH -am 0613200694 'configure.in' &&
- chmod 0444 configure.in ||
- echo 'restore of configure.in failed'
- Wc_c="`wc -c < 'configure.in'`"
- test 753 -eq "$Wc_c" ||
- echo 'configure.in: original size 753, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- exit 0
-