wdiff-1.2.1/ 0000755 0000000 0000000 00000000000 12116513227 007561 5 0000000 0000000 wdiff-1.2.1/tests/ 0000755 0000000 0000000 00000000000 12116513224 010720 5 0000000 0000000 wdiff-1.2.1/tests/cluster.at 0000644 0000000 0000000 00000001502 11744500575 012660 0000000 0000000 # -*- shell-script -*-
# wdiff test suite
# Copyright (C) 2010 Free Software Foundation, Inc.
#
# This file is part of GNU wdiff
#
# GNU wdiff 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 3 of the License, or
# (at your option) any later version.
#
# GNU wdiff 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# Tests not ready, see history of cluster.m4 for the tests
exit 77
wdiff-1.2.1/tests/testsuite.at 0000644 0000000 0000000 00000000430 11744500575 013227 0000000 0000000 #!/bin/sh
# Validation suite for the GNU `wdiff' and friends. -*- shell-script -*-
# Copyright (C) 1998 Progiciels Bourbeau-Pinard inc.
# Francois Pinard , 1998.
AT_INIT(wdiff)
AT_COLOR_TESTS
# The other tests will be appended here by the Makefile rule.
wdiff-1.2.1/tests/testsuite 0000755 0000000 0000000 00000213654 12116513223 012631 0000000 0000000 #! /bin/sh
# Generated from testsuite.at by GNU Autoconf 2.69.
#
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
#
# This test suite is free software; the Free Software Foundation gives
# unlimited permission to copy, distribute and modify it.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
&& (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='print -r --'
as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
as_echo='printf %s\n'
as_echo_n='printf %s'
else
if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
as_echo_n='/usr/ucb/echo -n'
else
as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
as_echo_n_body='eval
arg=$1;
case $arg in #(
*"$as_nl"*)
expr "X$arg" : "X\\(.*\\)$as_nl";
arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
esac;
expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
'
export as_echo_n_body
as_echo_n='sh -c $as_echo_n_body as_echo'
fi
export as_echo_body
as_echo='sh -c $as_echo_body as_echo'
fi
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# IFS
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
$as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there. '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
# is contrary to our usage. Disable this feature.
alias -g '\${1+\"\$@\"}'='\"\$@\"'
setopt NO_GLOB_SUBST
else
case \`(set -o) 2>/dev/null\` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
"
as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }
exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
if (eval "$as_required") 2>/dev/null; then :
as_have_required=yes
else
as_have_required=no
fi
if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
as_found=:
case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
# Try only shells that exist, to save several forks.
as_shell=$as_dir/$as_base
if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
CONFIG_SHELL=$as_shell as_have_required=yes
if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
break 2
fi
fi
done;;
esac
as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
{ $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
$as_echo "$0: This script requires a shell more modern than all"
$as_echo "$0: the shells that I found on your system."
if test x${ZSH_VERSION+set} = xset ; then
$as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
$as_echo "$0: be upgraded to zsh 4.3.4 or later."
else
$as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
fi
exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS
## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
$as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
$as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_1=$LINENO as_lineno_1a=$LINENO
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
' <$as_myself |
sed '
s/[$]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
t loop
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
. "./$as_me.lineno"
# Exit status is that of the last command.
exit
}
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
SHELL=${CONFIG_SHELL-/bin/sh}
# How were we run?
at_cli_args="$@"
# Not all shells have the 'times' builtin; the subshell is needed to make
# sure we discard the 'times: not found' message from the shell.
at_times_p=false
(times) >/dev/null 2>&1 && at_times_p=:
# CLI Arguments to pass to the debugging scripts.
at_debug_args=
# -e sets to true
at_errexit_p=false
# Shall we be verbose? ':' means no, empty means yes.
at_verbose=:
at_quiet=
# Running several jobs in parallel, 0 means as many as test groups.
at_jobs=1
at_traceon=:
at_trace_echo=:
at_check_filter_trace=:
# Shall we keep the debug scripts? Must be `:' when the suite is
# run by a debug script, so that the script doesn't remove itself.
at_debug_p=false
# Display help message?
at_help_p=false
# Display the version message?
at_version_p=false
# List test groups?
at_list_p=false
# --clean
at_clean=false
# Test groups to run
at_groups=
# Whether to rerun failed tests.
at_recheck=
# Whether a write failure occurred
at_write_fail=0
# The directory we run the suite in. Default to . if no -C option.
at_dir=`pwd`
# An absolute reference to this testsuite script.
case $as_myself in
[\\/]* | ?:[\\/]* ) at_myself=$as_myself ;;
* ) at_myself=$at_dir/$as_myself ;;
esac
# Whether -C is in effect.
at_change_dir=false
# Whether to enable colored test results.
at_color=auto
# List of the tested programs.
at_tested='wdiff
which
env
grep
diff
sed
tr'
# As many question marks as there are digits in the last test group number.
# Used to normalize the test group numbers so that `ls' lists them in
# numerical order.
at_format='?'
# Description of all the test groups.
at_help_all="1;wdiff.at:25;wdiff output formats;;
2;wdiff.at:142;report bad diff binary;;
3;wdiff.at:168;use pager;;
4;wdiff.at:201;diff as input;;
"
# List of the all the test groups.
at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'`
# at_fn_validate_ranges NAME...
# -----------------------------
# Validate and normalize the test group number contained in each variable
# NAME. Leading zeroes are treated as decimal.
at_fn_validate_ranges ()
{
for at_grp
do
eval at_value=\$$at_grp
if test $at_value -lt 1 || test $at_value -gt 4; then
$as_echo "invalid test group: $at_value" >&2
exit 1
fi
case $at_value in
0*) # We want to treat leading 0 as decimal, like expr and test, but
# AS_VAR_ARITH treats it as octal if it uses $(( )).
# With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the
# expr fork, but it is not worth the effort to determine if the
# shell supports XSI when the user can just avoid leading 0.
eval $at_grp='`expr $at_value + 0`' ;;
esac
done
}
at_prev=
for at_option
do
# If the previous option needs an argument, assign it.
if test -n "$at_prev"; then
at_option=$at_prev=$at_option
at_prev=
fi
case $at_option in
*=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;;
*) at_optarg= ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
case $at_option in
--help | -h )
at_help_p=:
;;
--list | -l )
at_list_p=:
;;
--version | -V )
at_version_p=:
;;
--clean | -c )
at_clean=:
;;
--color )
at_color=always
;;
--color=* )
case $at_optarg in
no | never | none) at_color=never ;;
auto | tty | if-tty) at_color=auto ;;
always | yes | force) at_color=always ;;
*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;;
esac
;;
--debug | -d )
at_debug_p=:
;;
--errexit | -e )
at_debug_p=:
at_errexit_p=:
;;
--verbose | -v )
at_verbose=; at_quiet=:
;;
--trace | -x )
at_traceon='set -x'
at_trace_echo=echo
at_check_filter_trace=at_fn_filter_trace
;;
[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
at_fn_validate_ranges at_option
as_fn_append at_groups "$at_option$as_nl"
;;
# Ranges
[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
at_range_start=`echo $at_option |tr -d X-`
at_fn_validate_ranges at_range_start
at_range=`$as_echo "$at_groups_all" | \
sed -ne '/^'$at_range_start'$/,$p'`
as_fn_append at_groups "$at_range$as_nl"
;;
-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9])
at_range_end=`echo $at_option |tr -d X-`
at_fn_validate_ranges at_range_end
at_range=`$as_echo "$at_groups_all" | \
sed -ne '1,/^'$at_range_end'$/p'`
as_fn_append at_groups "$at_range$as_nl"
;;
[0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
[0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
[0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
[0-9][0-9][0-9]-[0-9][0-9][0-9] | \
[0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
at_range_start=`expr $at_option : '\(.*\)-'`
at_range_end=`expr $at_option : '.*-\(.*\)'`
if test $at_range_start -gt $at_range_end; then
at_tmp=$at_range_end
at_range_end=$at_range_start
at_range_start=$at_tmp
fi
at_fn_validate_ranges at_range_start at_range_end
at_range=`$as_echo "$at_groups_all" | \
sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'`
as_fn_append at_groups "$at_range$as_nl"
;;
# Directory selection.
--directory | -C )
at_prev=--directory
;;
--directory=* )
at_change_dir=:
at_dir=$at_optarg
if test x- = "x$at_dir" ; then
at_dir=./-
fi
;;
# Parallel execution.
--jobs | -j )
at_jobs=0
;;
--jobs=* | -j[0-9]* )
if test -n "$at_optarg"; then
at_jobs=$at_optarg
else
at_jobs=`expr X$at_option : 'X-j\(.*\)'`
fi
case $at_jobs in *[!0-9]*)
at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'`
as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;;
esac
;;
# Keywords.
--keywords | -k )
at_prev=--keywords
;;
--keywords=* )
at_groups_selected=$at_help_all
at_save_IFS=$IFS
IFS=,
set X $at_optarg
shift
IFS=$at_save_IFS
for at_keyword
do
at_invert=
case $at_keyword in
'!'*)
at_invert="-v"
at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
;;
esac
# It is on purpose that we match the test group titles too.
at_groups_selected=`$as_echo "$at_groups_selected" |
grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"`
done
# Smash the keywords.
at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'`
as_fn_append at_groups "$at_groups_selected$as_nl"
;;
--recheck)
at_recheck=:
;;
*=*)
at_envvar=`expr "x$at_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
case $at_envvar in
'' | [0-9]* | *[!_$as_cr_alnum]* )
as_fn_error $? "invalid variable name: \`$at_envvar'" ;;
esac
at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"`
# Export now, but save eval for later and for debug scripts.
export $at_envvar
as_fn_append at_debug_args " $at_envvar='$at_value'"
;;
*) $as_echo "$as_me: invalid option: $at_option" >&2
$as_echo "Try \`$0 --help' for more information." >&2
exit 1
;;
esac
done
# Verify our last option didn't require an argument
if test -n "$at_prev"; then :
as_fn_error $? "\`$at_prev' requires an argument"
fi
# The file containing the suite.
at_suite_log=$at_dir/$as_me.log
# Selected test groups.
if test -z "$at_groups$at_recheck"; then
at_groups=$at_groups_all
else
if test -n "$at_recheck" && test -r "$at_suite_log"; then
at_oldfails=`sed -n '
/^Failed tests:$/,/^Skipped tests:$/{
s/^[ ]*\([1-9][0-9]*\):.*/\1/p
}
/^Unexpected passes:$/,/^## Detailed failed tests/{
s/^[ ]*\([1-9][0-9]*\):.*/\1/p
}
/^## Detailed failed tests/q
' "$at_suite_log"`
as_fn_append at_groups "$at_oldfails$as_nl"
fi
# Sort the tests, removing duplicates.
at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'`
fi
if test x"$at_color" = xalways \
|| { test x"$at_color" = xauto && test -t 1; }; then
at_red=`printf '\033[0;31m'`
at_grn=`printf '\033[0;32m'`
at_lgn=`printf '\033[1;32m'`
at_blu=`printf '\033[1;34m'`
at_std=`printf '\033[m'`
else
at_red= at_grn= at_lgn= at_blu= at_std=
fi
# Help message.
if $at_help_p; then
cat <<_ATEOF || at_write_fail=1
Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS]
Run all the tests, or the selected TESTS, given by numeric ranges, and
save a detailed log file. Upon failure, create debugging scripts.
Do not change environment variables directly. Instead, set them via
command line arguments. Set \`AUTOTEST_PATH' to select the executables
to exercise. Each relative directory is expanded as build and source
directories relative to the top level of this distribution.
E.g., from within the build directory /tmp/foo-1.0, invoking this:
$ $0 AUTOTEST_PATH=bin
is equivalent to the following, assuming the source directory is /src/foo-1.0:
PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0
_ATEOF
cat <<_ATEOF || at_write_fail=1
Operation modes:
-h, --help print the help message, then exit
-V, --version print version number, then exit
-c, --clean remove all the files this test suite might create and exit
-l, --list describes all the tests, or the selected TESTS
_ATEOF
cat <<_ATEOF || at_write_fail=1
Execution tuning:
-C, --directory=DIR
change to directory DIR before starting
--color[=never|auto|always]
disable colored test results, or enable even without terminal
-j, --jobs[=N]
Allow N jobs at once; infinite jobs with no arg (default 1)
-k, --keywords=KEYWORDS
select the tests matching all the comma-separated KEYWORDS
multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
--recheck select all tests that failed or passed unexpectedly last time
-e, --errexit abort as soon as a test fails; implies --debug
-v, --verbose force more detailed output
default for debugging scripts
-d, --debug inhibit clean up and top-level logging
default for debugging scripts
-x, --trace enable tests shell tracing
_ATEOF
cat <<_ATEOF || at_write_fail=1
Report bugs to .
General help using GNU software: .
_ATEOF
exit $at_write_fail
fi
# List of tests.
if $at_list_p; then
cat <<_ATEOF || at_write_fail=1
GNU wdiff 1.2.1 test suite: wdiff test groups:
NUM: FILE-NAME:LINE TEST-GROUP-NAME
KEYWORDS
_ATEOF
# Pass an empty line as separator between selected groups and help.
$as_echo "$at_groups$as_nl$as_nl$at_help_all" |
awk 'NF == 1 && FS != ";" {
selected[$ 1] = 1
next
}
/^$/ { FS = ";" }
NF > 0 {
if (selected[$ 1]) {
printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
if ($ 4) {
lmax = 79
indent = " "
line = indent
len = length (line)
n = split ($ 4, a, " ")
for (i = 1; i <= n; i++) {
l = length (a[i]) + 1
if (i > 1 && len + l > lmax) {
print line
line = indent " " a[i]
len = length (line)
} else {
line = line " " a[i]
len += l
}
}
if (n)
print line
}
}
}' || at_write_fail=1
exit $at_write_fail
fi
if $at_version_p; then
$as_echo "$as_me (GNU wdiff 1.2.1)" &&
cat <<\_ATEOF || at_write_fail=1
Copyright (C) 2012 Free Software Foundation, Inc.
This test suite is free software; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
_ATEOF
exit $at_write_fail
fi
# Should we print banners? Yes if more than one test is run.
case $at_groups in #(
*$as_nl* )
at_print_banners=: ;; #(
* ) at_print_banners=false ;;
esac
# Text for banner N, set to a single space once printed.
# Take any -C into account.
if $at_change_dir ; then
test x != "x$at_dir" && cd "$at_dir" \
|| as_fn_error $? "unable to change directory"
at_dir=`pwd`
fi
# Load the config files for any default variable assignments.
for at_file in atconfig atlocal
do
test -r $at_file || continue
. ./$at_file || as_fn_error $? "invalid content: $at_file"
done
# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
: "${at_top_build_prefix=$at_top_builddir}"
# Perform any assignments requested during argument parsing.
eval "$at_debug_args"
# atconfig delivers names relative to the directory the test suite is
# in, but the groups themselves are run in testsuite-dir/group-dir.
if test -n "$at_top_srcdir"; then
builddir=../..
for at_dir_var in srcdir top_srcdir top_build_prefix
do
eval at_val=\$at_$at_dir_var
case $at_val in
[\\/$]* | ?:[\\/]* ) at_prefix= ;;
*) at_prefix=../../ ;;
esac
eval "$at_dir_var=\$at_prefix\$at_val"
done
fi
## -------------------- ##
## Directory structure. ##
## -------------------- ##
# This is the set of directories and files used by this script
# (non-literals are capitalized):
#
# TESTSUITE - the testsuite
# TESTSUITE.log - summarizes the complete testsuite run
# TESTSUITE.dir/ - created during a run, remains after -d or failed test
# + at-groups/ - during a run: status of all groups in run
# | + NNN/ - during a run: meta-data about test group NNN
# | | + check-line - location (source file and line) of current AT_CHECK
# | | + status - exit status of current AT_CHECK
# | | + stdout - stdout of current AT_CHECK
# | | + stder1 - stderr, including trace
# | | + stderr - stderr, with trace filtered out
# | | + test-source - portion of testsuite that defines group
# | | + times - timestamps for computing duration
# | | + pass - created if group passed
# | | + xpass - created if group xpassed
# | | + fail - created if group failed
# | | + xfail - created if group xfailed
# | | + skip - created if group skipped
# + at-stop - during a run: end the run if this file exists
# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction
# + 0..NNN/ - created for each group NNN, remains after -d or failed test
# | + TESTSUITE.log - summarizes the group results
# | + ... - files created during the group
# The directory the whole suite works in.
# Should be absolute to let the user `cd' at will.
at_suite_dir=$at_dir/$as_me.dir
# The file containing the suite ($at_dir might have changed since earlier).
at_suite_log=$at_dir/$as_me.log
# The directory containing helper files per test group.
at_helper_dir=$at_suite_dir/at-groups
# Stop file: if it exists, do not start new jobs.
at_stop_file=$at_suite_dir/at-stop
# The fifo used for the job dispatcher.
at_job_fifo=$at_suite_dir/at-job-fifo
if $at_clean; then
test -d "$at_suite_dir" &&
find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
rm -f -r "$at_suite_dir" "$at_suite_log"
exit $?
fi
# Don't take risks: use only absolute directories in PATH.
#
# For stand-alone test suites (ie. atconfig was not found),
# AUTOTEST_PATH is relative to `.'.
#
# For embedded test suites, AUTOTEST_PATH is relative to the top level
# of the package. Then expand it into build/src parts, since users
# may create executables in both places.
AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"`
at_path=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $AUTOTEST_PATH $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR
case $as_dir in
[\\/]* | ?:[\\/]* )
as_fn_append at_path "$as_dir"
;;
* )
if test -z "$at_top_build_prefix"; then
# Stand-alone test suite.
as_fn_append at_path "$as_dir"
else
# Embedded test suite.
as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR"
as_fn_append at_path "$at_top_srcdir/$as_dir"
fi
;;
esac
done
IFS=$as_save_IFS
# Now build and simplify PATH.
#
# There might be directories that don't exist, but don't redirect
# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
at_new_path=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $at_path
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -d "$as_dir" || continue
case $as_dir in
[\\/]* | ?:[\\/]* ) ;;
* ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;;
esac
case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in
*$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;;
$PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;;
*) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;;
esac
done
IFS=$as_save_IFS
PATH=$at_new_path
export PATH
# Setting up the FDs.
# 5 is the log file. Not to be overwritten if `-d'.
if $at_debug_p; then
at_suite_log=/dev/null
else
: >"$at_suite_log"
fi
exec 5>>"$at_suite_log"
# Banners and logs.
$as_echo "## ---------------------------------- ##
## GNU wdiff 1.2.1 test suite: wdiff. ##
## ---------------------------------- ##"
{
$as_echo "## ---------------------------------- ##
## GNU wdiff 1.2.1 test suite: wdiff. ##
## ---------------------------------- ##"
echo
$as_echo "$as_me: command line was:"
$as_echo " \$ $0 $at_cli_args"
echo
# If ChangeLog exists, list a few lines in case it might help determining
# the exact version.
if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then
$as_echo "## ---------- ##
## ChangeLog. ##
## ---------- ##"
echo
sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog"
echo
fi
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
_ASUNAME
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
$as_echo "PATH: $as_dir"
done
IFS=$as_save_IFS
}
echo
# Contents of the config files.
for at_file in atconfig atlocal
do
test -r $at_file || continue
$as_echo "$as_me: $at_file:"
sed 's/^/| /' $at_file
echo
done
} >&5
## ------------------------- ##
## Autotest shell functions. ##
## ------------------------- ##
# at_fn_banner NUMBER
# -------------------
# Output banner NUMBER, provided the testsuite is running multiple groups and
# this particular banner has not yet been printed.
at_fn_banner ()
{
$at_print_banners || return 0
eval at_banner_text=\$at_banner_text_$1
test "x$at_banner_text" = "x " && return 0
eval "at_banner_text_$1=\" \""
if test -z "$at_banner_text"; then
$at_first || echo
else
$as_echo "$as_nl$at_banner_text$as_nl"
fi
} # at_fn_banner
# at_fn_check_prepare_notrace REASON LINE
# ---------------------------------------
# Perform AT_CHECK preparations for the command at LINE for an untraceable
# command; REASON is the reason for disabling tracing.
at_fn_check_prepare_notrace ()
{
$at_trace_echo "Not enabling shell tracing (command contains $1)"
$as_echo "$2" >"$at_check_line_file"
at_check_trace=: at_check_filter=:
: >"$at_stdout"; : >"$at_stderr"
}
# at_fn_check_prepare_trace LINE
# ------------------------------
# Perform AT_CHECK preparations for the command at LINE for a traceable
# command.
at_fn_check_prepare_trace ()
{
$as_echo "$1" >"$at_check_line_file"
at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace
: >"$at_stdout"; : >"$at_stderr"
}
# at_fn_check_prepare_dynamic COMMAND LINE
# ----------------------------------------
# Decide if COMMAND at LINE is traceable at runtime, and call the appropriate
# preparation function.
at_fn_check_prepare_dynamic ()
{
case $1 in
*$as_nl*)
at_fn_check_prepare_notrace 'an embedded newline' "$2" ;;
*)
at_fn_check_prepare_trace "$2" ;;
esac
}
# at_fn_filter_trace
# ------------------
# Remove the lines in the file "$at_stderr" generated by "set -x" and print
# them to stderr.
at_fn_filter_trace ()
{
mv "$at_stderr" "$at_stder1"
grep '^ *+' "$at_stder1" >&2
grep -v '^ *+' "$at_stder1" >"$at_stderr"
}
# at_fn_log_failure FILE-LIST
# ---------------------------
# Copy the files in the list on stdout with a "> " prefix, and exit the shell
# with a failure exit code.
at_fn_log_failure ()
{
for file
do $as_echo "$file:"; sed 's/^/> /' "$file"; done
echo 1 > "$at_status_file"
exit 1
}
# at_fn_check_skip EXIT-CODE LINE
# -------------------------------
# Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit
# the test group subshell with that same exit code. Use LINE in any report
# about test failure.
at_fn_check_skip ()
{
case $1 in
99) echo 99 > "$at_status_file"; at_failed=:
$as_echo "$2: hard failure"; exit 99;;
77) echo 77 > "$at_status_file"; exit 77;;
esac
}
# at_fn_check_status EXPECTED EXIT-CODE LINE
# ------------------------------------------
# Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing.
# Otherwise, if it is 77 or 99, exit the test group subshell with that same
# exit code; if it is anything else print an error message referring to LINE,
# and fail the test.
at_fn_check_status ()
{
case $2 in
$1 ) ;;
77) echo 77 > "$at_status_file"; exit 77;;
99) echo 99 > "$at_status_file"; at_failed=:
$as_echo "$3: hard failure"; exit 99;;
*) $as_echo "$3: exit code was $2, expected $1"
at_failed=:;;
esac
}
# at_fn_diff_devnull FILE
# -----------------------
# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff
# invocations.
at_fn_diff_devnull ()
{
test -s "$1" || return 0
$at_diff "$at_devnull" "$1"
}
# at_fn_test NUMBER
# -----------------
# Parse out test NUMBER from the tail of this file.
at_fn_test ()
{
eval at_sed=\$at_sed$1
sed "$at_sed" "$at_myself" > "$at_test_source"
}
# at_fn_create_debugging_script
# -----------------------------
# Create the debugging script $at_group_dir/run which will reproduce the
# current test group.
at_fn_create_debugging_script ()
{
{
echo "#! /bin/sh" &&
echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' &&
$as_echo "cd '$at_dir'" &&
$as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" &&
echo 'exit 1'
} >"$at_group_dir/run" &&
chmod +x "$at_group_dir/run"
}
## -------------------------------- ##
## End of autotest shell functions. ##
## -------------------------------- ##
{
$as_echo "## ---------------- ##
## Tested programs. ##
## ---------------- ##"
echo
} >&5
# Report what programs are being tested.
for at_program in : $at_tested
do
test "$at_program" = : && continue
case $at_program in
[\\/]* | ?:[\\/]* ) $at_program_=$at_program ;;
* )
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
test -f "$as_dir/$at_program" && break
done
IFS=$as_save_IFS
at_program_=$as_dir/$at_program ;;
esac
if test -f "$at_program_"; then
{
$as_echo "$at_srcdir/testsuite.at:6: $at_program_ --version"
"$at_program_" --version &5 2>&1
else
as_fn_error $? "cannot find $at_program" "$LINENO" 5
fi
done
{
$as_echo "## ------------------ ##
## Running the tests. ##
## ------------------ ##"
} >&5
at_start_date=`date`
at_start_time=`date +%s 2>/dev/null`
$as_echo "$as_me: starting at: $at_start_date" >&5
# Create the master directory if it doesn't already exist.
as_dir="$at_suite_dir"; as_fn_mkdir_p ||
as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5
# Can we diff with `/dev/null'? DU 5.0 refuses.
if diff /dev/null /dev/null >/dev/null 2>&1; then
at_devnull=/dev/null
else
at_devnull=$at_suite_dir/devnull
>"$at_devnull"
fi
# Use `diff -u' when possible.
if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
then
at_diff='diff -u'
else
at_diff=diff
fi
# Get the last needed group.
for at_group in : $at_groups; do :; done
# Extract the start and end lines of each test group at the tail
# of this file
awk '
BEGIN { FS="" }
/^#AT_START_/ {
start = NR
}
/^#AT_STOP_/ {
test = substr ($ 0, 10)
print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
if (test == "'"$at_group"'") exit
}' "$at_myself" > "$at_suite_dir/at-source-lines" &&
. "$at_suite_dir/at-source-lines" ||
as_fn_error $? "cannot create test line number cache" "$LINENO" 5
rm -f "$at_suite_dir/at-source-lines"
# Set number of jobs for `-j'; avoid more jobs than test groups.
set X $at_groups; shift; at_max_jobs=$#
if test $at_max_jobs -eq 0; then
at_jobs=1
fi
if test $at_jobs -ne 1 &&
{ test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then
at_jobs=$at_max_jobs
fi
# If parallel mode, don't output banners, don't split summary lines.
if test $at_jobs -ne 1; then
at_print_banners=false
at_quiet=:
fi
# Set up helper dirs.
rm -rf "$at_helper_dir" &&
mkdir "$at_helper_dir" &&
cd "$at_helper_dir" &&
{ test -z "$at_groups" || mkdir $at_groups; } ||
as_fn_error $? "testsuite directory setup failed" "$LINENO" 5
# Functions for running a test group. We leave the actual
# test group execution outside of a shell function in order
# to avoid hitting zsh 4.x exit status bugs.
# at_fn_group_prepare
# -------------------
# Prepare for running a test group.
at_fn_group_prepare ()
{
# The directory for additional per-group helper files.
at_job_dir=$at_helper_dir/$at_group
# The file containing the location of the last AT_CHECK.
at_check_line_file=$at_job_dir/check-line
# The file containing the exit status of the last command.
at_status_file=$at_job_dir/status
# The files containing the output of the tested commands.
at_stdout=$at_job_dir/stdout
at_stder1=$at_job_dir/stder1
at_stderr=$at_job_dir/stderr
# The file containing the code for a test group.
at_test_source=$at_job_dir/test-source
# The file containing dates.
at_times_file=$at_job_dir/times
# Be sure to come back to the top test directory.
cd "$at_suite_dir"
# Clearly separate the test groups when verbose.
$at_first || $at_verbose echo
at_group_normalized=$at_group
eval 'while :; do
case $at_group_normalized in #(
'"$at_format"'*) break;;
esac
at_group_normalized=0$at_group_normalized
done'
# Create a fresh directory for the next test group, and enter.
# If one already exists, the user may have invoked ./run from
# within that directory; we remove the contents, but not the
# directory itself, so that we aren't pulling the rug out from
# under the shell's notion of the current directory.
at_group_dir=$at_suite_dir/$at_group_normalized
at_group_log=$at_group_dir/$as_me.log
if test -d "$at_group_dir"; then
find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \;
rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??*
fi ||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5
$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;}
# Be tolerant if the above `rm' was not able to remove the directory.
as_dir="$at_group_dir"; as_fn_mkdir_p
echo 0 > "$at_status_file"
# In verbose mode, append to the log file *and* show on
# the standard output; in quiet mode only write to the log.
if test -z "$at_verbose"; then
at_tee_pipe='tee -a "$at_group_log"'
else
at_tee_pipe='cat >> "$at_group_log"'
fi
}
# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER]
# -------------------------------------------------
# Declare the test group ORDINAL, located at LINE with group description DESC,
# and residing under BANNER. Use PAD to align the status column.
at_fn_group_banner ()
{
at_setup_line="$2"
test -n "$5" && at_fn_banner $5
at_desc="$3"
case $1 in
[0-9]) at_desc_line=" $1: ";;
[0-9][0-9]) at_desc_line=" $1: " ;;
*) at_desc_line="$1: " ;;
esac
as_fn_append at_desc_line "$3$4"
$at_quiet $as_echo_n "$at_desc_line"
echo "# -*- compilation -*-" >> "$at_group_log"
}
# at_fn_group_postprocess
# -----------------------
# Perform cleanup after running a test group.
at_fn_group_postprocess ()
{
# Be sure to come back to the suite directory, in particular
# since below we might `rm' the group directory we are in currently.
cd "$at_suite_dir"
if test ! -f "$at_check_line_file"; then
sed "s/^ */$as_me: WARNING: /" <<_ATEOF
A failure happened in a test group before any test could be
run. This means that test suite is improperly designed. Please
report this failure to .
_ATEOF
$as_echo "$at_setup_line" >"$at_check_line_file"
at_status=99
fi
$at_verbose $as_echo_n "$at_group. $at_setup_line: "
$as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log"
case $at_xfail:$at_status in
yes:0)
at_msg="UNEXPECTED PASS"
at_res=xpass
at_errexit=$at_errexit_p
at_color=$at_red
;;
no:0)
at_msg="ok"
at_res=pass
at_errexit=false
at_color=$at_grn
;;
*:77)
at_msg='skipped ('`cat "$at_check_line_file"`')'
at_res=skip
at_errexit=false
at_color=$at_blu
;;
no:* | *:99)
at_msg='FAILED ('`cat "$at_check_line_file"`')'
at_res=fail
at_errexit=$at_errexit_p
at_color=$at_red
;;
yes:*)
at_msg='expected failure ('`cat "$at_check_line_file"`')'
at_res=xfail
at_errexit=false
at_color=$at_lgn
;;
esac
echo "$at_res" > "$at_job_dir/$at_res"
# In parallel mode, output the summary line only afterwards.
if test $at_jobs -ne 1 && test -n "$at_verbose"; then
$as_echo "$at_desc_line $at_color$at_msg$at_std"
else
# Make sure there is a separator even with long titles.
$as_echo " $at_color$at_msg$at_std"
fi
at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
case $at_status in
0|77)
# $at_times_file is only available if the group succeeded.
# We're not including the group log, so the success message
# is written in the global log separately. But we also
# write to the group log in case they're using -d.
if test -f "$at_times_file"; then
at_log_msg="$at_log_msg ("`sed 1d "$at_times_file"`')'
rm -f "$at_times_file"
fi
$as_echo "$at_log_msg" >> "$at_group_log"
$as_echo "$at_log_msg" >&5
# Cleanup the group directory, unless the user wants the files
# or the success was unexpected.
if $at_debug_p || test $at_res = xpass; then
at_fn_create_debugging_script
if test $at_res = xpass && $at_errexit; then
echo stop > "$at_stop_file"
fi
else
if test -d "$at_group_dir"; then
find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
rm -fr "$at_group_dir"
fi
rm -f "$at_test_source"
fi
;;
*)
# Upon failure, include the log into the testsuite's global
# log. The failure message is written in the group log. It
# is later included in the global log.
$as_echo "$at_log_msg" >> "$at_group_log"
# Upon failure, keep the group directory for autopsy, and create
# the debugging script. With -e, do not start any further tests.
at_fn_create_debugging_script
if $at_errexit; then
echo stop > "$at_stop_file"
fi
;;
esac
}
## ------------ ##
## Driver loop. ##
## ------------ ##
if (set -m && set +m && set +b) >/dev/null 2>&1; then
set +b
at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
else
at_job_control_on=: at_job_control_off=: at_job_group=
fi
for at_signal in 1 2 15; do
trap 'set +x; set +e
$at_job_control_off
at_signal='"$at_signal"'
echo stop > "$at_stop_file"
trap "" $at_signal
at_pgids=
for at_pgid in `jobs -p 2>/dev/null`; do
at_pgids="$at_pgids $at_job_group$at_pgid"
done
test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
wait
if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
echo >&2
fi
at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
set x $at_signame
test 1 -gt 2 && at_signame=$at_signal
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5
$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;}
as_fn_arith 128 + $at_signal && exit_status=$as_val
as_fn_exit $exit_status' $at_signal
done
rm -f "$at_stop_file"
at_first=:
if test $at_jobs -ne 1 &&
rm -f "$at_job_fifo" &&
test -n "$at_job_group" &&
( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
then
# FIFO job dispatcher.
trap 'at_pids=
for at_pid in `jobs -p`; do
at_pids="$at_pids $at_job_group$at_pid"
done
if test -n "$at_pids"; then
at_sig=TSTP
test "${TMOUT+set}" = set && at_sig=STOP
kill -$at_sig $at_pids 2>/dev/null
fi
kill -STOP $$
test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP
echo
# Turn jobs into a list of numbers, starting from 1.
at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p`
set X $at_joblist
shift
for at_group in $at_groups; do
$at_job_control_on 2>/dev/null
(
# Start one test group.
$at_job_control_off
if $at_first; then
exec 7>"$at_job_fifo"
else
exec 6<&-
fi
trap 'set +x; set +e
trap "" PIPE
echo stop > "$at_stop_file"
echo >&7
as_fn_exit 141' PIPE
at_fn_group_prepare
if cd "$at_group_dir" &&
at_fn_test $at_group &&
. "$at_test_source"
then :; else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
at_failed=:
fi
at_fn_group_postprocess
echo >&7
) &
$at_job_control_off
if $at_first; then
at_first=false
exec 6<"$at_job_fifo" 7>"$at_job_fifo"
fi
shift # Consume one token.
if test $# -gt 0; then :; else
read at_token <&6 || break
set x $*
fi
test -f "$at_stop_file" && break
done
exec 7>&-
# Read back the remaining ($at_jobs - 1) tokens.
set X $at_joblist
shift
if test $# -gt 0; then
shift
for at_job
do
read at_token
done <&6
fi
exec 6<&-
wait
else
# Run serially, avoid forks and other potential surprises.
for at_group in $at_groups; do
at_fn_group_prepare
if cd "$at_group_dir" &&
at_fn_test $at_group &&
. "$at_test_source"; then :; else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
at_failed=:
fi
at_fn_group_postprocess
test -f "$at_stop_file" && break
at_first=false
done
fi
# Wrap up the test suite with summary statistics.
cd "$at_helper_dir"
# Use ?..???? when the list must remain sorted, the faster * otherwise.
at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
echo $f; done | sed '/?/d; s,/xpass,,'`
at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
echo $f; done | sed '/?/d; s,/fail,,'`
set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
shift; at_group_count=$#
set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$*
set X $at_xfail_list; shift; at_xfail_count=$#
set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$*
set X $at_skip_list; shift; at_skip_count=$#
as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val
as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val
as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val
# Back to the top directory.
cd "$at_dir"
rm -rf "$at_helper_dir"
# Compute the duration of the suite.
at_stop_date=`date`
at_stop_time=`date +%s 2>/dev/null`
$as_echo "$as_me: ending at: $at_stop_date" >&5
case $at_start_time,$at_stop_time in
[0-9]*,[0-9]*)
as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val
as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val
as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val
as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val
as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val
at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
$as_echo "$as_me: test suite duration: $at_duration" >&5
;;
esac
echo
$as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
echo
{
echo
$as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
echo
} >&5
if test $at_run_count = 1; then
at_result="1 test"
at_were=was
else
at_result="$at_run_count tests"
at_were=were
fi
if $at_errexit_p && test $at_unexpected_count != 0; then
if test $at_xpass_count = 1; then
at_result="$at_result $at_were run, one passed"
else
at_result="$at_result $at_were run, one failed"
fi
at_result="$at_result unexpectedly and inhibited subsequent tests."
at_color=$at_red
else
# Don't you just love exponential explosion of the number of cases?
at_color=$at_red
case $at_xpass_count:$at_fail_count:$at_xfail_count in
# So far, so good.
0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;
# Some unexpected failures
0:*:0) at_result="$at_result $at_were run,
$at_fail_count failed unexpectedly." ;;
# Some failures, both expected and unexpected
0:*:1) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
0:*:*) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
# No unexpected failures, but some xpasses
*:0:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly." ;;
# No expected failures, but failures and xpasses
*:1:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
*:*:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;
# All of them.
*:*:1) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
*:*:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
esac
if test $at_skip_count = 0 && test $at_run_count -gt 1; then
at_result="All $at_result"
fi
fi
# Now put skips in the mix.
case $at_skip_count in
0) ;;
1) at_result="$at_result
1 test was skipped." ;;
*) at_result="$at_result
$at_skip_count tests were skipped." ;;
esac
if test $at_unexpected_count = 0; then
echo "$at_color$at_result$at_std"
echo "$at_result" >&5
else
echo "${at_color}ERROR: $at_result$at_std" >&2
echo "ERROR: $at_result" >&5
{
echo
$as_echo "## ------------------------ ##
## Summary of the failures. ##
## ------------------------ ##"
# Summary of failed and skipped tests.
if test $at_fail_count != 0; then
echo "Failed tests:"
$SHELL "$at_myself" $at_fail_list --list
echo
fi
if test $at_skip_count != 0; then
echo "Skipped tests:"
$SHELL "$at_myself" $at_skip_list --list
echo
fi
if test $at_xpass_count != 0; then
echo "Unexpected passes:"
$SHELL "$at_myself" $at_xpass_list --list
echo
fi
if test $at_fail_count != 0; then
$as_echo "## ---------------------- ##
## Detailed failed tests. ##
## ---------------------- ##"
echo
for at_group in $at_fail_list
do
at_group_normalized=$at_group
eval 'while :; do
case $at_group_normalized in #(
'"$at_format"'*) break;;
esac
at_group_normalized=0$at_group_normalized
done'
cat "$at_suite_dir/$at_group_normalized/$as_me.log"
echo
done
echo
fi
if test -n "$at_top_srcdir"; then
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## ${at_top_build_prefix}config.log ##
_ASBOX
sed 's/^/| /' ${at_top_build_prefix}config.log
echo
fi
} >&5
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## $as_me.log was created. ##
_ASBOX
echo
if $at_debug_p; then
at_msg='per-test log files'
else
at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
fi
$as_echo "Please send $at_msg and all information you think might help:
To:
Subject: [GNU wdiff 1.2.1] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point. Its output may
be found below \`${at_testdir+${at_testdir}/}$as_me.dir'.
"
exit 1
fi
exit 0
## ------------- ##
## Actual tests. ##
## ------------- ##
#AT_START_1
at_fn_group_banner 1 'wdiff.at:25' \
"wdiff output formats" " "
at_xfail=no
(
$as_echo "1. $at_setup_line: testing $at_desc ..."
$at_traceon
cat >wdiff-a.txt <<'_ATEOF'
This is input1
The quick brown fox jumps over the lazy dog.
The hurried orange fox jumps over the lazy dog.
A slow green panda walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
_ATEOF
cat >wdiff-b.txt <<'_ATEOF'
This is input2
The quick brown fox jumps over the lazy dog.
The slow red fox jumps over the lazy dog.
A slow, short green giraffe walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
_ATEOF
{ set +x
$as_echo "$at_srcdir/wdiff.at:44: wdiff wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:44"
( $at_check_trace; wdiff wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "This is [-input1-] {+input2+}
The quick brown fox jumps over the lazy dog.
The [-hurried orange-] {+slow red+} fox jumps over the lazy dog.
A [-slow-] {+slow, short+} green [-panda-] {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:52: wdiff -1 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:52"
( $at_check_trace; wdiff -1 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "This is {+input2+}
The quick brown fox jumps over the lazy dog.
The {+slow red+} fox jumps over the lazy dog.
A {+slow, short+} green {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:52"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:60: wdiff -2 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:60"
( $at_check_trace; wdiff -2 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "This is [-input1-]
The quick brown fox jumps over the lazy dog.
The [-hurried orange-] fox jumps over the lazy dog.
A [-slow-] green [-panda-] walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:60"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:68: wdiff -3 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:68"
( $at_check_trace; wdiff -3 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
======================================================================
[-input1-] {+input2+}
======================================================================
[-hurried orange-] {+slow red+}
======================================================================
[-slow-] {+slow, short+}
======================================================================
[-panda-] {+giraffe+}
======================================================================
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:68"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:81: wdiff -12 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:81"
( $at_check_trace; wdiff -12 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "This is
======================================================================
The quick brown fox jumps over the lazy dog.
The
======================================================================
fox jumps over the lazy dog.
A
======================================================================
green
======================================================================
walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:81"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:97: wdiff -13 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:97"
( $at_check_trace; wdiff -13 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
======================================================================
input2
======================================================================
slow red
======================================================================
slow, short
======================================================================
giraffe
======================================================================
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:97"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:110: wdiff -23 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:110"
( $at_check_trace; wdiff -23 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
======================================================================
input1
======================================================================
hurried orange
======================================================================
slow
======================================================================
panda
======================================================================
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:123: wdiff -123 wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:123"
( $at_check_trace; wdiff -123 wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:125: wdiff -123s wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:125"
( $at_check_trace; wdiff -123s wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "wdiff-a.txt: 39 words 34 87% common 0 0% deleted 5 13% changed
wdiff-b.txt: 40 words 34 85% common 0 0% inserted 6 15% changed
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:125"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:131: wdiff -w\\( -x\\) -y\\<\\< -z\\>\\> wdiff-a.txt wdiff-b.txt"
at_fn_check_prepare_trace "wdiff.at:131"
( $at_check_trace; wdiff -w\( -x\) -y\<\< -z\>\> wdiff-a.txt wdiff-b.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "This is (input1) <>
The quick brown fox jumps over the lazy dog.
The (hurried orange) <> fox jumps over the lazy dog.
A (slow) <> green (panda) <> walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:131"
$at_failed && at_fn_log_failure
$at_traceon; }
set +x
$at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_1
#AT_START_2
at_fn_group_banner 2 'wdiff.at:142' \
"report bad diff binary" " "
at_xfail=no
(
$as_echo "2. $at_setup_line: testing $at_desc ..."
$at_traceon
wdiff_bin="`which wdiff`"
# wish I could use AC_CHECK_PROG([wdiff_bin], [wdiff]) instead
$as_echo "wdiff.at:148" >"$at_check_line_file"
(! test -x "$wdiff_bin") \
&& at_fn_check_skip 99 "$at_srcdir/wdiff.at:148"
cat >foo.txt <<'_ATEOF'
foo
_ATEOF
cat >bar.txt <<'_ATEOF'
bar
_ATEOF
{ set +x
$as_echo "$at_srcdir/wdiff.at:154: env PATH=\"\$PWD\" \"\$wdiff_bin\" foo.txt bar.txt"
at_fn_check_prepare_dynamic "env PATH=\"$PWD\" \"$wdiff_bin\" foo.txt bar.txt" "wdiff.at:154"
( $at_check_trace; env PATH="$PWD" "$wdiff_bin" foo.txt bar.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 2 $at_status "$at_srcdir/wdiff.at:154"
$at_failed && at_fn_log_failure
$at_traceon; }
{ set +x
$as_echo "$at_srcdir/wdiff.at:155: grep \"wdiff: failed to execute diff\" stderr"
at_fn_check_prepare_trace "wdiff.at:155"
( $at_check_trace; grep "wdiff: failed to execute diff" stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/wdiff.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }
cat >diff <<'_ATEOF'
#! /bin/sh
echo "This diff is broken" >&2
exit 27
_ATEOF
chmod +x diff
{ set +x
$as_echo "$at_srcdir/wdiff.at:162: env PATH=\"\$PWD\" \"\$wdiff_bin\" foo.txt bar.txt"
at_fn_check_prepare_dynamic "env PATH=\"$PWD\" \"$wdiff_bin\" foo.txt bar.txt" "wdiff.at:162"
( $at_check_trace; env PATH="$PWD" "$wdiff_bin" foo.txt bar.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "This diff is broken
" | \
$at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 2 $at_status "$at_srcdir/wdiff.at:162"
$at_failed && at_fn_log_failure
$at_traceon; }
set +x
$at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_2
#AT_START_3
at_fn_group_banner 3 'wdiff.at:168' \
"use pager" " "
at_xfail=no
(
$as_echo "3. $at_setup_line: testing $at_desc ..."
$at_traceon
# Due to the istty call in the sources, we have to use screen here.
cat >foo.txt <<'_ATEOF'
start foo end
_ATEOF
cat >bar.txt <<'_ATEOF'
start bar end
_ATEOF
cat >dummypager <<'_ATEOF'
#! /bin/sh
echo "Pager starting."
while read line; do echo "Pager line $line printed."; done
echo "Pager now done."
_ATEOF
chmod +x dummypager
{ set +x
$as_echo "$at_srcdir/wdiff.at:184: screen -D -m -L \\
env PAGER=\"\$PWD/dummypager\" PATH=\"\$PATH\" TERM=dumb LC_ALL=C LANGUAGE=C \\
wdiff -wW -xX -yY -zZ -a foo.txt bar.txt
:"
at_fn_check_prepare_notrace 'an embedded newline' "wdiff.at:184"
( $at_check_trace; screen -D -m -L \
env PAGER="$PWD/dummypager" PATH="$PATH" TERM=dumb LC_ALL=C LANGUAGE=C \
wdiff -wW -xX -yY -zZ -a foo.txt bar.txt
:
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/wdiff.at:184"
$at_failed && at_fn_log_failure
$at_traceon; }
$as_echo "wdiff.at:188" >"$at_check_line_file"
(test ! -f screenlog.0) \
&& at_fn_check_skip 77 "$at_srcdir/wdiff.at:188"
$as_echo "wdiff.at:190" >"$at_check_line_file"
(grep 'terminal type.*not defined' screenlog.0) \
&& at_fn_check_skip 77 "$at_srcdir/wdiff.at:190"
# Need to work around a screen bug which might cause the first
# character to be lost: https://savannah.gnu.org/bugs/index.php?34200
{ set +x
$as_echo "$at_srcdir/wdiff.at:193: tr -d '\\r' < screenlog.0 | sed 's/^ager/Pager/'"
at_fn_check_prepare_notrace 'a shell pipeline' "wdiff.at:193"
( $at_check_trace; tr -d '\r' < screenlog.0 | sed 's/^ager/Pager/'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Pager starting.
Pager line start WfooX YbarZ end printed.
Pager now done.
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/wdiff.at:193"
$at_failed && at_fn_log_failure \
"screenlog.0"
$at_traceon; }
set +x
$at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_3
#AT_START_4
at_fn_group_banner 4 'wdiff.at:201' \
"diff as input" " "
at_xfail=no
(
$as_echo "4. $at_setup_line: testing $at_desc ..."
$at_traceon
cat >foo.txt <<'_ATEOF'
one
two
three in a row
four
five
six
seven
eight
nine
_ATEOF
cat >bar.txt <<'_ATEOF'
one
two
three but not in a row
four
five
six
seven
ate
nine
_ATEOF
{ set +x
$as_echo "$at_srcdir/wdiff.at:225: diff -U1 foo.txt bar.txt | sed 's/\\.txt.*/.txt/'"
at_fn_check_prepare_notrace 'a shell pipeline' "wdiff.at:225"
( $at_check_trace; diff -U1 foo.txt bar.txt | sed 's/\.txt.*/.txt/'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/wdiff.at:225"
$at_failed && at_fn_log_failure
$at_traceon; }
mv stdout foobar.diff
{ set +x
$as_echo "$at_srcdir/wdiff.at:227: wdiff -d -w\"(\" -x\")\" -y\"{\" -z\"}\" foobar.diff"
at_fn_check_prepare_trace "wdiff.at:227"
( $at_check_trace; wdiff -d -w"(" -x")" -y"{" -z"}" foobar.diff
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(-- foo.txt){++ bar.txt}
@@ -2,3 +2,3 @@
two
three {but not} in a row
four
@@ -7,3 +7,3 @@
seven
(eight)
{ate}
nine
" | \
$at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/wdiff.at:227"
$at_failed && at_fn_log_failure
$at_traceon; }
set +x
$at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_4
wdiff-1.2.1/tests/wdiff.at 0000644 0000000 0000000 00000015571 11744500575 012311 0000000 0000000 # -*- shell-script -*-
# wdiff test suite
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
#
# This file is part of GNU wdiff
#
# GNU wdiff 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 3 of the License, or
# (at your option) any later version.
#
# GNU wdiff 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# Notes:
# - "@<:@" is the escape sequence for "["
# - "@:>@" is the escape sequence for "]"
AT_SETUP(wdiff output formats)
dnl --------------------
AT_DATA(wdiff-a.txt,
[This is input1
The quick brown fox jumps over the lazy dog.
The hurried orange fox jumps over the lazy dog.
A slow green panda walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_DATA(wdiff-b.txt,
[This is input2
The quick brown fox jumps over the lazy dog.
The slow red fox jumps over the lazy dog.
A slow, short green giraffe walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_CHECK([wdiff wdiff-a.txt wdiff-b.txt], 1,
[This is @<:@-input1-@:>@ {+input2+}
The quick brown fox jumps over the lazy dog.
The @<:@-hurried orange-@:>@ {+slow red+} fox jumps over the lazy dog.
A @<:@-slow-@:>@ {+slow, short+} green @<:@-panda-@:>@ {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_CHECK([wdiff -1 wdiff-a.txt wdiff-b.txt], 1,
[This is {+input2+}
The quick brown fox jumps over the lazy dog.
The {+slow red+} fox jumps over the lazy dog.
A {+slow, short+} green {+giraffe+} walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_CHECK([wdiff -2 wdiff-a.txt wdiff-b.txt], 1,
[This is @<:@-input1-@:>@
The quick brown fox jumps over the lazy dog.
The @<:@-hurried orange-@:>@ fox jumps over the lazy dog.
A @<:@-slow-@:>@ green @<:@-panda-@:>@ walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_CHECK([wdiff -3 wdiff-a.txt wdiff-b.txt], 1,
[
======================================================================
@<:@-input1-@:>@ {+input2+}
======================================================================
@<:@-hurried orange-@:>@ {+slow red+}
======================================================================
@<:@-slow-@:>@ {+slow, short+}
======================================================================
@<:@-panda-@:>@ {+giraffe+}
======================================================================
])
AT_CHECK([wdiff -12 wdiff-a.txt wdiff-b.txt], 1,
[This is
======================================================================
The quick brown fox jumps over the lazy dog.
The
======================================================================
fox jumps over the lazy dog.
A
======================================================================
green
======================================================================
walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
AT_CHECK([wdiff -13 wdiff-a.txt wdiff-b.txt], 1,
[
======================================================================
input2
======================================================================
slow red
======================================================================
slow, short
======================================================================
giraffe
======================================================================
])
AT_CHECK([wdiff -23 wdiff-a.txt wdiff-b.txt], 1,
[
======================================================================
input1
======================================================================
hurried orange
======================================================================
slow
======================================================================
panda
======================================================================
])
AT_CHECK([wdiff -123 wdiff-a.txt wdiff-b.txt], 1)
AT_CHECK([wdiff -123s wdiff-a.txt wdiff-b.txt], 1,
[wdiff-a.txt: 39 words 34 87% common 0 0% deleted 5 13% changed
wdiff-b.txt: 40 words 34 85% common 0 0% inserted 6 15% changed
])
dnl ' let us quote this to keep emacs syntax highlighting happy
AT_CHECK([wdiff -w\( -x\) -y\<\< -z\>\> wdiff-a.txt wdiff-b.txt], 1,
[This is (input1) <>
The quick brown fox jumps over the lazy dog.
The (hurried orange) <> fox jumps over the lazy dog.
A (slow) <> green (panda) <> walks around a sleeping cat.
The middling red fox jumps over the lazy dog.
])
dnl '
AT_CLEANUP()
AT_SETUP(report bad diff binary)
dnl ----------------------
AT_TESTED([wdiff which env grep])
wdiff_bin="`which wdiff`"
# wish I could use AC_CHECK_PROG([wdiff_bin], [wdiff]) instead
AT_FAIL_IF([! test -x "$wdiff_bin"])
AT_DATA([foo.txt], [foo
])
AT_DATA([bar.txt], [bar
])
AT_CHECK([env PATH="$PWD" "$wdiff_bin" foo.txt bar.txt], 2, [], [stderr])
AT_CHECK([grep "wdiff: failed to execute diff" stderr], 0, [ignore-nolog], [])
AT_DATA([diff], [#! /bin/sh
echo "This diff is broken" >&2
exit 27
])
chmod +x diff
AT_CHECK([env PATH="$PWD" "$wdiff_bin" foo.txt bar.txt], 2, [],
[This diff is broken
])
AT_CLEANUP()
AT_SETUP(use pager)
dnl ---------
# Due to the istty call in the sources, we have to use screen here.
AT_TESTED([wdiff diff env sed tr grep])
AT_DATA([foo.txt], [start foo end
])
AT_DATA([bar.txt], [start bar end
])
AT_DATA([dummypager], [#! /bin/sh
echo "Pager starting."
while read line; do echo "Pager line $line printed."; done
echo "Pager now done."
])
chmod +x dummypager
AT_CHECK([screen -D -m -L \
env PAGER="$PWD/dummypager" PATH="$PATH" TERM=dumb LC_ALL=C LANGUAGE=C \
wdiff -wW -xX -yY -zZ -a foo.txt bar.txt
:], 0, [ignore], [ignore])
AT_SKIP_IF([test ! -f screenlog.0])
AT_CAPTURE_FILE([screenlog.0])
AT_SKIP_IF([grep 'terminal type.*not defined' screenlog.0])
# Need to work around a screen bug which might cause the first
# character to be lost: https://savannah.gnu.org/bugs/index.php?34200
AT_CHECK([tr -d '\r' < screenlog.0 | sed 's/^ager/Pager/'], 0,
[Pager starting.
Pager line start WfooX YbarZ end printed.
Pager now done.
], [])
AT_CLEANUP()
AT_SETUP(diff as input)
dnl -------------
AT_TESTED([wdiff diff])
AT_DATA([foo.txt], [one
two
three in a row
four
five
six
seven
eight
nine
])
AT_DATA([bar.txt], [one
two
three but not in a row
four
five
six
seven
ate
nine
])
AT_CHECK([diff -U1 foo.txt bar.txt | sed 's/\.txt.*/.txt/'], 0, [stdout], [])
mv stdout foobar.diff
AT_CHECK([wdiff -d -w"(" -x")" -y"{" -z"}" foobar.diff], 1,
[(-- foo.txt){++ bar.txt}
@@ -2,3 +2,3 @@
two
three {but not} in a row
four
@@ -7,3 +7,3 @@
seven
(eight)
{ate}
nine
], [])
AT_CLEANUP()
wdiff-1.2.1/tests/package.m4 0000644 0000000 0000000 00000000426 12116513223 012476 0000000 0000000 # Signature of the current package.
m4_define([AT_PACKAGE_NAME], [GNU wdiff])
m4_define([AT_PACKAGE_TARNAME], [wdiff])
m4_define([AT_PACKAGE_VERSION], [1.2.1])
m4_define([AT_PACKAGE_STRING], [GNU wdiff 1.2.1])
m4_define([AT_PACKAGE_BUGREPORT], [wdiff-bugs@gnu.org])
wdiff-1.2.1/config.h.in 0000644 0000000 0000000 00000130017 12116513164 011526 0000000 0000000 /* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to the number of bits in type 'ptrdiff_t'. */
#undef BITSIZEOF_PTRDIFF_T
/* Define to the number of bits in type 'sig_atomic_t'. */
#undef BITSIZEOF_SIG_ATOMIC_T
/* Define to the number of bits in type 'size_t'. */
#undef BITSIZEOF_SIZE_T
/* Define to the number of bits in type 'wchar_t'. */
#undef BITSIZEOF_WCHAR_T
/* Define to the number of bits in type 'wint_t'. */
#undef BITSIZEOF_WINT_T
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define as the bit index in the word where to find bit 0 of the exponent of
'double'. */
#undef DBL_EXPBIT0_BIT
/* Define as the word index where to find the exponent of 'double'. */
#undef DBL_EXPBIT0_WORD
/* Define to 1 if // is a file system root distinct from /. */
#undef DOUBLE_SLASH_IS_DISTINCT_ROOT
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string. */
#undef FUNC_NL_LANGINFO_YESEXPR_WORKS
/* Define to 1 if realpath() can malloc memory, always gives an absolute path,
and handles trailing slash correctly. */
#undef FUNC_REALPATH_WORKS
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module canonicalize-lgpl shall be considered present. */
#undef GNULIB_CANONICALIZE_LGPL
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module fscanf shall be considered present. */
#undef GNULIB_FSCANF
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module malloc-gnu shall be considered present. */
#undef GNULIB_MALLOC_GNU
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module scanf shall be considered present. */
#undef GNULIB_SCANF
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module strerror shall be considered present. */
#undef GNULIB_STRERROR
/* Define to 1 when the gnulib module btowc should be tested. */
#undef GNULIB_TEST_BTOWC
/* Define to 1 when the gnulib module canonicalize_file_name should be tested.
*/
#undef GNULIB_TEST_CANONICALIZE_FILE_NAME
/* Define to 1 when the gnulib module dup2 should be tested. */
#undef GNULIB_TEST_DUP2
/* Define to 1 when the gnulib module environ should be tested. */
#undef GNULIB_TEST_ENVIRON
/* Define to 1 when the gnulib module getdelim should be tested. */
#undef GNULIB_TEST_GETDELIM
/* Define to 1 when the gnulib module getline should be tested. */
#undef GNULIB_TEST_GETLINE
/* Define to 1 when the gnulib module getopt-gnu should be tested. */
#undef GNULIB_TEST_GETOPT_GNU
/* Define to 1 when the gnulib module iswblank should be tested. */
#undef GNULIB_TEST_ISWBLANK
/* Define to 1 when the gnulib module localeconv should be tested. */
#undef GNULIB_TEST_LOCALECONV
/* Define to 1 when the gnulib module lstat should be tested. */
#undef GNULIB_TEST_LSTAT
/* Define to 1 when the gnulib module malloc-posix should be tested. */
#undef GNULIB_TEST_MALLOC_POSIX
/* Define to 1 when the gnulib module mbrtowc should be tested. */
#undef GNULIB_TEST_MBRTOWC
/* Define to 1 when the gnulib module mbsinit should be tested. */
#undef GNULIB_TEST_MBSINIT
/* Define to 1 when the gnulib module mbsrchr should be tested. */
#undef GNULIB_TEST_MBSRCHR
/* Define to 1 when the gnulib module mbtowc should be tested. */
#undef GNULIB_TEST_MBTOWC
/* Define to 1 when the gnulib module memchr should be tested. */
#undef GNULIB_TEST_MEMCHR
/* Define to 1 when the gnulib module nl_langinfo should be tested. */
#undef GNULIB_TEST_NL_LANGINFO
/* Define to 1 when the gnulib module readlink should be tested. */
#undef GNULIB_TEST_READLINK
/* Define to 1 when the gnulib module realloc-posix should be tested. */
#undef GNULIB_TEST_REALLOC_POSIX
/* Define to 1 when the gnulib module realpath should be tested. */
#undef GNULIB_TEST_REALPATH
/* Define to 1 when the gnulib module setenv should be tested. */
#undef GNULIB_TEST_SETENV
/* Define to 1 when the gnulib module stat should be tested. */
#undef GNULIB_TEST_STAT
/* Define to 1 when the gnulib module strerror should be tested. */
#undef GNULIB_TEST_STRERROR
/* Define to 1 when the gnulib module strstr should be tested. */
#undef GNULIB_TEST_STRSTR
/* Define to 1 when the gnulib module vasprintf should be tested. */
#undef GNULIB_TEST_VASPRINTF
/* Define to 1 when the gnulib module wcrtomb should be tested. */
#undef GNULIB_TEST_WCRTOMB
/* Define to 1 when the gnulib module wcwidth should be tested. */
#undef GNULIB_TEST_WCWIDTH
/* Define to 1 if you have the 'alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have 'alloca' after including , a header that
may be supplied by this distribution. */
#undef HAVE_ALLOCA
/* Define to 1 if you have and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the header file. */
#undef HAVE_BP_SYM_H
/* Define to 1 if you have the 'btowc' function. */
#undef HAVE_BTOWC
/* Define to 1 if you have the 'canonicalize_file_name' function. */
#undef HAVE_CANONICALIZE_FILE_NAME
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define to 1 if you have the header file. */
#undef HAVE_CURSES_H
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
don't. */
#undef HAVE_DECL_GETC_UNLOCKED
/* Define to 1 if you have the declaration of `getdelim', and to 0 if you
don't. */
#undef HAVE_DECL_GETDELIM
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#undef HAVE_DECL_GETENV
/* Define to 1 if you have the declaration of `getline', and to 0 if you
don't. */
#undef HAVE_DECL_GETLINE
/* Define to 1 if you have the declaration of `isblank', and to 0 if you
don't. */
#undef HAVE_DECL_ISBLANK
/* Define to 1 if you have the declaration of `iswblank', and to 0 if you
don't. */
#undef HAVE_DECL_ISWBLANK
/* Define to 1 if you have the declaration of `mbrtowc', and to 0 if you
don't. */
#undef HAVE_DECL_MBRTOWC
/* Define to 1 if you have the declaration of `mbsinit', and to 0 if you
don't. */
#undef HAVE_DECL_MBSINIT
/* Define to 1 if you have the declaration of `setenv', and to 0 if you don't.
*/
#undef HAVE_DECL_SETENV
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define to 1 if you have the declaration of `towlower', and to 0 if you
don't. */
#undef HAVE_DECL_TOWLOWER
/* Define to 1 if you have the declaration of `wcrtomb', and to 0 if you
don't. */
#undef HAVE_DECL_WCRTOMB
/* Define to 1 if you have the declaration of `wcwidth', and to 0 if you
don't. */
#undef HAVE_DECL_WCWIDTH
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
don't. */
#undef HAVE_DECL__SNPRINTF
/* Define to 1 if you have the 'dup2' function. */
#undef HAVE_DUP2
/* Define if you have the declaration of environ. */
#undef HAVE_ENVIRON_DECL
/* Define to 1 if you have the header file. */
#undef HAVE_FEATURES_H
/* Define to 1 if you have the `flockfile' function. */
#undef HAVE_FLOCKFILE
/* Define to 1 if you have the `funlockfile' function. */
#undef HAVE_FUNLOCKFILE
/* Define to 1 if you have the 'getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the 'getdelim' function. */
#undef HAVE_GETDELIM
/* Define to 1 if you have the header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long_only' function. */
#undef HAVE_GETOPT_LONG_ONLY
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
/* Define if you have the 'intmax_t' type in or . */
#undef HAVE_INTMAX_T
/* Define to 1 if you have the header file. */
#undef HAVE_INTTYPES_H
/* Define if exists, doesn't clash with , and
declares uintmax_t. */
#undef HAVE_INTTYPES_H_WITH_UINTMAX
/* Define to 1 if you have the 'isblank' function. */
#undef HAVE_ISBLANK
/* Define to 1 if you have the 'iswblank' function. */
#undef HAVE_ISWBLANK
/* Define to 1 if you have the 'iswcntrl' function. */
#undef HAVE_ISWCNTRL
/* Define to 1 if you have the 'iswctype' function. */
#undef HAVE_ISWCTYPE
/* Define if you have and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define to 1 if you have the header file. */
#undef HAVE_LANGINFO_H
/* Define to 1 if you have the header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if the system has the type 'long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the 'lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if your system has a GNU libc compatible 'malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC_GNU
/* Define if the 'malloc' function is POSIX compliant. */
#undef HAVE_MALLOC_POSIX
/* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
config.h and . */
#undef HAVE_MAP_ANONYMOUS
/* Define to 1 if you have the `mbrtowc' function. */
#undef HAVE_MBRTOWC
/* Define to 1 if you have the 'mbsinit' function. */
#undef HAVE_MBSINIT
/* Define to 1 if declares mbstate_t. */
#undef HAVE_MBSTATE_T
/* Define to 1 if you have the header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the 'mprotect' function. */
#undef HAVE_MPROTECT
/* Define to 1 on MSVC platforms that have the "invalid parameter handler"
concept. */
#undef HAVE_MSVC_INVALID_PARAMETER_HANDLER
/* Define to 1 if you have the header file. */
#undef HAVE_NCURSES_H
/* Define to 1 if you have the 'nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
/* Define to 1 if atoll is declared even after undefining macros. */
#undef HAVE_RAW_DECL_ATOLL
/* Define to 1 if btowc is declared even after undefining macros. */
#undef HAVE_RAW_DECL_BTOWC
/* Define to 1 if canonicalize_file_name is declared even after undefining
macros. */
#undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
/* Define to 1 if chdir is declared even after undefining macros. */
#undef HAVE_RAW_DECL_CHDIR
/* Define to 1 if chown is declared even after undefining macros. */
#undef HAVE_RAW_DECL_CHOWN
/* Define to 1 if dprintf is declared even after undefining macros. */
#undef HAVE_RAW_DECL_DPRINTF
/* Define to 1 if dup is declared even after undefining macros. */
#undef HAVE_RAW_DECL_DUP
/* Define to 1 if dup2 is declared even after undefining macros. */
#undef HAVE_RAW_DECL_DUP2
/* Define to 1 if dup3 is declared even after undefining macros. */
#undef HAVE_RAW_DECL_DUP3
/* Define to 1 if duplocale is declared even after undefining macros. */
#undef HAVE_RAW_DECL_DUPLOCALE
/* Define to 1 if endusershell is declared even after undefining macros. */
#undef HAVE_RAW_DECL_ENDUSERSHELL
/* Define to 1 if environ is declared even after undefining macros. */
#undef HAVE_RAW_DECL_ENVIRON
/* Define to 1 if euidaccess is declared even after undefining macros. */
#undef HAVE_RAW_DECL_EUIDACCESS
/* Define to 1 if faccessat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FACCESSAT
/* Define to 1 if fchdir is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FCHDIR
/* Define to 1 if fchmodat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FCHMODAT
/* Define to 1 if fchownat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FCHOWNAT
/* Define to 1 if fdatasync is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FDATASYNC
/* Define to 1 if ffsl is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FFSL
/* Define to 1 if ffsll is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FFSLL
/* Define to 1 if fpurge is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FPURGE
/* Define to 1 if fseeko is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FSEEKO
/* Define to 1 if fstat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FSTAT
/* Define to 1 if fstatat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FSTATAT
/* Define to 1 if fsync is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FSYNC
/* Define to 1 if ftello is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FTELLO
/* Define to 1 if ftruncate is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FTRUNCATE
/* Define to 1 if futimens is declared even after undefining macros. */
#undef HAVE_RAW_DECL_FUTIMENS
/* Define to 1 if getcwd is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETCWD
/* Define to 1 if getdelim is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETDELIM
/* Define to 1 if getdomainname is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETDOMAINNAME
/* Define to 1 if getdtablesize is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETDTABLESIZE
/* Define to 1 if getgroups is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETGROUPS
/* Define to 1 if gethostname is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETHOSTNAME
/* Define to 1 if getline is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETLINE
/* Define to 1 if getloadavg is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETLOADAVG
/* Define to 1 if getlogin is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETLOGIN
/* Define to 1 if getlogin_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETLOGIN_R
/* Define to 1 if getpagesize is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETPAGESIZE
/* Define to 1 if gets is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETS
/* Define to 1 if getsubopt is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETSUBOPT
/* Define to 1 if getusershell is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GETUSERSHELL
/* Define to 1 if grantpt is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GRANTPT
/* Define to 1 if group_member is declared even after undefining macros. */
#undef HAVE_RAW_DECL_GROUP_MEMBER
/* Define to 1 if initstate is declared even after undefining macros. */
#undef HAVE_RAW_DECL_INITSTATE
/* Define to 1 if initstate_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_INITSTATE_R
/* Define to 1 if isatty is declared even after undefining macros. */
#undef HAVE_RAW_DECL_ISATTY
/* Define to 1 if iswctype is declared even after undefining macros. */
#undef HAVE_RAW_DECL_ISWCTYPE
/* Define to 1 if lchmod is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LCHMOD
/* Define to 1 if lchown is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LCHOWN
/* Define to 1 if link is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LINK
/* Define to 1 if linkat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LINKAT
/* Define to 1 if lseek is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LSEEK
/* Define to 1 if lstat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_LSTAT
/* Define to 1 if mbrlen is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MBRLEN
/* Define to 1 if mbrtowc is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MBRTOWC
/* Define to 1 if mbsinit is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MBSINIT
/* Define to 1 if mbsnrtowcs is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MBSNRTOWCS
/* Define to 1 if mbsrtowcs is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MBSRTOWCS
/* Define to 1 if memmem is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MEMMEM
/* Define to 1 if mempcpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MEMPCPY
/* Define to 1 if memrchr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MEMRCHR
/* Define to 1 if mkdirat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKDIRAT
/* Define to 1 if mkdtemp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKDTEMP
/* Define to 1 if mkfifo is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKFIFO
/* Define to 1 if mkfifoat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKFIFOAT
/* Define to 1 if mknod is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKNOD
/* Define to 1 if mknodat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKNODAT
/* Define to 1 if mkostemp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKOSTEMP
/* Define to 1 if mkostemps is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKOSTEMPS
/* Define to 1 if mkstemp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKSTEMP
/* Define to 1 if mkstemps is declared even after undefining macros. */
#undef HAVE_RAW_DECL_MKSTEMPS
/* Define to 1 if nl_langinfo is declared even after undefining macros. */
#undef HAVE_RAW_DECL_NL_LANGINFO
/* Define to 1 if pclose is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PCLOSE
/* Define to 1 if pipe is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PIPE
/* Define to 1 if pipe2 is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PIPE2
/* Define to 1 if popen is declared even after undefining macros. */
#undef HAVE_RAW_DECL_POPEN
/* Define to 1 if posix_openpt is declared even after undefining macros. */
#undef HAVE_RAW_DECL_POSIX_OPENPT
/* Define to 1 if pread is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PREAD
/* Define to 1 if ptsname is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PTSNAME
/* Define to 1 if ptsname_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PTSNAME_R
/* Define to 1 if pwrite is declared even after undefining macros. */
#undef HAVE_RAW_DECL_PWRITE
/* Define to 1 if random is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RANDOM
/* Define to 1 if random_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RANDOM_R
/* Define to 1 if rawmemchr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RAWMEMCHR
/* Define to 1 if readlink is declared even after undefining macros. */
#undef HAVE_RAW_DECL_READLINK
/* Define to 1 if readlinkat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_READLINKAT
/* Define to 1 if realpath is declared even after undefining macros. */
#undef HAVE_RAW_DECL_REALPATH
/* Define to 1 if renameat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RENAMEAT
/* Define to 1 if rmdir is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RMDIR
/* Define to 1 if rpmatch is declared even after undefining macros. */
#undef HAVE_RAW_DECL_RPMATCH
/* Define to 1 if secure_getenv is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SECURE_GETENV
/* Define to 1 if setenv is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETENV
/* Define to 1 if sethostname is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETHOSTNAME
/* Define to 1 if setlocale is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETLOCALE
/* Define to 1 if setstate is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETSTATE
/* Define to 1 if setstate_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETSTATE_R
/* Define to 1 if setusershell is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SETUSERSHELL
/* Define to 1 if sleep is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SLEEP
/* Define to 1 if snprintf is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SNPRINTF
/* Define to 1 if srandom is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SRANDOM
/* Define to 1 if srandom_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SRANDOM_R
/* Define to 1 if stat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STAT
/* Define to 1 if stpcpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STPCPY
/* Define to 1 if stpncpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STPNCPY
/* Define to 1 if strcasestr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRCASESTR
/* Define to 1 if strchrnul is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRCHRNUL
/* Define to 1 if strdup is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRDUP
/* Define to 1 if strerror_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRERROR_R
/* Define to 1 if strncat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRNCAT
/* Define to 1 if strndup is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRNDUP
/* Define to 1 if strnlen is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRNLEN
/* Define to 1 if strpbrk is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRPBRK
/* Define to 1 if strsep is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRSEP
/* Define to 1 if strsignal is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRSIGNAL
/* Define to 1 if strtod is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRTOD
/* Define to 1 if strtok_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRTOK_R
/* Define to 1 if strtoll is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRTOLL
/* Define to 1 if strtoull is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRTOULL
/* Define to 1 if strverscmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_STRVERSCMP
/* Define to 1 if symlink is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SYMLINK
/* Define to 1 if symlinkat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_SYMLINKAT
/* Define to 1 if tmpfile is declared even after undefining macros. */
#undef HAVE_RAW_DECL_TMPFILE
/* Define to 1 if towctrans is declared even after undefining macros. */
#undef HAVE_RAW_DECL_TOWCTRANS
/* Define to 1 if ttyname_r is declared even after undefining macros. */
#undef HAVE_RAW_DECL_TTYNAME_R
/* Define to 1 if unlink is declared even after undefining macros. */
#undef HAVE_RAW_DECL_UNLINK
/* Define to 1 if unlinkat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_UNLINKAT
/* Define to 1 if unlockpt is declared even after undefining macros. */
#undef HAVE_RAW_DECL_UNLOCKPT
/* Define to 1 if unsetenv is declared even after undefining macros. */
#undef HAVE_RAW_DECL_UNSETENV
/* Define to 1 if usleep is declared even after undefining macros. */
#undef HAVE_RAW_DECL_USLEEP
/* Define to 1 if utimensat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_UTIMENSAT
/* Define to 1 if vdprintf is declared even after undefining macros. */
#undef HAVE_RAW_DECL_VDPRINTF
/* Define to 1 if vsnprintf is declared even after undefining macros. */
#undef HAVE_RAW_DECL_VSNPRINTF
/* Define to 1 if waitpid is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WAITPID
/* Define to 1 if wcpcpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCPCPY
/* Define to 1 if wcpncpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCPNCPY
/* Define to 1 if wcrtomb is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCRTOMB
/* Define to 1 if wcscasecmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCASECMP
/* Define to 1 if wcscat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCAT
/* Define to 1 if wcschr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCHR
/* Define to 1 if wcscmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCMP
/* Define to 1 if wcscoll is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCOLL
/* Define to 1 if wcscpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCPY
/* Define to 1 if wcscspn is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSCSPN
/* Define to 1 if wcsdup is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSDUP
/* Define to 1 if wcslen is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSLEN
/* Define to 1 if wcsncasecmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNCASECMP
/* Define to 1 if wcsncat is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNCAT
/* Define to 1 if wcsncmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNCMP
/* Define to 1 if wcsncpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNCPY
/* Define to 1 if wcsnlen is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNLEN
/* Define to 1 if wcsnrtombs is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSNRTOMBS
/* Define to 1 if wcspbrk is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSPBRK
/* Define to 1 if wcsrchr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSRCHR
/* Define to 1 if wcsrtombs is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSRTOMBS
/* Define to 1 if wcsspn is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSSPN
/* Define to 1 if wcsstr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSSTR
/* Define to 1 if wcstok is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSTOK
/* Define to 1 if wcswidth is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSWIDTH
/* Define to 1 if wcsxfrm is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCSXFRM
/* Define to 1 if wctob is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCTOB
/* Define to 1 if wctrans is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCTRANS
/* Define to 1 if wctype is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCTYPE
/* Define to 1 if wcwidth is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WCWIDTH
/* Define to 1 if wmemchr is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMCHR
/* Define to 1 if wmemcmp is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMCMP
/* Define to 1 if wmemcpy is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMCPY
/* Define to 1 if wmemmove is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMMOVE
/* Define to 1 if wmemset is declared even after undefining macros. */
#undef HAVE_RAW_DECL_WMEMSET
/* Define to 1 if _Exit is declared even after undefining macros. */
#undef HAVE_RAW_DECL__EXIT
/* Define to 1 if you have the 'readlink' function. */
#undef HAVE_READLINK
/* Define if the 'realloc' function is POSIX compliant. */
#undef HAVE_REALLOC_POSIX
/* Define to 1 if you have the 'realpath' function. */
#undef HAVE_REALPATH
/* Define to 1 if you have the header file. */
#undef HAVE_SEARCH_H
/* Define to 1 if you have the 'setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
#undef HAVE_SIGNED_SIG_ATOMIC_T
/* Define to 1 if 'wchar_t' is a signed integer type. */
#undef HAVE_SIGNED_WCHAR_T
/* Define to 1 if 'wint_t' is a signed integer type. */
#undef HAVE_SIGNED_WINT_T
/* Define to 1 if you have the 'snprintf' function. */
#undef HAVE_SNPRINTF
/* Define if the return value of the snprintf function is the number of of
bytes (excluding the terminating NUL) that would have been produced if the
buffer had been large enough. */
#undef HAVE_SNPRINTF_RETVAL_C99
/* Define to 1 if you have the header file. */
#undef HAVE_STDINT_H
/* Define if exists, doesn't clash with , and declares
uintmax_t. */
#undef HAVE_STDINT_H_WITH_UINTMAX
/* Define to 1 if you have the header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define to 1 if you have the header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define to 1 if `decimal_point' is a member of `struct lconv'. */
#undef HAVE_STRUCT_LCONV_DECIMAL_POINT
/* Define to 1 if you have the 'symlink' function. */
#undef HAVE_SYMLINK
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_INTTYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the header file. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the header file. */
#undef HAVE_TERMCAP_H
/* Define to 1 if you have the header file. */
#undef HAVE_TERMLIB_H
/* Define to 1 if you have the header file. */
#undef HAVE_TERM_H
/* Define to 1 if you have the `towlower' function. */
#undef HAVE_TOWLOWER
/* Define to 1 if the tputs function is available */
#undef HAVE_TPUTS
/* Define to 1 if you have the `tsearch' function. */
#undef HAVE_TSEARCH
/* Define to 1 if you have the header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the type 'unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if you have the 'vasnprintf' function. */
#undef HAVE_VASNPRINTF
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the header file. */
#undef HAVE_WCHAR_H
/* Define if you have the 'wchar_t' type. */
#undef HAVE_WCHAR_T
/* Define to 1 if you have the 'wcrtomb' function. */
#undef HAVE_WCRTOMB
/* Define to 1 if you have the 'wcscoll' function. */
#undef HAVE_WCSCOLL
/* Define to 1 if you have the `wcslen' function. */
#undef HAVE_WCSLEN
/* Define to 1 if you have the `wcsnlen' function. */
#undef HAVE_WCSNLEN
/* Define to 1 if you have the header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if you have the 'wcwidth' function. */
#undef HAVE_WCWIDTH
/* Define to 1 if you have the header file. */
#undef HAVE_WINSOCK2_H
/* Define if you have the 'wint_t' type. */
#undef HAVE_WINT_T
/* Define to 1 if O_NOATIME works. */
#undef HAVE_WORKING_O_NOATIME
/* Define to 1 if O_NOFOLLOW works. */
#undef HAVE_WORKING_O_NOFOLLOW
/* Define to 1 if you have the header file. */
#undef HAVE_XLOCALE_H
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
/* Define to 1 if you have the '_set_invalid_parameter_handler' function. */
#undef HAVE__SET_INVALID_PARAMETER_HANDLER
/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */
#undef MALLOC_0_IS_NONNULL
/* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */
#undef MAP_ANONYMOUS
/* Define if the mbrtowc function has the NULL pwc argument bug. */
#undef MBRTOWC_NULL_ARG1_BUG
/* Define if the mbrtowc function has the NULL string argument bug. */
#undef MBRTOWC_NULL_ARG2_BUG
/* Define if the mbrtowc function does not return 0 for a NUL character. */
#undef MBRTOWC_NUL_RETVAL_BUG
/* Define if the mbrtowc function returns a wrong return value. */
#undef MBRTOWC_RETVAL_BUG
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Default pager program */
#undef PAGER_PROGRAM
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'ptrdiff_t'. */
#undef PTRDIFF_T_SUFFIX
/* Define to 1 if readlink fails to recognize a trailing slash. */
#undef READLINK_TRAILING_SLASH_BUG
/* Define to 1 if stat needs help when passed a directory name with a trailing
slash */
#undef REPLACE_FUNC_STAT_DIR
/* Define to 1 if stat needs help when passed a file name with a trailing
slash */
#undef REPLACE_FUNC_STAT_FILE
/* Define if nl_langinfo exists but is overridden by gnulib. */
#undef REPLACE_NL_LANGINFO
/* Define to 1 if strerror(0) does not return a message implying success. */
#undef REPLACE_STRERROR_0
/* Define if vasnprintf exists but is overridden by gnulib. */
#undef REPLACE_VASNPRINTF
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
/* Define as the maximum value of type 'size_t', if the system doesn't define
it. */
#ifndef SIZE_MAX
# undef SIZE_MAX
#endif
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'size_t'. */
#undef SIZE_T_SUFFIX
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if the `S_IS*' macros in do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on OS X. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'wchar_t'. */
#undef WCHAR_T_SUFFIX
/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
'wint_t'. */
#undef WINT_T_SUFFIX
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#undef _DARWIN_USE_64_BIT_INODE
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
stat.st_size becomes 64-bit. */
#undef _GL_WINDOWS_64_BIT_ST_SIZE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 on Solaris. */
#undef _LCONV_C99
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
#undef _NETBSD_SOURCE
/* The _Noreturn keyword of C11. */
#if ! (defined _Noreturn \
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|| 0x5110 <= __SUNPRO_C)
# define _Noreturn __attribute__ ((__noreturn__))
# elif defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn
# endif
#endif
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for 'stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define if you want to include , so that it consistently
overrides 's RE_DUP_MAX. */
#undef _REGEX_INCLUDE_LIMITS_H
/* Define if you want regoff_t to be at least as wide POSIX requires. */
#undef _REGEX_LARGE_OFFSETS
/* Define to rpl_ if the getopt replacement functions and variables should be
used. */
#undef __GETOPT_PREFIX
/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
_GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
_GL_INLINE_HEADER_BEGIN contains useful stuff to put
in an include file, before uses of _GL_INLINE.
It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
when FOO is an inline function in the header; see
.
_GL_INLINE_HEADER_END contains useful stuff to put
in the same include file, after uses of _GL_INLINE.
Suppress extern inline with HP-UX cc, as it appears to be broken; see
.
Suppress the use of extern inline on Apple's platforms,
as Libc-825.25 (2012-09-19) is incompatible with it; see
.
Perhaps Apple will fix this some day. */
#if ((__GNUC__ \
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
: 199901L <= __STDC_VERSION__ && !defined __HP_cc) \
&& !defined __APPLE__)
# define _GL_INLINE inline
# define _GL_EXTERN_INLINE extern inline
#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
# if __GNUC_GNU_INLINE__
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
# else
# define _GL_INLINE extern inline
# endif
# define _GL_EXTERN_INLINE extern
#else
# define _GL_INLINE static _GL_UNUSED
# define _GL_EXTERN_INLINE static _GL_UNUSED
#endif
#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
# define _GL_INLINE_HEADER_CONST_PRAGMA
# else
# define _GL_INLINE_HEADER_CONST_PRAGMA \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
# endif
# define _GL_INLINE_HEADER_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
_Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
_GL_INLINE_HEADER_CONST_PRAGMA
# define _GL_INLINE_HEADER_END \
_Pragma ("GCC diagnostic pop")
#else
# define _GL_INLINE_HEADER_BEGIN
# define _GL_INLINE_HEADER_END
#endif
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to long or long long if and don't define. */
#undef intmax_t
/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
__APPLE__ && __MACH__ test for Mac OS X.
__APPLE_CC__ tests for the Apple compiler and its version.
__STDC_VERSION__ tests for the C99 mode. */
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif
/* Define to a type if does not define. */
#undef mbstate_t
/* Define to `int' if does not define. */
#undef mode_t
/* Define to the type of st_nlink in struct stat, or a supertype. */
#undef nlink_t
/* Define to `int' if does not define. */
#undef pid_t
/* Define as the type of the result of subtracting two pointers, if the system
doesn't define it. */
#undef ptrdiff_t
/* Define to rpl_re_comp if the replacement should be used. */
#undef re_comp
/* Define to rpl_re_compile_fastmap if the replacement should be used. */
#undef re_compile_fastmap
/* Define to rpl_re_compile_pattern if the replacement should be used. */
#undef re_compile_pattern
/* Define to rpl_re_exec if the replacement should be used. */
#undef re_exec
/* Define to rpl_re_match if the replacement should be used. */
#undef re_match
/* Define to rpl_re_match_2 if the replacement should be used. */
#undef re_match_2
/* Define to rpl_re_search if the replacement should be used. */
#undef re_search
/* Define to rpl_re_search_2 if the replacement should be used. */
#undef re_search_2
/* Define to rpl_re_set_registers if the replacement should be used. */
#undef re_set_registers
/* Define to rpl_re_set_syntax if the replacement should be used. */
#undef re_set_syntax
/* Define to rpl_re_syntax_options if the replacement should be used. */
#undef re_syntax_options
/* Define to rpl_regcomp if the replacement should be used. */
#undef regcomp
/* Define to rpl_regerror if the replacement should be used. */
#undef regerror
/* Define to rpl_regexec if the replacement should be used. */
#undef regexec
/* Define to rpl_regfree if the replacement should be used. */
#undef regfree
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
#undef restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
previous line. Perhaps some future version of Sun C++ will work with
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif
/* Define to `unsigned int' if does not define. */
#undef size_t
/* Define as a signed type of the same size as size_t. */
#undef ssize_t
/* Define as a marker that can be attached to declarations that might not
be used. This helps to reduce warnings, such as from
GCC -Wunused-parameter. */
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
# define _GL_UNUSED __attribute__ ((__unused__))
#else
# define _GL_UNUSED
#endif
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED
/* The __pure__ attribute was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
/* The __const__ attribute was added in gcc 2.95. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
#else
# define _GL_ATTRIBUTE_CONST /* empty */
#endif
wdiff-1.2.1/README 0000644 0000000 0000000 00000020777 11744500575 010406 0000000 0000000 Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.
`wdiff' is a front-end to GNU `diff'. It compares two files, finding
which words have been deleted or added to the first in order to create
the second. It has many output formats and interacts well with
terminals and pagers (notably with `less'). `wdiff' is particularly
useful when two texts differ only by a few words and paragraphs have
been refilled.
GNU `wdiff' has been written by Franc,ois Pinard. It is an evolving
product, and specifications might change in future releases.
Below, you will find various installation hints on special systems.
Look further down for a mini-FAQ (frequently asked questions).
See file `ABOUT-NLS' for how to customise this program to your language.
See file `COPYING' for copying conditions.
See file `INSTALL' for generic compilation and installation instructions.
See file `NEWS' for a list of major changes in the current release.
See files `AUTHORS' and `THANKS' for a list of contributors.
The canonical distribution point for wdiff is:
ftp://ftp.gnu.org/gnu/wdiff/
The main web site for wdiff is at:
http://www.gnu.org/software/wdiff/
.-------------------.
| Configure options |
`-------------------'
Besides those configure options documented in files `INSTALL' and
`ABOUT-NLS', one extra option may be accepted after `./configure':
- `--enable-experimental[=list]'
to build some or all of the experimental applications that are
part of a wdiff source code release. See the following section
for details.
- `--with-default-pager=PATH'
to use PATH as the default pager for --auto-pager mode for users
that have not set the PAGER environment variable. The environment
variable takes precedence over this setting. If no pager is set,
either through this setting or the environment, then output will
go directly to standard output even in --auto-pager mode.
- `--with-termcap[=LIB]'
to configure termcap for visual formatting of differences.
Termcap support enables the -t command line switch, which will
use underline and standout mode to mark up insertions and
deletions. By default, termcap support is automatically detected,
so --with-termcap without arguments is without effect. use
--without-termcap to disable termcap, or --with-termcap=foo in
case libfoo provides termcap functionality (most notably tputs)
on your system.
.--------------------.
| Experimental tools |
`--------------------'
Additional utilities are included in the source release and can be
enabled by passing `--enable-experimental' to the configure script. It
is possible to select only some of these tools by passing an argument,
e.g. `--enable-experimental="mdiff wdiff2"'.
All of these tools are considered experimental: you are free to use
them, and the maintainers certainly welcome any input as to what does
or does not work with them. On the other hand you shouldn't rely on
them too much, and maintainers might in some cases refuse to address
bugs unless you can contribute to a solution, e.g. by writing a patch.
* `mdiff' studies one or many input files altogether, and discovers
blocks of lines which repeat at more than one place. This program is
still very experimental. Even if much development is needed, it is
quite useful as it stands.
* `wdiff2' is intended as a replacement for `wdiff' that uses `mdiff'
to perform its work. At a certain point in time it closely mirrored
the syntax of `wdiff', but both programs have evloved since then, and
probably have diverged.
* The `unify' program converts between context diffs to unified diffs,
and vice-versa. Some people just prefer one format and despise the
other, it is a religious issue. This program brings peace back on
earth. It has been contributed by Wayne Davison, from Borland.
.---------------------------------.
| Mailing lists and collaboration |
`---------------------------------'
* Your feedback will help us to make a better and more portable package.
Consider documentation errors as bugs, and report them as such. If you
develop anything pertaining to `wdiff' or have suggestions, let us know
and share your findings by writing at `wdiff-bugs@gnu.org'. To subscribe
to the list, see http://lists.gnu.org/mailman/listinfo/wdiff-bugs.
* Please follow these tips when submitting a bug report: A bug report is
an adequate description of the problem: your input, what you expected,
what you got, and why this is wrong. Diffs are welcome, but they only
describe a solution, from which the problem might be uneasy to infer.
If needed, submit actual data files with your report. Small data
files are preferred. Big files may sometimes be necessary, but do
not send them on the mailing list; rather take special arrangement
with the maintainer.
.-------.
| Hints |
`-------'
Here are a few hints which might help installing `wdiff' on some
systems. Most may be applied by temporary presetting environment
variables while calling `./configure'. File `INSTALL' explains this.
* This program does not require termcap, but takes advantage of it
when it is available. You may want to get and install GNU termcap
first from /@prep.ai.mit.edu:pub/gnu/termcap-1.2.tar.gz, or better.
* If you have termcap emulation routines in libcurses.a and you do not
have libtermcap.a, and until I find a way to do better, please use:
./configure LIBS=-lcurses
* If you have both more and less and you prefer more over less, then
prefix the call to configure with your pager selection, as in:
./configure PAGER=more
.-----.
| FAQ |
`-----'
Finally, here is a kind of FAQ for `wdiff', made up of replies I
wrote many times for questions received over email.
Q: How is `wdiff' different from `diff -w'?
`wdiff' finds word differences, ignoring spaces, tabs and
newlines, while `diff -w' finds *line* differences, ignoring
spaces and tabs. Also, each program uses its own output format.
Q: Why not simply apply `diff' to files split one word per line?
You like the way `wdiff' formats its output. And it's speedier too.
Q: Why calling an external `diff'? Could not diff be built in `wdiff'?
It's not fruitful to rewrite another `diff'. I'd rather see
`wdiff' integrated in GNU `diff' than the other way around.
When `wdiff' will have matured enough, it *might* be integrated
into GNU `diff' distribution, or in GNU `diff' itself.
Many user requests for additions to `wdiff' have been postponed
until `wdiff' is integrated in `diff'. However, for the time
being, the integration project has been put on the back burner.
Q: How about `spiff' by Dan Nachbar ?
`spiff' is far more general than `wdiff'. On the other end,
`wdiff' is a lot faster, needs almost no memory, and can afford
handling big files in reasonnable time. Despite its lack of
generality, `wdiff' does one of the most usual jobs, so it
is quite useful after all. I might try retrofitting some of
`spiff' features into `wdiff', but not on short term.
Q: How do I get to `wdiff' documentation?
There are many ways:
1) Calling just `wdiff', without arguments, will summarize
its usage.
2) You can look at the file `wdiff.info' using any ASCII editor,
or even print the file as is.
3) If properly installed, you may browse `wdiff.info' from
inside GNU Emacs by typing the command:
C-u M-x info RET wdiff.info RET .
4) With the standalone Info reader, use `info -f wdiff.info'.
You can find the standalone info reader in file texinfo-3.?.tar.gz
in /pub/gnu from prep.ai.mit.edu: just unpack it and look into
the C subdirectory.
5) If you have TeX, execute the command `make dvi' then
process and print `wdiff.dvi' the usual way.
6) Colin Brough contributed a man page,
describing `wdiff' at level 0.04. The man page will be
distributed and installed along with `wdiff' as long as Colin
will want to maintain it.
Q: Can we use `wdiff' from within GNU Emacs?
Of course. You might be loosing some output features. James
Ganong wrote `collatew.el', generalizing
the Emacs LISP compare-windows function in the spirit of `wdiff'.
Q: How much memory `wdiff' exactly needs?
`wdiff' uses a fixed amount of memory. Long lines or long files
are no handicap. All the true work is done by `diff' under the
scene, and `diff' needs memory itself. GNU `diff' swallows both
files in memory first.
wdiff-1.2.1/Makefile.am 0000644 0000000 0000000 00000006333 12116372456 011551 0000000 0000000 ## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.
SUBDIRS = lib po src doc man
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST =
# --------- #
# ChangeLog #
# --------- #
EXTRA_DIST += ChangeLog
ChangeLog:
LC_ALL=en_US.utf8 \
bzr log --gnu-changelog --include-merged --omit-merges > $@.tmp
cat $@.old >> $@.tmp
mv $@.tmp $@
# -------------- #
# helper scripts #
# -------------- #
EXTRA_DIST += $(top_srcdir)/build-aux/msgitm.pm
EXTRA_DIST += $(top_srcdir)/build-aux/print-po.pl
## ----------- ##
## Test suite. ##
## ----------- ##
# (copied from Makefile.am in libtool CVS 2007-07-11)
# Using `cd' in backquotes may print the directory name, use this instead:
lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
# The testsuite files are evaluated in the order given here.
TESTSUITE = tests/testsuite
TESTSUITE_AT = tests/testsuite.at \
tests/cluster.at \
tests/wdiff.at
EXTRA_DIST += $(srcdir)/$(TESTSUITE) $(TESTSUITE_AT) $(srcdir)/tests/package.m4 m4/gnulib-cache.m4
# Be sure to reexport important environment variables:
TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" \
SHELL="$(SHELL)" CONFIG_SHELL="$(SHELL)" \
CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
F77="$(F77)" FFLAGS="$(FFLAGS)" \
FC="$(FC)" FCFLAGS="$(FCFLAGS)" \
GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
# Use `$(srcdir)' for the benefit of non-GNU makes: this is
# how `testsuite' appears in our dependencies.
$(srcdir)/$(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT) Makefile.am
cd $(srcdir)/tests && \
$(AUTOTEST) `echo $(TESTSUITE_AT) | sed 's,tests/,,g'` -o testsuite.tmp && \
mv -f testsuite.tmp testsuite
$(srcdir)/tests/package.m4: $(srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
} > $(srcdir)/tests/package.m4
tests/atconfig: $(top_builddir)/config.status
$(SHELL) ./config.status tests/atconfig
DISTCLEANFILES = tests/atconfig
CD_TESTDIR = abs_srcdir=`$(lt__cd) $(srcdir) && pwd`; cd tests
# Hook the test suite into the check rule
check-local: tests/atconfig $(srcdir)/$(TESTSUITE) $(bin_SCRIPTS)
$(CD_TESTDIR); \
CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \
$(TESTSUITEFLAGS) AUTOTEST_PATH="src"
# Run the test suite on the *installed* tree.
installcheck-local:
$(CD_TESTDIR); \
CONFIG_SHELL="$(SHELL)" $(SHELL) $$abs_srcdir/$(TESTSUITE) \
$(TESTSUITEFLAGS) AUTOTEST_PATH="$(exec_prefix)/bin"
# We need to remove any file droppings left behind by testsuite
clean-local:
-$(CD_TESTDIR); \
test -f $$abs_srcdir/$(TESTSUITE) && \
$(SHELL) $$abs_srcdir/$(TESTSUITE) --clean
wdiff-1.2.1/COPYING 0000644 0000000 0000000 00000104513 11744500575 010550 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
wdiff-1.2.1/configure.ac 0000644 0000000 0000000 00000006152 12116377313 011777 0000000 0000000 ## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.
AC_INIT([GNU wdiff], [1.2.1], [wdiff-bugs@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
## ------------------------ ##
## Autotest initialisation. ##
## ------------------------ ##
AC_CONFIG_TESTDIR([tests])
AC_SUBST([AUTOM4TE], [${AUTOM4TE=autom4te}])
AC_SUBST([AUTOTEST], ['$(AUTOM4TE) --language=autotest'])
AC_PROG_CC
gl_EARLY
gl_INIT
# GNU help2man creates man pages from --help output; in many cases, this
# is sufficient, and obviates the need to maintain man pages separately.
# However, this means invoking executables, which we generally cannot do
# when cross-compiling, so we test to avoid that (the variable
# "cross_compiling" is set by AC_PROG_CC).
if test $cross_compiling = no; then
AM_MISSING_PROG(HELP2MAN, help2man)
else
HELP2MAN=:
fi
AM_GNU_GETTEXT_VERSION([0.18])
AM_GNU_GETTEXT([external], [need-ngettext])
AC_ARG_WITH([default-pager],
AC_HELP_STRING([--with-default-pager=PATH],
[Use PATH as the pager if the PAGER environment variable isn't set]),
[AS_CASE([$withval],
[yes], [AC_MSG_ERROR([--with-default-pager=PATH requires a PATH])],
[no], [],
[AC_DEFINE_UNQUOTED([PAGER_PROGRAM], ["$withval"], [Default pager program])]
)])
# Handling of experimental applications
AC_ARG_ENABLE([experimental],
AC_HELP_STRING([--enable-experimental],
[enable experimental applications (mdiff, unify, wdiff2)]),
[AS_CASE([$enableval],
[yes], [EXPERIMENTAL="mdiff unify wdiff2"],
[no], [EXPERIMENTAL=""],
[EXPERIMENTAL=$enableval])],
[EXPERIMENTAL=""])
set dummy $EXPERIMENTAL; shift
EXPERIMENTAL_PROGRAMS=""
EXPERIMENTAL_MANS=""
EXPERIMENTAL_TEXI="@clear EXPERIMENTAL"
for experimental_i
do
AS_CASE([$experimental_i],
[mdiff|unify|wdiff2],
[EXPERIMENTAL_PROGRAMS="$EXPERIMENTAL_PROGRAMS $experimental_i\$(EXEEXT)"
EXPERIMENTAL_MANS="$EXPERIMENTAL_MANS $experimental_i.1"
EXPERIMENTAL_TEXI="@set EXPERIMENTAL"],
[AC_MSG_ERROR([unknown experimental $experimental_i])])
done
AC_MSG_NOTICE([Enabled experimental applications: $EXPERIMENTAL])
AC_SUBST([EXPERIMENTAL])
AC_SUBST([EXPERIMENTAL_PROGRAMS])
AC_SUBST([EXPERIMENTAL_MANS])
AC_SUBST([EXPERIMENTAL_TEXI])
# Done handling experimental applications
# termcap/curses handling
AC_ARG_WITH([termcap],
AC_HELP_STRING([--with-termcap@<:@=LIB@:>@],
[use termcap library LIB, e.g. ncursesw]),
[], [with_termcap=auto])
AS_IF([test "x$with_termcap" != xno], [
AC_CHECK_HEADERS([termcap.h termlib.h curses.h ncurses.h term.h])
AS_IF([test "x$with_termcap" = xauto], [
AC_SEARCH_LIBS(tputs, [termcap termlib ncursesw ncurses],
[], [with_termcap=no])
], [
LIBS="-l$with_termcap $LIBS"
])
])
AS_IF([test "x$with_termcap" != xno], [
AC_DEFINE([HAVE_TPUTS], [1], [Define to 1 if the tputs function is available])
])
# Done with termcap/curses
AC_CONFIG_FILES([
Makefile
doc/Makefile
doc/flags.texi
lib/Makefile
lib/po/Makefile.in
man/Makefile
po/Makefile.in
src/Makefile
])
AC_OUTPUT
wdiff-1.2.1/src/ 0000755 0000000 0000000 00000000000 12116513227 010350 5 0000000 0000000 wdiff-1.2.1/src/wdiff.h 0000644 0000000 0000000 00000002600 11744500575 011546 0000000 0000000 /* Shared definitions for GNU wdiff (the package, not the program).
Copyright (C) 1994, 1997, 1998, 2011 Free Software Foundation, Inc.
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include
#if __STDC__
# define voidstar void *
#else
# define voidstar char *
#endif
#include
/* Other header files. */
#include
#include
#include
#ifndef errno
extern int errno;
#endif
#include "error.h"
#include "xalloc.h"
/* Internationalization. */
#include "gettext.h"
#define _(str) gettext (str)
#define N_(str) gettext_noop (str)
/* Debugging the memory allocator. */
#if WITH_DMALLOC
# define MALLOC_FUNC_CHECK
# include
#endif
/* Function prototypes */
FILE *readpipe (char *progname, ...);
FILE *writepipe (char *progname, ...);
wdiff-1.2.1/src/wdiff2.c 0000644 0000000 0000000 00000023510 11744500575 011626 0000000 0000000 /* wdiff -- trampolin to mdiff for comparing on a word per word basis.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
Francois Pinard .
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include "wdiff.h"
#ifndef MDIFF_PROGRAM
# define MDIFF_PROGRAM "mdiff"
#endif
/* Exit codes values. */
#define EXIT_DIFFERENCE 1 /* some differences found */
#define EXIT_ERROR 2 /* any other reason for exit */
#include
#include
#include
const char *program_name; /* name of executing program */
static int quiet = 0; /* if inhibiting mdiff call message */
static char **argument_list = NULL; /* constructed argument list */
static int arguments = 0; /* number of arguments in list */
static int last_is_letters = 0; /* if last argument is option letter(s) */
/*-------------------------------------------.
| Add an argument to the list of arguments. |
`-------------------------------------------*/
static void
add_argument (const char *string)
{
if (arguments % 16 == 0)
argument_list = (char **)
xrealloc (argument_list, (arguments + 16) * sizeof (char *));
argument_list[arguments++] = string ? xstrdup (string) : NULL;
}
/*----------------------------------------------------.
| Add a mere option letter to the list of arguments. |
`----------------------------------------------------*/
static void
add_simple_option (char letter)
{
if (last_is_letters)
{
char *string = argument_list[arguments - 1];
int length = strlen (string);
string = xrealloc (string, length + 2);
string[length] = letter;
string[length + 1] = '\0';
argument_list[arguments - 1] = string;
}
else
{
char buffer[3];
buffer[0] = '-';
buffer[1] = letter;
buffer[2] = '\0';
add_argument (buffer);
last_is_letters = 1;
}
}
/*-----------------------------------------------------------------.
| Add an option letter with an argument to the list of arguments. |
`-----------------------------------------------------------------*/
static void
add_option_with_argument (char letter, const char *argument)
{
char buffer[3];
buffer[0] = '-';
buffer[1] = letter;
buffer[2] = '\0';
add_argument (buffer);
add_argument (argument);
last_is_letters = 0;
}
/*-----------------------------------.
| Prints a more detailed Copyright. |
`-----------------------------------*/
static void
print_copyright (void)
{
fputs (_("\
This program is free software: you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation, either version 3 of the License, or\n\
(at your option) any later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program. If not, see .\n"), stdout);
}
static void
print_version (void)
{
printf ("wdiff (GNU %s) %s\n", PACKAGE, VERSION);
fputs (_("\
\n\
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.\n"), stdout);
fputs (_("\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), stdout);
fputs (_("\
\n\
Written by Franc,ois Pinard .\n"), stdout);
}
/* Option variables. */
struct option const longopts[] = {
{"auto-pager", no_argument, NULL, 'a'},
{"avoid-wraps", no_argument, NULL, 'n'},
{"copyright", no_argument, NULL, 'C'},
{"end-delete", required_argument, NULL, 'x'},
{"end-insert", required_argument, NULL, 'z'},
{"help", no_argument, NULL, 'h'},
{"ignore-case", no_argument, NULL, 'i'},
{"less-mode", no_argument, NULL, 'l'},
{"no-common", no_argument, NULL, '3'},
{"no-deleted", no_argument, NULL, '1'},
{"no-init-term", no_argument, NULL, 'K'}, /* backwards compatibility */
{"no-inserted", no_argument, NULL, '2'},
{"quiet", no_argument, NULL, 'q'},
{"printer", no_argument, NULL, 'p'},
{"start-delete", required_argument, NULL, 'w'},
{"start-insert", required_argument, NULL, 'y'},
{"statistics", no_argument, NULL, 's'},
{"terminal", no_argument, NULL, 't'},
{"version", no_argument, NULL, 'v'},
{0, 0, 0, 0}
};
/*-----------------------------.
| Tell how to use, then exit. |
`-----------------------------*/
static void
usage (int status)
{
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
/* *INDENT-OFF* */
fputs (_("\
wdiff - Compute word differences by internally launching `mdiff -W'.\n\
This program exists mainly to support the now oldish `wdiff' syntax.\n"),
stdout);
fputs ("\n", stdout);
printf (_("\
Usage: %s [OPTION]... FILE1 FILE2\n"),
program_name);
fputs ("\n", stdout);
fputs (_("\
Mandatory arguments to long options are mandatory for short options too.\n"),
stdout);
fputs (_(" -C, --copyright display copyright then exit\n"), stdout);
fputs (_(" -1, --no-deleted inhibit output of deleted words\n"), stdout);
fputs (_(" -2, --no-inserted inhibit output of inserted words\n"), stdout);
fputs (_(" -3, --no-common inhibit output of common words\n"), stdout);
fputs (_(" -a, --auto-pager automatically calls a pager\n"), stdout);
fputs (_(" -h, --help display this help then exit\n"), stdout);
fputs (_(" -i, --ignore-case fold character case while comparing\n"), stdout);
fputs (_(" -l, --less-mode variation of printer mode for \"less\"\n"), stdout);
fputs (_(" -n, --avoid-wraps do not extend fields through newlines\n"), stdout);
fputs (_(" -p, --printer overstrike as for printers\n"), stdout);
fputs (_(" -q, --quiet inhibit the `mdiff' call message\n"), stdout);
fputs (_(" -s, --statistics say how many words deleted, inserted etc.\n"), stdout);
fputs (_(" -t, --terminal use termcap as for terminal displays\n"), stdout);
fputs (_(" -v, --version display program version then exit\n"), stdout);
fputs (_(" -w, --start-delete=STRING string to mark beginning of delete region\n"), stdout);
fputs (_(" -x, --end-delete=STRING string to mark end of delete region\n"), stdout);
fputs (_(" -y, --start-insert=STRING string to mark beginning of insert region\n"), stdout);
fputs (_(" -z, --end-insert=STRING string to mark end of insert region\n"), stdout);
fputs ("\n", stdout);
fputs (_("This program also tells how `mdiff' could have been called directly.\n"), stdout);
fputs ("\n", stdout);
fputs (_("Report bugs to .\n"), stdout);
/* *INDENT-ON* */
}
exit (status);
}
/*---------------.
| Main program. |
`---------------*/
int
main (int argc, char *const argv[])
{
int option_char; /* option character */
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
add_argument (MDIFF_PROGRAM);
add_simple_option ('W');
/* Decode arguments. */
while (option_char = getopt_long (argc, (char **) argv,
"123CKachidlnpqstvw:x:y:z:", longopts,
NULL), option_char != EOF)
switch (option_char)
{
default:
usage (EXIT_ERROR);
case '\0':
break;
case '1':
case '2':
case '3':
add_simple_option (option_char);
break;
case 'C':
print_copyright ();
exit (EXIT_SUCCESS);
case 'K':
/* compatibility option, equal to -t now */
add_simple_option ('t');
break;
case 'a':
add_simple_option ('A');
break;
case 'h':
usage (EXIT_SUCCESS);
case 'c': /* this was -c prior to wdiff 0.5 */
case 'i':
add_simple_option ('i');
break;
case 'l':
add_simple_option ('k');
break;
case 'n':
add_simple_option ('m');
break;
case 'p':
add_simple_option ('o');
break;
case 'q':
quiet = 1;
break;
case 's':
add_simple_option ('v');
break;
case 't':
add_simple_option ('z');
break;
case 'v':
print_version ();
exit (EXIT_SUCCESS);
case 'w':
add_option_with_argument ('Y', optarg);
break;
case 'x':
add_option_with_argument ('Z', optarg);
break;
case 'y':
add_option_with_argument ('Q', optarg);
break;
case 'z':
add_option_with_argument ('R', optarg);
break;
}
if (optind + 2 != argc)
{
error (0, 0, _("missing file arguments"));
usage (EXIT_ERROR);
}
add_argument (argv[optind]);
add_argument (argv[optind + 1]);
if (!quiet)
{
int counter;
/* TRANSLATORS: This and the next string are one message. */
fprintf (stderr, _("Launching `%s"), MDIFF_PROGRAM);
for (counter = 1; counter < arguments; counter++)
fprintf (stderr, " %s", argument_list[counter]);
fprintf (stderr, _("'\n"));
}
add_argument (NULL);
execvp (MDIFF_PROGRAM, argument_list);
/* Should never return. */
exit (EXIT_ERROR);
}
wdiff-1.2.1/src/wdiff.c 0000644 0000000 0000000 00000116125 12116363376 011551 0000000 0000000 /* wdiff -- front end to diff for comparing on a word per word basis.
Copyright (C) 1992, 1997, 1998, 1999, 2009,
2010, 2011, 2012 Free Software Foundation, Inc.
Francois Pinard , 1992.
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include "wdiff.h"
/* Exit codes values. */
#define EXIT_DIFFERENCE 1 /* some differences found */
#define EXIT_ERROR 2 /* any other reason for exit */
/* It is mandatory that some `diff' program is selected for use. The
following definition may also include the complete path. */
#ifndef DIFF_PROGRAM
# define DIFF_PROGRAM "diff"
#endif
/* One may also, optionally, define a default PAGER_PROGRAM. This
might be done using the --with-default-pager=PAGER configure
switch. If PAGER_PROGRAM is undefined and neither the WDIFF_PAGER
nor the PAGER environment variable is set, none will be used. */
/* We do termcap init ourselves, so pass -X.
We might do coloring, so pass -R. */
#define LESS_DEFAULT_OPTS "-X -R"
/* Define the separator lines when output is inhibited. */
#define SEPARATOR_LINE \
"======================================================================"
/* Library declarations. */
#include
#include
#if HAVE_TPUTS
# if HAVE_TERMCAP_H
# include
# else
# if HAVE_TERMLIB_H
# include
# else
# if HAVE_CURSES_H
# include
# else
# if HAVE_NCURSES_H
# include
# endif
# endif
# if HAVE_TERM_H
# include
# endif
# endif
# endif
#endif
#include
#include
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif
#include
#include
#include
#include
#include
static void complete_input_program (void);
/* Declarations. */
/* Option variables. */
struct option const longopts[] = {
{"auto-pager", 0, NULL, 'a'},
{"avoid-wraps", 0, NULL, 'n'},
{"copyright", 0, NULL, 'C'},
{"end-delete", 1, NULL, 'x'},
{"end-insert", 1, NULL, 'z'},
{"help", 0, NULL, 'h'},
{"ignore-case", 0, NULL, 'i'},
{"less-mode", 0, NULL, 'l'},
{"no-common", 0, NULL, '3'},
{"no-deleted", 0, NULL, '1'},
{"no-init-term", 0, NULL, 'K'}, /* backwards compatibility */
{"no-inserted", 0, NULL, '2'},
{"printer", 0, NULL, 'p'},
{"start-delete", 1, NULL, 'w'},
{"start-insert", 1, NULL, 'y'},
{"statistics", 0, NULL, 's'},
{"terminal", 0, NULL, 't'},
{"version", 0, NULL, 'v'},
{"diff-input", 0, NULL, 'd'},
{NULL, 0, NULL, 0}
};
const char *program_name; /* name of executing program */
int inhibit_left; /* inhibit display of left side words */
int inhibit_right; /* inhibit display of left side words */
int inhibit_common; /* inhibit display of common words */
int diff_input; /* expect (unified) diff as input */
int ignore_case; /* ignore case in comparisons */
int show_statistics; /* if printing summary statistics */
int no_wrapping; /* end/restart strings at end of lines */
int autopager; /* if calling the pager automatically */
int overstrike; /* if using printer overstrikes */
int overstrike_for_less; /* if output aimed to the "less" program */
const char *user_delete_start; /* user specified string for start of delete */
const char *user_delete_end; /* user specified string for end of delete */
const char *user_insert_start; /* user specified string for start of insert */
const char *user_insert_end; /* user specified string for end of insert */
int find_termcap; /* initialize the termcap strings */
const char *term_delete_start; /* termcap string for start of delete */
const char *term_delete_end; /* termcap string for end of delete */
const char *term_insert_start; /* termcap string for start of insert */
const char *term_insert_end; /* termcap string for end of insert */
/* Other variables. */
enum copy_mode
{
COPY_NORMAL, /* copy text unemphasized */
COPY_DELETED, /* copy text underlined */
COPY_INSERTED /* copy text bolded */
}
copy_mode;
jmp_buf signal_label; /* where to jump when signal received */
int interrupted; /* set when some signal has been received */
/* Guarantee some value P_tmpdir. */
#ifndef P_tmpdir
# define P_tmpdir "/tmp"
#endif
typedef struct side SIDE; /* all variables for one side */
struct side
{
const char *filename; /* original input file name */
FILE *file; /* original input file */
int position; /* number of words read so far */
int character; /* one character look ahead */
char *temp_name; /* temporary file name */
FILE *temp_file; /* temporary file */
};
SIDE side_array[2]; /* area for holding side descriptions */
SIDE *left_side = &side_array[0];
SIDE *right_side = &side_array[1];
FILE *input_file; /* stream being produced by diff */
int character; /* for reading input_file */
char directive; /* diff directive character */
int argument[4]; /* four diff directive arguments */
FILE *output_file; /* file to which we write output */
int count_total_left; /* count of total words in left file */
int count_total_right; /* count of total words in right file */
int count_isolated_left; /* count of deleted words in left file */
int count_isolated_right; /* count of added words in right file */
int count_changed_left; /* count of changed words in left file */
int count_changed_right; /* count of changed words in right file */
/* Signal processing. */
/*-----------------.
| Signal handler. |
`-----------------*/
static RETSIGTYPE
signal_handler (int number)
{
interrupted = 1;
signal (number, signal_handler);
}
/*----------------------------.
| Prepare to handle signals. |
`----------------------------*/
static void
setup_signals (void)
{
interrupted = 0;
/* Intercept willingful requests for stopping. */
signal (SIGINT, signal_handler);
signal (SIGPIPE, signal_handler);
signal (SIGTERM, signal_handler);
}
/* Terminal initialization. */
static void
initialize_strings (void)
{
#if HAVE_TPUTS
if (find_termcap)
{
const char *name; /* terminal capability name */
char term_buffer[2048]; /* terminal description */
static char *buffer; /* buffer for capabilities */
char *filler; /* cursor into allocated strings */
int success; /* tgetent results */
name = getenv ("TERM");
if (name == NULL)
error (EXIT_ERROR, 0,
_("select a terminal through the TERM environment variable"));
success = tgetent (term_buffer, name);
if (success < 0)
error (EXIT_ERROR, 0, _("could not access the termcap data base"));
if (success == 0)
error (EXIT_ERROR, 0, _("terminal type `%s' is not defined"), name);
buffer = (char *) malloc (strlen (term_buffer));
filler = buffer;
term_delete_start = tgetstr ("us", &filler);
term_delete_end = tgetstr ("ue", &filler);
term_insert_start = tgetstr ("so", &filler);
term_insert_end = tgetstr ("se", &filler);
}
#endif /* HAVE_TPUTS */
/* Ensure some default strings. */
if (!overstrike)
{
if (!term_delete_start && !user_delete_start)
user_delete_start = "[-";
if (!term_delete_end && !user_delete_end)
user_delete_end = "-]";
if (!term_insert_start && !user_insert_start)
user_insert_start = "{+";
if (!term_insert_end && !user_insert_end)
user_insert_end = "+}";
}
}
/* Character input and output. */
#if HAVE_TPUTS
/*-----------------------------------------.
| Write one character for tputs function. |
`-----------------------------------------*/
static int
putc_for_tputs (int chr)
{
return putc (chr, output_file);
}
#endif /* HAVE_TPUTS */
/*---------------------------.
| Indicate start of delete. |
`---------------------------*/
static void
start_of_delete (void)
{
/* Avoid any emphasis if it would be useless. */
if (inhibit_common && (inhibit_right || inhibit_left))
return;
copy_mode = COPY_DELETED;
#if HAVE_TPUTS
if (term_delete_start)
tputs (term_delete_start, 0, putc_for_tputs);
#endif
if (user_delete_start)
fprintf (output_file, "%s", user_delete_start);
}
/*-------------------------.
| Indicate end of delete. |
`-------------------------*/
static void
end_of_delete (void)
{
/* Avoid any emphasis if it would be useless. */
if (inhibit_common && (inhibit_right || inhibit_left))
return;
if (user_delete_end)
fprintf (output_file, "%s", user_delete_end);
#if HAVE_TPUTS
if (term_delete_end)
tputs (term_delete_end, 0, putc_for_tputs);
#endif
copy_mode = COPY_NORMAL;
}
/*---------------------------.
| Indicate start of insert. |
`---------------------------*/
static void
start_of_insert (void)
{
/* Avoid any emphasis if it would be useless. */
if (inhibit_common && (inhibit_right || inhibit_left))
return;
copy_mode = COPY_INSERTED;
#if HAVE_TPUTS
if (term_insert_start)
tputs (term_insert_start, 0, putc_for_tputs);
#endif
if (user_insert_start)
fprintf (output_file, "%s", user_insert_start);
}
/*-------------------------.
| Indicate end of insert. |
`-------------------------*/
static void
end_of_insert (void)
{
/* Avoid any emphasis if it would be useless. */
if (inhibit_common && (inhibit_right || inhibit_left))
return;
if (user_insert_end)
fprintf (output_file, "%s", user_insert_end);
#if HAVE_TPUTS
if (term_insert_end)
tputs (term_insert_end, 0, putc_for_tputs);
#endif
copy_mode = COPY_NORMAL;
}
/*--------------------------------.
| Skip over white space on SIDE. |
`--------------------------------*/
static void
skip_whitespace (SIDE * side)
{
if (interrupted)
longjmp (signal_label, 1);
while (isspace (side->character))
side->character = getc (side->file);
}
/*------------------------------------.
| Skip over non white space on SIDE. |
`------------------------------------*/
static void
skip_word (SIDE * side)
{
if (interrupted)
longjmp (signal_label, 1);
while (side->character != EOF && !isspace (side->character))
side->character = getc (side->file);
side->position++;
}
/*-------------------------------------.
| Copy white space from SIDE to FILE. |
`-------------------------------------*/
static void
copy_whitespace (SIDE * side, FILE * file)
{
if (interrupted)
longjmp (signal_label, 1);
while (isspace (side->character))
{
/* While changing lines, ensure we stop any special display prior
to, and restore the special display after. When copy_mode is
anything else than COPY_NORMAL, file is always output_file. We
care underlining whitespace or overstriking it with itself,
because "less" understands these things as emphasis requests. */
switch (copy_mode)
{
case COPY_NORMAL:
putc (side->character, file);
break;
case COPY_DELETED:
if (side->character == '\n')
{
if (no_wrapping && user_delete_end)
fprintf (output_file, "%s", user_delete_end);
#if HAVE_TPUTS
if (term_delete_end)
tputs (term_delete_end, 0, putc_for_tputs);
#endif
putc ('\n', output_file);
#if HAVE_TPUTS
if (term_delete_start)
tputs (term_delete_start, 0, putc_for_tputs);
#endif
if (no_wrapping && user_delete_start)
fprintf (output_file, "%s", user_delete_start);
}
else if (overstrike_for_less)
{
putc ('_', output_file);
putc ('\b', output_file);
putc (side->character, output_file);
}
else
putc (side->character, output_file);
break;
case COPY_INSERTED:
if (side->character == '\n')
{
if (no_wrapping && user_insert_end)
fprintf (output_file, "%s", user_insert_end);
#if HAVE_TPUTS
if (term_insert_end)
tputs (term_insert_end, 0, putc_for_tputs);
#endif
putc ('\n', output_file);
#if HAVE_TPUTS
if (term_insert_start)
tputs (term_insert_start, 0, putc_for_tputs);
#endif
if (no_wrapping && user_insert_start)
fprintf (output_file, "%s", user_insert_start);
}
else if (overstrike_for_less)
{
putc (side->character, output_file);
putc ('\b', output_file);
putc (side->character, output_file);
}
else
putc (side->character, output_file);
break;
}
/* Advance to next character. */
side->character = getc (side->file);
}
}
/*-----------------------------------------.
| Copy non white space from SIDE to FILE. |
`-----------------------------------------*/
static void
copy_word (SIDE * side, FILE * file)
{
if (interrupted)
longjmp (signal_label, 1);
while (side->character != EOF && !isspace (side->character))
{
/* In printer mode, act according to copy_mode. If copy_mode is not
COPY_NORMAL, we know that file is necessarily output_file. */
if (overstrike)
switch (copy_mode)
{
case COPY_NORMAL:
putc (side->character, file);
break;
case COPY_DELETED:
putc ('_', output_file);
/* Avoid underlining an underscore. */
if (side->character != '_')
{
putc ('\b', output_file);
putc (side->character, output_file);
}
break;
case COPY_INSERTED:
putc (side->character, output_file);
putc ('\b', output_file);
putc (side->character, output_file);
break;
}
else
putc (side->character, file);
side->character = getc (side->file);
}
side->position++;
}
/*-------------------------------------------------------------------------.
| Create a template filename suitable for mkstemp given the temporary |
| directory settings of the system. The method used here closely follows |
| the method used in glibc's tmpfile implementation. |
`-------------------------------------------------------------------------*/
static char *
create_template_filename ()
{
struct stat stat_buffer; /* for checking if file is directory */
const char *dir;
size_t dirlen;
char *tmpl;
dir = getenv ("TMPDIR");
if (dir && (stat (dir, &stat_buffer) == 0)
&& ((stat_buffer.st_mode & S_IFMT) == S_IFDIR))
/* nothing */ ;
else if ((stat (P_tmpdir, &stat_buffer) == 0)
&& ((stat_buffer.st_mode & S_IFMT) == S_IFDIR))
dir = P_tmpdir;
else if ((stat ("/tmp", &stat_buffer) == 0)
&& ((stat_buffer.st_mode & S_IFMT) == S_IFDIR))
dir = "/tmp";
else
{
errno = ENOENT;
return NULL;
}
dirlen = strlen (dir);
while (dirlen > 1 && dir[dirlen - 1] == '/')
dirlen--; /* remove trailing slashes */
/* ensure we have room for "${dir}/wdiff.XXXXXX\0" */
tmpl = xmalloc (dirlen + 1 + 12 + 1);
sprintf (tmpl, "%.*s/wdiff.XXXXXX", (int) dirlen, dir);
return tmpl;
}
/*--------------------------------------------------.
| Create a temporary file for one side of the diff. |
`--------------------------------------------------*/
static void
create_temporary_side (SIDE * side)
{
int fd; /* for file descriptors returned by mkstemp */
/* Select a file name, use it for opening a temporary file and
unlink it right away. We do not need the file name itself
anymore. */
if ((side->temp_name = create_template_filename ()) == NULL)
error (EXIT_ERROR, errno, _("no suitable temporary directory exists"));
if ((fd = mkstemp (side->temp_name)) == -1)
error (EXIT_ERROR, errno, "%s", side->temp_name);
side->file = fdopen (fd, "w+");
if (side->file == NULL)
error (EXIT_ERROR, errno, "%s", side->temp_name);
if (unlink (side->temp_name) != 0)
error (EXIT_ERROR, errno, "%s", side->temp_name);
}
/*--------------------------------------------------------.
| Read unified diff and produce two output files from it. |
`--------------------------------------------------------*/
static void
split_diff (const char *path)
{
FILE *input;
int character;
int start_of_line = 1;
int output_to = 3;
if (path == NULL)
{
input = stdin;
}
else
{
input = fopen (path, "r");
if (input == NULL)
error (EXIT_ERROR, errno, "%s", path);
}
create_temporary_side (left_side);
create_temporary_side (right_side);
while ((character = getc (input)) != EOF)
{
if (start_of_line)
{
start_of_line = 0;
switch (character)
{
case '-':
output_to = 1;
continue;
case '+':
output_to = 2;
continue;
case ' ':
output_to = 3;
continue;
default:
output_to = 3;
break;
}
}
if (output_to & 1)
putc (character, left_side->file);
if (output_to & 2)
putc (character, right_side->file);
start_of_line = (character == '\n' || character == '\r');
}
rewind (left_side->file);
rewind (right_side->file);
}
/*-------------------------------------------------------------------------.
| For a given SIDE, turn original input file in another one, in which each |
| word is on one line. |
`-------------------------------------------------------------------------*/
static void
split_file_into_words (SIDE * side)
{
struct stat stat_buffer; /* for checking if file is directory */
int fd; /* for file descriptors returned by mkstemp */
FILE *input; /* used when copying from non-seekable input */
/* Open files. */
if (!diff_input)
{
if (side->filename == NULL)
{
side->file = stdin;
}
else
{
/* Check and diagnose if the file name is a directory. Or else,
prepare the file for reading. */
if (stat (side->filename, &stat_buffer) != 0)
error (EXIT_ERROR, errno, "%s", side->filename);
if ((stat_buffer.st_mode & S_IFMT) == S_IFDIR)
error (EXIT_ERROR, 0, _("directories not supported"));
side->file = fopen (side->filename, "r");
if (side->file == NULL)
error (EXIT_ERROR, errno, "%s", side->filename);
}
if (fseek (side->file, 0L, SEEK_CUR) != 0)
{
/* Non-seekable input, e.g. stdin or shell process substitution.
Copy the whole input to a temporary local file. Once done,
prepare it for reading. */
input = side->file;
create_temporary_side (side);
while (side->character = getc (input), side->character != EOF)
putc (side->character, side->file);
rewind (side->file);
}
}
side->character = getc (side->file);
side->position = 0;
if ((side->temp_name = create_template_filename ()) == NULL)
error (EXIT_ERROR, errno, _("no suitable temporary directory exists"));
if ((fd = mkstemp (side->temp_name)) == -1)
error (EXIT_ERROR, errno, "%s", side->temp_name);
side->temp_file = fdopen (fd, "w");
if (side->temp_file == NULL)
error (EXIT_ERROR, errno, "%s", side->temp_name);
/* Complete splitting input file into words on output. */
while (side->character != EOF)
{
if (interrupted)
longjmp (signal_label, 1);
skip_whitespace (side);
if (side->character == EOF)
break;
copy_word (side, side->temp_file);
putc ('\n', side->temp_file);
}
fclose (side->temp_file);
}
/*-------------------------------------------------------------------.
| Decode one directive line from INPUT_FILE. The format should be: |
| |
| ARG0 [ , ARG1 ] LETTER ARG2 [ , ARG3 ] \n |
| |
| By default, ARG1 is assumed to have the value of ARG0, and ARG3 is |
| assumed to have the value of ARG2. Return 0 if any error found. |
`-------------------------------------------------------------------*/
static int
decode_directive_line (void)
{
int value; /* last scanned value */
int state; /* ordinal of number being read */
int error; /* if error seen */
error = 0;
state = 0;
value = 0;
while (!error && state < 4)
{
/* Read the next number. ARG0 and ARG2 are mandatory. */
if (isdigit (character))
{
value = 0;
while (isdigit (character))
{
value = 10 * value + character - '0';
character = getc (input_file);
}
}
else if (state != 1 && state != 3)
error = 1;
/* Assign the proper value. */
argument[state] = value;
/* Skip the following character. */
switch (state)
{
case 0:
case 2:
if (character == ',')
character = getc (input_file);
break;
case 1:
if (character == 'a' || character == 'd' || character == 'c')
{
directive = character;
character = getc (input_file);
}
else
error = 1;
break;
case 3:
if (character != '\n')
error = 1;
break;
}
state++;
}
/* Complete reading of the line and return success value. */
while (character != EOF && character != '\n')
character = getc (input_file);
if (character == '\n')
character = getc (input_file);
return !error;
}
/*----------------------------------------------.
| Skip SIDE until some word ORDINAL, included. |
`----------------------------------------------*/
static void
skip_until_ordinal (SIDE * side, int ordinal)
{
while (side->position < ordinal)
{
skip_whitespace (side);
skip_word (side);
}
}
/*----------------------------------------------.
| Copy SIDE until some word ORDINAL, included. |
`----------------------------------------------*/
static void
copy_until_ordinal (SIDE * side, int ordinal)
{
while (side->position < ordinal)
{
copy_whitespace (side, output_file);
copy_word (side, output_file);
}
}
/*-----------------------------------------------------.
| Study diff output and use it to drive reformatting. |
`-----------------------------------------------------*/
static void
reformat_diff_output (void)
{
int resync_left; /* word position for left resynchronisation */
int resync_right; /* word position for rigth resynchronisation */
/* Rewind input files. */
rewind (left_side->file);
left_side->character = getc (left_side->file);
left_side->position = 0;
rewind (right_side->file);
right_side->character = getc (right_side->file);
right_side->position = 0;
/* Process diff output. */
while (1)
{
if (interrupted)
longjmp (signal_label, 1);
/* Skip any line irrelevant to this program. */
while (character != EOF && !isdigit (character))
{
while (character != EOF && character != '\n')
character = getc (input_file);
if (character == '\n')
character = getc (input_file);
}
/* Get out the loop if end of file. */
if (character == EOF)
break;
/* Read, decode and process one directive line. */
if (decode_directive_line ())
{
/* Accumulate statistics about isolated or changed word counts.
Decide the required position on both files to resynchronize
them, just before obeying the directive. Then, reposition
both files first, showing any needed common code along the
road. Be careful to copy common code from the left side if
only deleted code is to be shown. */
switch (directive)
{
case 'a':
count_isolated_right += argument[3] - argument[2] + 1;
resync_left = argument[0];
resync_right = argument[2] - 1;
break;
case 'd':
count_isolated_left += argument[1] - argument[0] + 1;
resync_left = argument[0] - 1;
resync_right = argument[2];
break;
case 'c':
count_changed_left += argument[1] - argument[0] + 1;
count_changed_right += argument[3] - argument[2] + 1;
resync_left = argument[0] - 1;
resync_right = argument[2] - 1;
break;
default:
abort ();
}
if (!inhibit_left)
{
if (!inhibit_common && inhibit_right)
copy_until_ordinal (left_side, resync_left);
else
skip_until_ordinal (left_side, resync_left);
}
if (!inhibit_right)
{
if (inhibit_common)
skip_until_ordinal (right_side, resync_right);
else
copy_until_ordinal (right_side, resync_right);
}
if (!inhibit_common && inhibit_left && inhibit_right)
copy_until_ordinal (right_side, resync_right);
/* Use separator lines to disambiguate the output. */
if (inhibit_left && inhibit_right)
{
if (!inhibit_common)
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
}
else if (inhibit_common)
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
/* Show any deleted code. */
if ((directive == 'd' || directive == 'c') && !inhibit_left)
{
copy_whitespace (left_side, output_file);
start_of_delete ();
copy_word (left_side, output_file);
copy_until_ordinal (left_side, argument[1]);
end_of_delete ();
}
/* Show any inserted code, or ensure skipping over it in case the
right file is used merely to show common words. */
if (directive == 'a' || directive == 'c')
if (inhibit_right)
{
if (!inhibit_common && inhibit_left)
skip_until_ordinal (right_side, argument[3]);
}
else
{
copy_whitespace (right_side, output_file);
start_of_insert ();
copy_word (right_side, output_file);
copy_until_ordinal (right_side, argument[3]);
end_of_insert ();
}
}
}
complete_input_program ();
input_file = 0;
/* Copy remainder of input. Copy from left side if the user wanted to see
only the common code and deleted words. */
if (inhibit_common)
{
if (!inhibit_left || !inhibit_right)
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
}
else if (!inhibit_left && inhibit_right)
{
copy_until_ordinal (left_side, count_total_left);
copy_whitespace (left_side, output_file);
}
else
{
copy_until_ordinal (right_side, count_total_right);
copy_whitespace (right_side, output_file);
}
/* Close input files. */
fclose (left_side->file);
fclose (right_side->file);
}
/* Launch and complete various programs. */
/*-------------------------.
| Lauch the diff program. |
`-------------------------*/
static void
launch_input_program (void)
{
/* Launch the diff program. */
if (ignore_case)
input_file = readpipe (DIFF_PROGRAM, "-i", left_side->temp_name,
right_side->temp_name, NULL);
else
input_file = readpipe (DIFF_PROGRAM, left_side->temp_name,
right_side->temp_name, NULL);
if (!input_file)
error (EXIT_ERROR, errno, "%s", DIFF_PROGRAM);
character = getc (input_file);
}
/*----------------------------.
| Complete the diff program. |
`----------------------------*/
static void
complete_input_program (void)
{
int status;
fclose (input_file);
wait (&status);
if (WIFEXITED (status))
{
status = WEXITSTATUS (status);
if (status == 0 || status == 1)
return;
/* else assume the child printed an error message and exit below */
}
else if (WIFSIGNALED (status))
{
fprintf (stderr, _("%s: input program killed by signal %d\n"),
program_name, (int) WTERMSIG (status));
}
exit (EXIT_ERROR);
}
/*---------------------------------.
| Launch the output pager if any. |
`---------------------------------*/
static void
launch_output_program (void)
{
char *program; /* name of the pager */
/* Check if a output program should be called, and which one. Avoid
all paging if only statistics are needed. */
if (autopager && isatty (fileno (stdout))
&& !(inhibit_left && inhibit_right && inhibit_common))
{
program = getenv ("WDIFF_PAGER");
if (program == NULL)
program = getenv ("PAGER");
#ifdef PAGER_PROGRAM
if (program == NULL)
program = PAGER_PROGRAM;
#endif
}
else
program = NULL;
/* Use stdout as default output. */
output_file = stdout;
/* If we should use a pager, launch it. */
if (program && *program)
{
char *lessenv;
lessenv = getenv ("LESS");
if (lessenv == NULL)
{
setenv ("LESS", LESS_DEFAULT_OPTS, 0);
}
else
{
if (asprintf (&lessenv, "%s %s", LESS_DEFAULT_OPTS, lessenv) == -1)
{
xalloc_die ();
return;
}
else
{
setenv ("LESS", lessenv, 1);
}
}
output_file = writepipe (program, NULL);
if (!output_file)
error (EXIT_ERROR, errno, "%s", program);
}
}
/*-----------------------------.
| Complete the pager program. |
`-----------------------------*/
static void
complete_output_program (void)
{
/* Complete any pending emphasis mode. This would be necessary only if
some signal interrupts the normal operation of the program. */
switch (copy_mode)
{
case COPY_DELETED:
end_of_delete ();
break;
case COPY_INSERTED:
end_of_insert ();
break;
case COPY_NORMAL:
break;
default:
abort ();
}
/* Let the user play at will inside the pager, until s/he exits, before
proceeding any further. */
if (output_file && output_file != stdout)
{
int status;
fclose (output_file);
wait (&status);
if (WIFSIGNALED (status))
{
fprintf (stderr, _("%s: output program killed by signal %d\n"),
program_name, (int) WTERMSIG (status));
exit (EXIT_ERROR);
}
}
}
/*-------------------------------.
| Print accumulated statistics. |
`-------------------------------*/
static void
print_statistics (void)
{
int count_common_left; /* words unchanged in left file */
int count_common_right; /* words unchanged in right file */
count_common_left
= count_total_left - count_isolated_left - count_changed_left;
count_common_right
= count_total_right - count_isolated_right - count_changed_right;
printf (ngettext ("%s: %d word", "%s: %d words", count_total_left),
left_side->filename, count_total_left);
if (count_total_left > 0)
{
printf (ngettext (" %d %.0f%% common", " %d %.0f%% common",
count_common_left), count_common_left,
count_common_left * 100. / count_total_left);
printf (ngettext (" %d %.0f%% deleted", " %d %.0f%% deleted",
count_isolated_left), count_isolated_left,
count_isolated_left * 100. / count_total_left);
printf (ngettext (" %d %.0f%% changed", " %d %.0f%% changed",
count_changed_left), count_changed_left,
count_changed_left * 100. / count_total_left);
}
printf ("\n");
printf (ngettext ("%s: %d word", "%s: %d words", count_total_right),
right_side->filename, count_total_right);
if (count_total_right > 0)
{
printf (ngettext (" %d %.0f%% common", " %d %.0f%% common",
count_common_right), count_common_right,
count_common_right * 100. / count_total_right);
printf (ngettext (" %d %.0f%% inserted", " %d %.0f%% inserted",
count_isolated_right), count_isolated_right,
count_isolated_right * 100. / count_total_right);
printf (ngettext (" %d %.0f%% changed", " %d %.0f%% changed",
count_changed_right), count_changed_right,
count_changed_right * 100. / count_total_right);
}
printf ("\n");
}
/* Main control. */
/*-----------------------------------.
| Prints a more detailed Copyright. |
`-----------------------------------*/
static void
print_copyright (void)
{
fputs (_("\
This program is free software: you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation, either version 3 of the License, or\n\
(at your option) any later version.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program. If not, see .\n"), stdout);
}
/*-----------------------------.
| Tell how to use, then exit. |
`-----------------------------*/
static void
usage (int status)
{
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
/* *INDENT-OFF* */
fputs (_("\
wdiff - Compares words in two files and report differences.\n"),
stdout);
fputs ("\n", stdout);
printf (_("\
Usage: %s [OPTION]... FILE1 FILE2\n\
or: %s -d [OPTION]... [FILE]\n"),
program_name, program_name);
fputs ("\n", stdout);
fputs (_("\
Mandatory arguments to long options are mandatory for short options too.\n"),
stdout);
fputs (_(" -C, --copyright display copyright then exit\n"), stdout);
fputs (_(" -1, --no-deleted inhibit output of deleted words\n"), stdout);
fputs (_(" -2, --no-inserted inhibit output of inserted words\n"), stdout);
fputs (_(" -3, --no-common inhibit output of common words\n"), stdout);
fputs (_(" -a, --auto-pager automatically calls a pager\n"), stdout);
fputs (_(" -d, --diff-input use single unified diff as input\n"), stdout);
fputs (_(" -h, --help display this help then exit\n"), stdout);
fputs (_(" -i, --ignore-case fold character case while comparing\n"), stdout);
fputs (_(" -l, --less-mode variation of printer mode for \"less\"\n"), stdout);
fputs (_(" -n, --avoid-wraps do not extend fields through newlines\n"), stdout);
fputs (_(" -p, --printer overstrike as for printers\n"), stdout);
fputs (_(" -s, --statistics say how many words deleted, inserted etc.\n"), stdout);
fputs (_(" -t, --terminal use termcap as for terminal displays\n"), stdout);
fputs (_(" -v, --version display program version then exit\n"), stdout);
fputs (_(" -w, --start-delete=STRING string to mark beginning of delete region\n"), stdout);
fputs (_(" -x, --end-delete=STRING string to mark end of delete region\n"), stdout);
fputs (_(" -y, --start-insert=STRING string to mark beginning of insert region\n"), stdout);
fputs (_(" -z, --end-insert=STRING string to mark end of insert region\n"), stdout);
fputs ("\n", stdout);
fputs (_("Report bugs to .\n"), stdout);
/* *INDENT-ON* */
}
exit (status);
}
/*---------------.
| Main program. |
`---------------*/
int
main (int argc, char *const argv[])
{
int option_char; /* option character */
/* Decode arguments. */
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
inhibit_left = 0;
inhibit_right = 0;
inhibit_common = 0;
diff_input = 0;
ignore_case = 0;
show_statistics = 0;
no_wrapping = 0;
autopager = 0;
overstrike = 0;
overstrike_for_less = 0;
user_delete_start = NULL;
user_delete_end = NULL;
user_insert_start = NULL;
user_insert_end = NULL;
find_termcap = -1; /* undecided yet */
term_delete_start = NULL;
term_delete_end = NULL;
term_insert_start = NULL;
term_insert_end = NULL;
copy_mode = COPY_NORMAL;
count_total_left = 0;
count_total_right = 0;
count_isolated_left = 0;
count_isolated_right = 0;
count_changed_left = 0;
count_changed_right = 0;
while (option_char = getopt_long (argc, (char **) argv,
"123CKadhilnpstvw:x:y:z:", longopts,
NULL), option_char != EOF)
switch (option_char)
{
case '1':
inhibit_left = 1;
break;
case '2':
inhibit_right = 1;
break;
case '3':
inhibit_common = 1;
break;
case 'C':
print_copyright ();
exit (EXIT_SUCCESS);
case 'a':
autopager = 1;
break;
case 'd':
diff_input = 1;
break;
case 'h':
usage (EXIT_SUCCESS);
case 'i':
ignore_case = 1;
break;
case 'l':
if (find_termcap < 0)
find_termcap = 0;
overstrike = 1;
overstrike_for_less = 1;
break;
case 'n':
no_wrapping = 1;
break;
case 'p':
overstrike = 1;
break;
case 's':
show_statistics = 1;
break;
case 'K':
/* compatibility option, equal to -t now */
/* fall through */
case 't':
#if HAVE_TPUTS
if (find_termcap < 0)
find_termcap = 1;
break;
#else
error (EXIT_ERROR, 0, _("cannot use -t, termcap not available"));
#endif
case 'v':
printf ("wdiff (GNU %s) %s\n", PACKAGE, VERSION);
fputs (_("\
\n\
Copyright (C) 1992, 1997, 1998, 1999, 2009, 2010, 2011, 2012 Free Software\n\
Foundation, Inc.\n"), stdout);
fputs (_("\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), stdout);
fputs (_("\
\n\
Written by Franc,ois Pinard .\n"), stdout);
exit (EXIT_SUCCESS);
case 'w':
user_delete_start = optarg;
break;
case 'x':
user_delete_end = optarg;
break;
case 'y':
user_insert_start = optarg;
break;
case 'z':
user_insert_end = optarg;
break;
default:
usage (EXIT_ERROR);
}
/* If find_termcap still undecided, make it true only if autopager is set
while stdout is directed to a terminal. This decision might be
reversed later, if the pager happens to be "less". */
if (find_termcap < 0)
find_termcap = autopager && isatty (fileno (stdout));
/* Setup file names and signals, then do it all. */
if (diff_input)
{
if (optind + 1 < argc)
{
error (0, 0, _("too many file arguments"));
usage (EXIT_ERROR);
}
if (optind == argc || strcmp (argv[optind], "") == 0
|| strcmp (argv[optind], "-") == 0)
split_diff (NULL);
else
split_diff (argv[optind]);
}
else
{
if (optind + 2 > argc)
{
error (0, 0, _("missing file arguments"));
usage (EXIT_ERROR);
}
if (optind + 2 < argc)
{
error (0, 0, _("too many file arguments"));
usage (EXIT_ERROR);
}
if (strcmp (argv[optind], "") == 0 || strcmp (argv[optind], "-") == 0)
left_side->filename = NULL;
else
left_side->filename = argv[optind];
optind++;
left_side->temp_name = NULL;
if (strcmp (argv[optind], "") == 0 || strcmp (argv[optind], "-") == 0)
right_side->filename = NULL;
else
right_side->filename = argv[optind];
optind++;
right_side->temp_name = NULL;
if (left_side->filename == NULL && right_side->filename == NULL)
error (EXIT_ERROR, 0, _("only one file may be standard input"));
}
setup_signals ();
input_file = NULL;
output_file = NULL;
if (!setjmp (signal_label))
{
split_file_into_words (left_side);
count_total_left = left_side->position;
split_file_into_words (right_side);
count_total_right = right_side->position;
launch_input_program ();
launch_output_program ();
initialize_strings ();
reformat_diff_output ();
}
/* Clean up. Beware that input_file and output_file might not exist, if a
signal occurred early in the program. */
if (input_file)
complete_input_program ();
if (left_side->temp_name)
unlink (left_side->temp_name);
if (right_side->temp_name)
unlink (right_side->temp_name);
if (output_file)
complete_output_program ();
if (interrupted)
exit (EXIT_ERROR);
if (show_statistics)
print_statistics ();
if (count_isolated_left || count_isolated_right
|| count_changed_left || count_changed_right)
exit (EXIT_DIFFERENCE);
exit (EXIT_SUCCESS);
}
wdiff-1.2.1/src/Makefile.am 0000644 0000000 0000000 00000001364 11744500575 012340 0000000 0000000 ## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.
bin_PROGRAMS = wdiff $(EXPERIMENTAL_PROGRAMS)
EXTRA_PROGRAMS = mdiff unify wdiff2
unify_SOURCES = unify.c wdiff.h
wdiff_SOURCES = wdiff.c pipes.c wdiff.h
mdiff_SOURCES = mdiff.c pipes.c wdiff.h
wdiff2_SOURCES = wdiff2.c wdiff.h
unify_LDADD = ../lib/libgnu.a $(LIBINTL)
wdiff_LDADD = ../lib/libgnu.a $(LIBINTL)
mdiff_LDADD = ../lib/libgnu.a $(LIBINTL)
wdiff2_LDADD = ../lib/libgnu.a $(LIBINTL)
AM_CPPFLAGS = -I$(top_srcdir)/lib
DEFS += -DLOCALEDIR=\"$(localedir)\"
../lib/libgnu.a:
test -f $@ || $(MAKE) -C ../lib
wdiff-1.2.1/src/Makefile.in 0000644 0000000 0000000 00000130153 12116513166 012342 0000000 0000000 # Makefile.in generated by automake 1.13.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = wdiff$(EXEEXT) $(EXPERIMENTAL_PROGRAMS)
EXTRA_PROGRAMS = mdiff$(EXEEXT) unify$(EXEEXT) wdiff2$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
$(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/btowc.m4 \
$(top_srcdir)/m4/canonicalize.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/configmake.m4 \
$(top_srcdir)/m4/double-slash-root.m4 $(top_srcdir)/m4/dup2.m4 \
$(top_srcdir)/m4/eealloc.m4 $(top_srcdir)/m4/environ.m4 \
$(top_srcdir)/m4/errno_h.m4 $(top_srcdir)/m4/error.m4 \
$(top_srcdir)/m4/exponentd.m4 $(top_srcdir)/m4/extensions.m4 \
$(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/fcntl-o.m4 \
$(top_srcdir)/m4/float_h.m4 $(top_srcdir)/m4/getdelim.m4 \
$(top_srcdir)/m4/getline.m4 $(top_srcdir)/m4/getopt.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/gnulib-common.m4 \
$(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/include_next.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/iswblank.m4 \
$(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 \
$(top_srcdir)/m4/libunistring-base.m4 \
$(top_srcdir)/m4/localcharset.m4 $(top_srcdir)/m4/locale-fr.m4 \
$(top_srcdir)/m4/locale-ja.m4 $(top_srcdir)/m4/locale-zh.m4 \
$(top_srcdir)/m4/locale_h.m4 $(top_srcdir)/m4/localeconv.m4 \
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \
$(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \
$(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
$(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \
$(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \
$(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \
$(top_srcdir)/m4/msvc-inval.m4 \
$(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \
$(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \
$(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \
$(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/pathmax.m4 \
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf.m4 \
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readlink.m4 \
$(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/regex.m4 \
$(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/size_max.m4 \
$(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \
$(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
$(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdint_h.m4 \
$(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \
$(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \
$(top_srcdir)/m4/strstr.m4 $(top_srcdir)/m4/sys_socket_h.m4 \
$(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_types_h.m4 \
$(top_srcdir)/m4/sys_wait_h.m4 $(top_srcdir)/m4/time_h.m4 \
$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/warn-on-use.m4 \
$(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \
$(top_srcdir)/m4/wcrtomb.m4 $(top_srcdir)/m4/wctype_h.m4 \
$(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \
$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_mdiff_OBJECTS = mdiff.$(OBJEXT) pipes.$(OBJEXT)
mdiff_OBJECTS = $(am_mdiff_OBJECTS)
am__DEPENDENCIES_1 =
mdiff_DEPENDENCIES = ../lib/libgnu.a $(am__DEPENDENCIES_1)
am_unify_OBJECTS = unify.$(OBJEXT)
unify_OBJECTS = $(am_unify_OBJECTS)
unify_DEPENDENCIES = ../lib/libgnu.a $(am__DEPENDENCIES_1)
am_wdiff_OBJECTS = wdiff.$(OBJEXT) pipes.$(OBJEXT)
wdiff_OBJECTS = $(am_wdiff_OBJECTS)
wdiff_DEPENDENCIES = ../lib/libgnu.a $(am__DEPENDENCIES_1)
am_wdiff2_OBJECTS = wdiff2.$(OBJEXT)
wdiff2_OBJECTS = $(am_wdiff2_OBJECTS)
wdiff2_DEPENDENCIES = ../lib/libgnu.a $(am__DEPENDENCIES_1)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(mdiff_SOURCES) $(unify_SOURCES) $(wdiff_SOURCES) \
$(wdiff2_SOURCES)
DIST_SOURCES = $(mdiff_SOURCES) $(unify_SOURCES) $(wdiff_SOURCES) \
$(wdiff2_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkglibexecdir = @pkglibexecdir@
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@
ARFLAGS = @ARFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOM4TE = @AUTOM4TE@
AUTOMAKE = @AUTOMAKE@
AUTOTEST = @AUTOTEST@
AWK = @AWK@
BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONFIG_INCLUDE = @CONFIG_INCLUDE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
ENOLINK_VALUE = @ENOLINK_VALUE@
EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
ERRNO_H = @ERRNO_H@
EXEEXT = @EXEEXT@
EXPERIMENTAL = @EXPERIMENTAL@
EXPERIMENTAL_MANS = @EXPERIMENTAL_MANS@
EXPERIMENTAL_PROGRAMS = @EXPERIMENTAL_PROGRAMS@
EXPERIMENTAL_TEXI = @EXPERIMENTAL_TEXI@
FLOAT_H = @FLOAT_H@
GETOPT_H = @GETOPT_H@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNULIB_ATOLL = @GNULIB_ATOLL@
GNULIB_BTOWC = @GNULIB_BTOWC@
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@
GNULIB_CHDIR = @GNULIB_CHDIR@
GNULIB_CHOWN = @GNULIB_CHOWN@
GNULIB_CLOSE = @GNULIB_CLOSE@
GNULIB_DPRINTF = @GNULIB_DPRINTF@
GNULIB_DUP = @GNULIB_DUP@
GNULIB_DUP2 = @GNULIB_DUP2@
GNULIB_DUP3 = @GNULIB_DUP3@
GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@
GNULIB_ENVIRON = @GNULIB_ENVIRON@
GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@
GNULIB_FACCESSAT = @GNULIB_FACCESSAT@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FCHMODAT = @GNULIB_FCHMODAT@
GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@
GNULIB_FCLOSE = @GNULIB_FCLOSE@
GNULIB_FDATASYNC = @GNULIB_FDATASYNC@
GNULIB_FDOPEN = @GNULIB_FDOPEN@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
GNULIB_FFSL = @GNULIB_FFSL@
GNULIB_FFSLL = @GNULIB_FFSLL@
GNULIB_FGETC = @GNULIB_FGETC@
GNULIB_FGETS = @GNULIB_FGETS@
GNULIB_FOPEN = @GNULIB_FOPEN@
GNULIB_FPRINTF = @GNULIB_FPRINTF@
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
GNULIB_FPURGE = @GNULIB_FPURGE@
GNULIB_FPUTC = @GNULIB_FPUTC@
GNULIB_FPUTS = @GNULIB_FPUTS@
GNULIB_FREAD = @GNULIB_FREAD@
GNULIB_FREOPEN = @GNULIB_FREOPEN@
GNULIB_FSCANF = @GNULIB_FSCANF@
GNULIB_FSEEK = @GNULIB_FSEEK@
GNULIB_FSEEKO = @GNULIB_FSEEKO@
GNULIB_FSTAT = @GNULIB_FSTAT@
GNULIB_FSTATAT = @GNULIB_FSTATAT@
GNULIB_FSYNC = @GNULIB_FSYNC@
GNULIB_FTELL = @GNULIB_FTELL@
GNULIB_FTELLO = @GNULIB_FTELLO@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
GNULIB_FUTIMENS = @GNULIB_FUTIMENS@
GNULIB_FWRITE = @GNULIB_FWRITE@
GNULIB_GETC = @GNULIB_GETC@
GNULIB_GETCHAR = @GNULIB_GETCHAR@
GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
GNULIB_GETGROUPS = @GNULIB_GETGROUPS@
GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
GNULIB_GETLINE = @GNULIB_GETLINE@
GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
GNULIB_GETLOGIN = @GNULIB_GETLOGIN@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@
GNULIB_GRANTPT = @GNULIB_GRANTPT@
GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@
GNULIB_ISATTY = @GNULIB_ISATTY@
GNULIB_ISWBLANK = @GNULIB_ISWBLANK@
GNULIB_ISWCTYPE = @GNULIB_ISWCTYPE@
GNULIB_LCHMOD = @GNULIB_LCHMOD@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LINK = @GNULIB_LINK@
GNULIB_LINKAT = @GNULIB_LINKAT@
GNULIB_LOCALECONV = @GNULIB_LOCALECONV@
GNULIB_LSEEK = @GNULIB_LSEEK@
GNULIB_LSTAT = @GNULIB_LSTAT@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
GNULIB_MBRLEN = @GNULIB_MBRLEN@
GNULIB_MBRTOWC = @GNULIB_MBRTOWC@
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
GNULIB_MBSCHR = @GNULIB_MBSCHR@
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
GNULIB_MBSINIT = @GNULIB_MBSINIT@
GNULIB_MBSLEN = @GNULIB_MBSLEN@
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
GNULIB_MBSNRTOWCS = @GNULIB_MBSNRTOWCS@
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
GNULIB_MBSRTOWCS = @GNULIB_MBSRTOWCS@
GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
GNULIB_MBTOWC = @GNULIB_MBTOWC@
GNULIB_MEMCHR = @GNULIB_MEMCHR@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDIRAT = @GNULIB_MKDIRAT@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKFIFO = @GNULIB_MKFIFO@
GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@
GNULIB_MKNOD = @GNULIB_MKNOD@
GNULIB_MKNODAT = @GNULIB_MKNODAT@
GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@
GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@
GNULIB_MKTIME = @GNULIB_MKTIME@
GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@
GNULIB_NL_LANGINFO = @GNULIB_NL_LANGINFO@
GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@
GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@
GNULIB_PCLOSE = @GNULIB_PCLOSE@
GNULIB_PERROR = @GNULIB_PERROR@
GNULIB_PIPE = @GNULIB_PIPE@
GNULIB_PIPE2 = @GNULIB_PIPE2@
GNULIB_POPEN = @GNULIB_POPEN@
GNULIB_POSIX_OPENPT = @GNULIB_POSIX_OPENPT@
GNULIB_PREAD = @GNULIB_PREAD@
GNULIB_PRINTF = @GNULIB_PRINTF@
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
GNULIB_PTSNAME = @GNULIB_PTSNAME@
GNULIB_PTSNAME_R = @GNULIB_PTSNAME_R@
GNULIB_PUTC = @GNULIB_PUTC@
GNULIB_PUTCHAR = @GNULIB_PUTCHAR@
GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_PUTS = @GNULIB_PUTS@
GNULIB_PWRITE = @GNULIB_PWRITE@
GNULIB_RANDOM = @GNULIB_RANDOM@
GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@
GNULIB_READ = @GNULIB_READ@
GNULIB_READLINK = @GNULIB_READLINK@
GNULIB_READLINKAT = @GNULIB_READLINKAT@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
GNULIB_REALPATH = @GNULIB_REALPATH@
GNULIB_REMOVE = @GNULIB_REMOVE@
GNULIB_RENAME = @GNULIB_RENAME@
GNULIB_RENAMEAT = @GNULIB_RENAMEAT@
GNULIB_RMDIR = @GNULIB_RMDIR@
GNULIB_RPMATCH = @GNULIB_RPMATCH@
GNULIB_SCANF = @GNULIB_SCANF@
GNULIB_SECURE_GETENV = @GNULIB_SECURE_GETENV@
GNULIB_SETENV = @GNULIB_SETENV@
GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@
GNULIB_SETLOCALE = @GNULIB_SETLOCALE@
GNULIB_SLEEP = @GNULIB_SLEEP@
GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
GNULIB_STAT = @GNULIB_STAT@
GNULIB_STDIO_H_NONBLOCKING = @GNULIB_STDIO_H_NONBLOCKING@
GNULIB_STDIO_H_SIGPIPE = @GNULIB_STDIO_H_SIGPIPE@
GNULIB_STPCPY = @GNULIB_STPCPY@
GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
GNULIB_STRERROR = @GNULIB_STRERROR@
GNULIB_STRERROR_R = @GNULIB_STRERROR_R@
GNULIB_STRNCAT = @GNULIB_STRNCAT@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
GNULIB_STRPTIME = @GNULIB_STRPTIME@
GNULIB_STRSEP = @GNULIB_STRSEP@
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
GNULIB_STRSTR = @GNULIB_STRSTR@
GNULIB_STRTOD = @GNULIB_STRTOD@
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
GNULIB_STRTOLL = @GNULIB_STRTOLL@
GNULIB_STRTOULL = @GNULIB_STRTOULL@
GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@
GNULIB_SYMLINK = @GNULIB_SYMLINK@
GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@
GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@
GNULIB_TIMEGM = @GNULIB_TIMEGM@
GNULIB_TIME_R = @GNULIB_TIME_R@
GNULIB_TMPFILE = @GNULIB_TMPFILE@
GNULIB_TOWCTRANS = @GNULIB_TOWCTRANS@
GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@
GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@
GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
GNULIB_UNLINK = @GNULIB_UNLINK@
GNULIB_UNLINKAT = @GNULIB_UNLINKAT@
GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_USLEEP = @GNULIB_USLEEP@
GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@
GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
GNULIB_VDPRINTF = @GNULIB_VDPRINTF@
GNULIB_VFPRINTF = @GNULIB_VFPRINTF@
GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
GNULIB_VFSCANF = @GNULIB_VFSCANF@
GNULIB_VPRINTF = @GNULIB_VPRINTF@
GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
GNULIB_VSCANF = @GNULIB_VSCANF@
GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
GNULIB_WAITPID = @GNULIB_WAITPID@
GNULIB_WCPCPY = @GNULIB_WCPCPY@
GNULIB_WCPNCPY = @GNULIB_WCPNCPY@
GNULIB_WCRTOMB = @GNULIB_WCRTOMB@
GNULIB_WCSCASECMP = @GNULIB_WCSCASECMP@
GNULIB_WCSCAT = @GNULIB_WCSCAT@
GNULIB_WCSCHR = @GNULIB_WCSCHR@
GNULIB_WCSCMP = @GNULIB_WCSCMP@
GNULIB_WCSCOLL = @GNULIB_WCSCOLL@
GNULIB_WCSCPY = @GNULIB_WCSCPY@
GNULIB_WCSCSPN = @GNULIB_WCSCSPN@
GNULIB_WCSDUP = @GNULIB_WCSDUP@
GNULIB_WCSLEN = @GNULIB_WCSLEN@
GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@
GNULIB_WCSNCAT = @GNULIB_WCSNCAT@
GNULIB_WCSNCMP = @GNULIB_WCSNCMP@
GNULIB_WCSNCPY = @GNULIB_WCSNCPY@
GNULIB_WCSNLEN = @GNULIB_WCSNLEN@
GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@
GNULIB_WCSPBRK = @GNULIB_WCSPBRK@
GNULIB_WCSRCHR = @GNULIB_WCSRCHR@
GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@
GNULIB_WCSSPN = @GNULIB_WCSSPN@
GNULIB_WCSSTR = @GNULIB_WCSSTR@
GNULIB_WCSTOK = @GNULIB_WCSTOK@
GNULIB_WCSWIDTH = @GNULIB_WCSWIDTH@
GNULIB_WCSXFRM = @GNULIB_WCSXFRM@
GNULIB_WCTOB = @GNULIB_WCTOB@
GNULIB_WCTOMB = @GNULIB_WCTOMB@
GNULIB_WCTRANS = @GNULIB_WCTRANS@
GNULIB_WCTYPE = @GNULIB_WCTYPE@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
GNULIB_WMEMCHR = @GNULIB_WMEMCHR@
GNULIB_WMEMCMP = @GNULIB_WMEMCMP@
GNULIB_WMEMCPY = @GNULIB_WMEMCPY@
GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@
GNULIB_WMEMSET = @GNULIB_WMEMSET@
GNULIB_WRITE = @GNULIB_WRITE@
GNULIB__EXIT = @GNULIB__EXIT@
GREP = @GREP@
HAVE_ATOLL = @HAVE_ATOLL@
HAVE_BTOWC = @HAVE_BTOWC@
HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
HAVE_CHOWN = @HAVE_CHOWN@
HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@
HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@
HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@
HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@
HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
HAVE_DPRINTF = @HAVE_DPRINTF@
HAVE_DUP2 = @HAVE_DUP2@
HAVE_DUP3 = @HAVE_DUP3@
HAVE_DUPLOCALE = @HAVE_DUPLOCALE@
HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
HAVE_FACCESSAT = @HAVE_FACCESSAT@
HAVE_FCHDIR = @HAVE_FCHDIR@
HAVE_FCHMODAT = @HAVE_FCHMODAT@
HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
HAVE_FDATASYNC = @HAVE_FDATASYNC@
HAVE_FEATURES_H = @HAVE_FEATURES_H@
HAVE_FFSL = @HAVE_FFSL@
HAVE_FFSLL = @HAVE_FFSLL@
HAVE_FSEEKO = @HAVE_FSEEKO@
HAVE_FSTATAT = @HAVE_FSTATAT@
HAVE_FSYNC = @HAVE_FSYNC@
HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_FUTIMENS = @HAVE_FUTIMENS@
HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
HAVE_GETGROUPS = @HAVE_GETGROUPS@
HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
HAVE_GETLOGIN = @HAVE_GETLOGIN@
HAVE_GETOPT_H = @HAVE_GETOPT_H@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_GRANTPT = @HAVE_GRANTPT@
HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_ISWBLANK = @HAVE_ISWBLANK@
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@
HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@
HAVE_LANGINFO_H = @HAVE_LANGINFO_H@
HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@
HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@
HAVE_LCHMOD = @HAVE_LCHMOD@
HAVE_LCHOWN = @HAVE_LCHOWN@
HAVE_LINK = @HAVE_LINK@
HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
HAVE_MBRLEN = @HAVE_MBRLEN@
HAVE_MBRTOWC = @HAVE_MBRTOWC@
HAVE_MBSINIT = @HAVE_MBSINIT@
HAVE_MBSLEN = @HAVE_MBSLEN@
HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
HAVE_MEMCHR = @HAVE_MEMCHR@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDIRAT = @HAVE_MKDIRAT@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
HAVE_MKFIFO = @HAVE_MKFIFO@
HAVE_MKFIFOAT = @HAVE_MKFIFOAT@
HAVE_MKNOD = @HAVE_MKNOD@
HAVE_MKNODAT = @HAVE_MKNODAT@
HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
HAVE_MKSTEMP = @HAVE_MKSTEMP@
HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@
HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@
HAVE_OS_H = @HAVE_OS_H@
HAVE_PCLOSE = @HAVE_PCLOSE@
HAVE_PIPE = @HAVE_PIPE@
HAVE_PIPE2 = @HAVE_PIPE2@
HAVE_POPEN = @HAVE_POPEN@
HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
HAVE_PREAD = @HAVE_PREAD@
HAVE_PTSNAME = @HAVE_PTSNAME@
HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
HAVE_PWRITE = @HAVE_PWRITE@
HAVE_RANDOM = @HAVE_RANDOM@
HAVE_RANDOM_H = @HAVE_RANDOM_H@
HAVE_RANDOM_R = @HAVE_RANDOM_R@
HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
HAVE_READLINK = @HAVE_READLINK@
HAVE_READLINKAT = @HAVE_READLINKAT@
HAVE_REALPATH = @HAVE_REALPATH@
HAVE_RENAMEAT = @HAVE_RENAMEAT@
HAVE_RPMATCH = @HAVE_RPMATCH@
HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
HAVE_SETENV = @HAVE_SETENV@
HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
HAVE_SLEEP = @HAVE_SLEEP@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRPTIME = @HAVE_STRPTIME@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_STRTOD = @HAVE_STRTOD@
HAVE_STRTOLL = @HAVE_STRTOLL@
HAVE_STRTOULL = @HAVE_STRTOULL@
HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
HAVE_SYMLINK = @HAVE_SYMLINK@
HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_TIMEGM = @HAVE_TIMEGM@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNLINKAT = @HAVE_UNLINKAT@
HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_USLEEP = @HAVE_USLEEP@
HAVE_UTIMENSAT = @HAVE_UTIMENSAT@
HAVE_VASPRINTF = @HAVE_VASPRINTF@
HAVE_VDPRINTF = @HAVE_VDPRINTF@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
HAVE_WCHAR_T = @HAVE_WCHAR_T@
HAVE_WCPCPY = @HAVE_WCPCPY@
HAVE_WCPNCPY = @HAVE_WCPNCPY@
HAVE_WCRTOMB = @HAVE_WCRTOMB@
HAVE_WCSCASECMP = @HAVE_WCSCASECMP@
HAVE_WCSCAT = @HAVE_WCSCAT@
HAVE_WCSCHR = @HAVE_WCSCHR@
HAVE_WCSCMP = @HAVE_WCSCMP@
HAVE_WCSCOLL = @HAVE_WCSCOLL@
HAVE_WCSCPY = @HAVE_WCSCPY@
HAVE_WCSCSPN = @HAVE_WCSCSPN@
HAVE_WCSDUP = @HAVE_WCSDUP@
HAVE_WCSLEN = @HAVE_WCSLEN@
HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@
HAVE_WCSNCAT = @HAVE_WCSNCAT@
HAVE_WCSNCMP = @HAVE_WCSNCMP@
HAVE_WCSNCPY = @HAVE_WCSNCPY@
HAVE_WCSNLEN = @HAVE_WCSNLEN@
HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
HAVE_WCSPBRK = @HAVE_WCSPBRK@
HAVE_WCSRCHR = @HAVE_WCSRCHR@
HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
HAVE_WCSSPN = @HAVE_WCSSPN@
HAVE_WCSSTR = @HAVE_WCSSTR@
HAVE_WCSTOK = @HAVE_WCSTOK@
HAVE_WCSWIDTH = @HAVE_WCSWIDTH@
HAVE_WCSXFRM = @HAVE_WCSXFRM@
HAVE_WCTRANS_T = @HAVE_WCTRANS_T@
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
HAVE_WCTYPE_T = @HAVE_WCTYPE_T@
HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
HAVE_WINT_T = @HAVE_WINT_T@
HAVE_WMEMCHR = @HAVE_WMEMCHR@
HAVE_WMEMCMP = @HAVE_WMEMCMP@
HAVE_WMEMCPY = @HAVE_WMEMCPY@
HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
HAVE_WMEMSET = @HAVE_WMEMSET@
HAVE_XLOCALE_H = @HAVE_XLOCALE_H@
HAVE__BOOL = @HAVE__BOOL@
HAVE__EXIT = @HAVE__EXIT@
HELP2MAN = @HELP2MAN@
INCLUDE_NEXT = @INCLUDE_NEXT@
INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INTLLIBS = @INTLLIBS@
INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
LDFLAGS = @LDFLAGS@
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@
LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
LOCALE_FR = @LOCALE_FR@
LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
LOCALE_JA = @LOCALE_JA@
LOCALE_ZH_CN = @LOCALE_ZH_CN@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
NEXT_AS_FIRST_DIRECTIVE_FLOAT_H = @NEXT_AS_FIRST_DIRECTIVE_FLOAT_H@
NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@
NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@
NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_WAIT_H@
NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
NEXT_ERRNO_H = @NEXT_ERRNO_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_GETOPT_H = @NEXT_GETOPT_H@
NEXT_LANGINFO_H = @NEXT_LANGINFO_H@
NEXT_LOCALE_H = @NEXT_LOCALE_H@
NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
NEXT_SYS_WAIT_H = @NEXT_SYS_WAIT_H@
NEXT_TIME_H = @NEXT_TIME_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NEXT_WCHAR_H = @NEXT_WCHAR_H@
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
RANLIB = @RANLIB@
REPLACE_BTOWC = @REPLACE_BTOWC@
REPLACE_CALLOC = @REPLACE_CALLOC@
REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_CLOSE = @REPLACE_CLOSE@
REPLACE_DPRINTF = @REPLACE_DPRINTF@
REPLACE_DUP = @REPLACE_DUP@
REPLACE_DUP2 = @REPLACE_DUP2@
REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
REPLACE_FCLOSE = @REPLACE_FCLOSE@
REPLACE_FDOPEN = @REPLACE_FDOPEN@
REPLACE_FFLUSH = @REPLACE_FFLUSH@
REPLACE_FOPEN = @REPLACE_FOPEN@
REPLACE_FPRINTF = @REPLACE_FPRINTF@
REPLACE_FPURGE = @REPLACE_FPURGE@
REPLACE_FREOPEN = @REPLACE_FREOPEN@
REPLACE_FSEEK = @REPLACE_FSEEK@
REPLACE_FSEEKO = @REPLACE_FSEEKO@
REPLACE_FSTAT = @REPLACE_FSTAT@
REPLACE_FSTATAT = @REPLACE_FSTATAT@
REPLACE_FTELL = @REPLACE_FTELL@
REPLACE_FTELLO = @REPLACE_FTELLO@
REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@
REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
REPLACE_GETCWD = @REPLACE_GETCWD@
REPLACE_GETDELIM = @REPLACE_GETDELIM@
REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@
REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_ISATTY = @REPLACE_ISATTY@
REPLACE_ISWBLANK = @REPLACE_ISWBLANK@
REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
REPLACE_ITOLD = @REPLACE_ITOLD@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LINK = @REPLACE_LINK@
REPLACE_LINKAT = @REPLACE_LINKAT@
REPLACE_LOCALECONV = @REPLACE_LOCALECONV@
REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_LSTAT = @REPLACE_LSTAT@
REPLACE_MALLOC = @REPLACE_MALLOC@
REPLACE_MBRLEN = @REPLACE_MBRLEN@
REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
REPLACE_MBSINIT = @REPLACE_MBSINIT@
REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
REPLACE_MBTOWC = @REPLACE_MBTOWC@
REPLACE_MEMCHR = @REPLACE_MEMCHR@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKDIR = @REPLACE_MKDIR@
REPLACE_MKFIFO = @REPLACE_MKFIFO@
REPLACE_MKNOD = @REPLACE_MKNOD@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_MKTIME = @REPLACE_MKTIME@
REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@
REPLACE_NULL = @REPLACE_NULL@
REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
REPLACE_PERROR = @REPLACE_PERROR@
REPLACE_POPEN = @REPLACE_POPEN@
REPLACE_PREAD = @REPLACE_PREAD@
REPLACE_PRINTF = @REPLACE_PRINTF@
REPLACE_PTSNAME = @REPLACE_PTSNAME@
REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@
REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_PWRITE = @REPLACE_PWRITE@
REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
REPLACE_READ = @REPLACE_READ@
REPLACE_READLINK = @REPLACE_READLINK@
REPLACE_REALLOC = @REPLACE_REALLOC@
REPLACE_REALPATH = @REPLACE_REALPATH@
REPLACE_REMOVE = @REPLACE_REMOVE@
REPLACE_RENAME = @REPLACE_RENAME@
REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
REPLACE_RMDIR = @REPLACE_RMDIR@
REPLACE_SETENV = @REPLACE_SETENV@
REPLACE_SETLOCALE = @REPLACE_SETLOCALE@
REPLACE_SLEEP = @REPLACE_SLEEP@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
REPLACE_STAT = @REPLACE_STAT@
REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@
REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
REPLACE_STPNCPY = @REPLACE_STPNCPY@
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
REPLACE_STRDUP = @REPLACE_STRDUP@
REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
REPLACE_STRNCAT = @REPLACE_STRNCAT@
REPLACE_STRNDUP = @REPLACE_STRNDUP@
REPLACE_STRNLEN = @REPLACE_STRNLEN@
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
REPLACE_STRSTR = @REPLACE_STRSTR@
REPLACE_STRTOD = @REPLACE_STRTOD@
REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@
REPLACE_SYMLINK = @REPLACE_SYMLINK@
REPLACE_TIMEGM = @REPLACE_TIMEGM@
REPLACE_TMPFILE = @REPLACE_TMPFILE@
REPLACE_TOWLOWER = @REPLACE_TOWLOWER@
REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
REPLACE_UNLINK = @REPLACE_UNLINK@
REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
REPLACE_UNSETENV = @REPLACE_UNSETENV@
REPLACE_USLEEP = @REPLACE_USLEEP@
REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
REPLACE_VDPRINTF = @REPLACE_VDPRINTF@
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
REPLACE_VPRINTF = @REPLACE_VPRINTF@
REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
REPLACE_WCTOB = @REPLACE_WCTOB@
REPLACE_WCTOMB = @REPLACE_WCTOMB@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
REPLACE_WRITE = @REPLACE_WRITE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
STDBOOL_H = @STDBOOL_H@
STDDEF_H = @STDDEF_H@
STDINT_H = @STDINT_H@
STRIP = @STRIP@
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
gl_LIBOBJS = @gl_LIBOBJS@
gl_LTLIBOBJS = @gl_LTLIBOBJS@
gltests_LIBOBJS = @gltests_LIBOBJS@
gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
gltests_WITNESS = @gltests_WITNESS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
lispdir = @lispdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
unify_SOURCES = unify.c wdiff.h
wdiff_SOURCES = wdiff.c pipes.c wdiff.h
mdiff_SOURCES = mdiff.c pipes.c wdiff.h
wdiff2_SOURCES = wdiff2.c wdiff.h
unify_LDADD = ../lib/libgnu.a $(LIBINTL)
wdiff_LDADD = ../lib/libgnu.a $(LIBINTL)
mdiff_LDADD = ../lib/libgnu.a $(LIBINTL)
wdiff2_LDADD = ../lib/libgnu.a $(LIBINTL)
AM_CPPFLAGS = -I$(top_srcdir)/lib
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
mdiff$(EXEEXT): $(mdiff_OBJECTS) $(mdiff_DEPENDENCIES) $(EXTRA_mdiff_DEPENDENCIES)
@rm -f mdiff$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(mdiff_OBJECTS) $(mdiff_LDADD) $(LIBS)
unify$(EXEEXT): $(unify_OBJECTS) $(unify_DEPENDENCIES) $(EXTRA_unify_DEPENDENCIES)
@rm -f unify$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(unify_OBJECTS) $(unify_LDADD) $(LIBS)
wdiff$(EXEEXT): $(wdiff_OBJECTS) $(wdiff_DEPENDENCIES) $(EXTRA_wdiff_DEPENDENCIES)
@rm -f wdiff$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(wdiff_OBJECTS) $(wdiff_LDADD) $(LIBS)
wdiff2$(EXEEXT): $(wdiff2_OBJECTS) $(wdiff2_DEPENDENCIES) $(EXTRA_wdiff2_DEPENDENCIES)
@rm -f wdiff2$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(wdiff2_OBJECTS) $(wdiff2_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mdiff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipes.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wdiff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wdiff2.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
distclean distclean-compile distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-binPROGRAMS
../lib/libgnu.a:
test -f $@ || $(MAKE) -C ../lib
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
wdiff-1.2.1/src/unify.c 0000644 0000000 0000000 00000044345 11744500575 011610 0000000 0000000 /* unify -- Change a diff to/from a context diff from/to a unified diff.
Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
/* From the public domain version 1.1, as found on 1992-12-22 at
ftp://ftp.uu.net/usenet/comp.sources.misc/volume25/unidiff/part01.Z.
Originally written by Wayne Davison . */
#include "wdiff.h"
#include
#include
#include
/* FIXME: Programs should not have such limits. */
#define NAME_LENGTH 255
#define BUFFER_LENGTH 2048
/* The name this program was run with. */
const char *program_name;
/* If nonzero, display usage information and exit. */
static int show_help = 0;
/* If nonzero, print the version on standard output and exit. */
static int show_version = 0;
enum type
{
TYPE_UNDECIDED,
TYPE_UNIDIFF,
TYPE_CDIFF
};
static enum type output_type = TYPE_UNDECIDED;
static int force_old_style = 0; /* old-style diff, no matter what */
static int echo_comments = 0; /* echo comments to stderr */
static int strip_comments = 0; /* strip comment lines */
static int patch_format = 0; /* generate patch format */
static int use_equals = 0; /* use '=' not ' ' in unified diffs */
/* Common definitions. */
enum state
{
FIND_NEXT,
PARSE_UNIDIFF,
UNI_LINES,
PARSE_CDIFF,
PARSE_OLD,
CHECK_OLD,
OLD_LINES,
PARSE_NEW,
NEW_LINES
};
static enum state state = FIND_NEXT;
struct line_object
{
struct line_object *next;
char type;
int number;
char string[1];
};
struct line_object root, *head = &root, *hold = &root, *line;
long old_first = 0, old_last = -1;
long new_first = 0, new_last = 0;
long old_start, old_end, old_line;
long new_start, new_end, new_line;
long line_number = 0;
static enum type input_type = TYPE_UNDECIDED;
static int found_index = 0;
static char name[NAME_LENGTH + 1] = { '\0' };
static char buffer[BUFFER_LENGTH];
/*---------------------------------------------------------------.
| Decode integer at CURSOR into RESULT, leave CURSOR past it. |
`---------------------------------------------------------------*/
#define SCAN_INTEGER(Cursor, Result) \
do \
{ \
Result = atol (Cursor); \
while (*Cursor <= '9' && *Cursor >= '0') \
Cursor++; \
} \
while (0)
/*--------------------------------------------------------------------.
| Check if two strings are equal, given a maximum comparison length. |
`--------------------------------------------------------------------*/
static inline int
string_equal (const char *string1, const char *string2, int length)
{
return !strncmp (string1, string2, length);
}
/*---.
| ? |
`---*/
static void
add_line (char type, long number, char *string)
{
line = (struct line_object *)
xmalloc (sizeof (struct line_object) + strlen (string));
line->type = type;
line->number = number;
strcpy (line->string, string);
line->next = hold->next;
hold->next = line;
hold = line;
}
/*---.
| ? |
`---*/
static void
ensure_name (void)
{
char *cursor = name;
if (found_index)
return;
if (!*name)
error (0, 0, _("could not find a name for the diff at line %ld"),
line_number);
else if (patch_format)
{
if (cursor[0] == '.' && cursor[1] == '/')
cursor += 2;
printf ("Index: %s\n", cursor);
}
}
/*---.
| ? |
`---*/
static void
generate_output (void)
{
if (old_last < 0)
return;
if (output_type == TYPE_UNIDIFF)
{
long i, j;
i = old_first ? old_last - old_first + 1 : 0;
j = new_first ? new_last - new_first + 1 : 0;
printf ("@@ -%ld,%ld +%ld,%ld @@\n", old_first, i, new_first, j);
for (line = root.next; line; line = hold)
{
printf ("%c%s", use_equals && line->type == ' ' ? '=' : line->type,
line->string);
hold = line->next;
free (line);
}
}
else /* if output_type == TYPE_CDIFF */
{
struct line_object *scan;
int found_plus = 1;
char character;
printf ("***************\n*** %ld", old_first);
if (old_first == old_last)
printf (" ****\n");
else
printf (",%ld ****\n", old_last);
for (line = root.next; line; line = line->next)
if (line->type == '-')
break;
if (line)
{
found_plus = 0;
character = ' ';
for (line = root.next; line; line = line->next)
{
switch (line->type)
{
case '-':
if (character != ' ')
break;
scan = line;
while (scan = scan->next,
(scan != NULL && scan->type == '-'))
;
if (scan && scan->type == '+')
{
do
{
scan->type = '!';
}
while (scan = scan->next, (scan && scan->type == '+'));
character = '!';
}
else
character = '-';
break;
case '+':
case '!':
found_plus = 1;
continue;
case ' ':
character = ' ';
break;
}
printf ("%c %s", character, line->string);
}
}
if (new_first == new_last)
printf ("--- %ld ----\n", new_first);
else
printf ("--- %ld,%ld ----\n", new_first, new_last);
if (found_plus)
for (line = root.next; line; line = line->next)
if (line->type != '-')
printf ("%c %s", line->type, line->string);
for (line = root.next; line; line = hold)
{
hold = line->next;
free (line);
}
}
root.next = NULL;
head = &root;
hold = &root;
old_first = 0;
new_first = 0;
old_last = -1;
new_last = 0;
}
/*-----------------------------------------------.
| Explain how to use the program, then get out. |
`-----------------------------------------------*/
static void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("try `%s --help' for more information\n"),
program_name);
else
{
/* *INDENT-OFF* */
fputs (_("\
unify - Transforms context diffs into unidiffs, or vice-versa.\n"),
stdout);
fputs ("\n", stdout);
printf (_("\
Usage: %s [OPTION]... [FILE]\n"), program_name);
fputs ("\n", stdout);
fputs (_(" -c, --context-diffs force output to context diffs\n"), stdout);
fputs (_(" -e, --echo-comments echo comments to standard error\n"), stdout);
fputs (_(" -o, --old-diffs output old-style diffs, no matter what\n"), stdout);
fputs (_(" -p, --patch-format generate patch format\n"), stdout);
fputs (_(" -P same as -p\n"), stdout);
fputs (_(" -s, --strip-comments strip comment lines\n"), stdout);
fputs (_(" -u, --unidiffs force output to unidiffs\n"), stdout);
fputs (_(" -U same as -p and -u\n"), stdout);
fputs (_(" -=, --use-equals replace spaces by equal signs in unidiffs\n"), stdout);
fputs (_(" --help display this help then exit\n"), stdout);
fputs (_(" --version display program version then exit\n"), stdout);
fputs ("\n", stdout);
fputs (_("If FILE is not specified, read standard input.\n"), stdout);
fputs ("\n", stdout);
fputs (_("Report bugs to .\n"), stdout);
/* *INDENT-ON* */
}
exit (status);
}
/*----------------------------------------------------------------------.
| Main program. Decode ARGC arguments passed through the ARGV array of |
| strings, then launch execution. |
`----------------------------------------------------------------------*/
/* Long options equivalences. */
static const struct option long_options[] = {
{"context-diffs", no_argument, NULL, 'c'},
{"echo-comments", no_argument, NULL, 'e'},
{"help", no_argument, &show_help, 1},
{"old-diffs", no_argument, NULL, 'o'},
{"patch-format", no_argument, NULL, 'p'},
{"strip-comments", no_argument, NULL, 's'},
{"unidiffs", no_argument, NULL, 'u'},
{"use-equals", no_argument, NULL, '='},
{"version", no_argument, &show_version, 1},
{0, 0, 0, 0},
};
int
main (int argc, char *const *argv)
{
int option_char; /* option character */
FILE *file = stdin;
char previous_start = ' ';
char star_in_cdiff; /* if '*' seen in a new-style context diff */
char type;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Decode command options. */
while (option_char = getopt_long (argc, (char **) argv, "=ceopPsUu",
long_options, NULL), option_char != EOF)
switch (option_char)
{
default:
usage (EXIT_FAILURE);
case '\0':
break;
case '=':
use_equals = 1;
break;
case 'c':
output_type = TYPE_CDIFF;
break;
case 'e':
echo_comments = 1;
break;
case 'o':
force_old_style = 1;
break;
case 'p':
case 'P':
patch_format = 1;
break;
case 's':
strip_comments = 1;
break;
case 'U':
patch_format = 1;
/* Fall through. */
case 'u': /* force unified output */
output_type = TYPE_UNIDIFF;
break;
}
if (optind < argc)
{
if (file = fopen (argv[optind], "r"), file == NULL)
error (EXIT_FAILURE, errno, _("unable to open `%s'"), argv[optind]);
optind++;
}
if (optind < argc)
{
error (0, 0, _("only one filename allowed"));
usage (EXIT_FAILURE);
}
/* Process trivial options. */
if (show_version)
{
printf ("unify (GNU %s) %s\n", PACKAGE, VERSION);
fputs (_("\
\n\
Copyright (C) 1994, 1997 Free Software Foundation, Inc.\n"), stdout);
fputs (_("\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), stdout);
fputs (_("\
\n\
Written by Wayne Davison .\n"), stdout);
exit (EXIT_SUCCESS);
}
if (show_help)
usage (EXIT_SUCCESS);
/* Read and digest the input file. */
while (fgets (buffer, sizeof buffer, file))
{
line_number++;
reprocess:
switch (state)
{
case FIND_NEXT:
if (input_type != TYPE_CDIFF && string_equal (buffer, "@@ -", 4))
{
input_type = TYPE_UNIDIFF;
if (output_type == TYPE_UNDECIDED)
output_type = TYPE_CDIFF;
ensure_name ();
state = PARSE_UNIDIFF;
goto reprocess;
}
if (input_type != TYPE_UNIDIFF
&& string_equal (buffer, "********", 8))
{
input_type = TYPE_CDIFF;
if (output_type == TYPE_UNDECIDED)
output_type = TYPE_UNIDIFF;
ensure_name ();
state = PARSE_OLD;
break;
}
if (string_equal (buffer, "Index:", 6))
{
found_index = 1;
printf ("%s", buffer);
}
else if (string_equal (buffer, "Prereq: ", 8))
printf ("%s", buffer);
else if (string_equal (buffer, "*** ", 4)
|| string_equal (buffer, "--- ", 4)
|| string_equal (buffer, "+++ ", 4))
{
if (!found_index)
{
char *cursor;
int length;
for (cursor = buffer + 4, length = 0;
*cursor > ' ' && length < NAME_LENGTH;
cursor++, length++)
;
if (!*name || length < strlen (name))
{
strncpy (name, buffer + 4, length);
name[length] = '\0';
}
}
if (!patch_format)
{
if (output_type == TYPE_UNIDIFF
&& (*buffer == '+'
|| *buffer == '-' && previous_start != '*')
|| output_type == TYPE_CDIFF
&& (*buffer == '*'
|| *buffer == '-' && previous_start == '*'))
printf ("%s", buffer);
else if (*buffer == '*' || *buffer == '+')
printf ("---%s", buffer + 3);
else if (*buffer == '-' && previous_start == '*')
printf ("+++%s", buffer + 3);
else
printf ("***%s", buffer + 3);
previous_start = *buffer;
}
}
else if (patch_format
&& (string_equal (buffer, "Only in ", 8)
|| string_equal (buffer, "Common subdir", 13)
|| string_equal (buffer, "diff -", 6)
|| string_equal (buffer, "Binary files", 12)))
{
if (echo_comments)
fprintf (stderr, "%s%s", strip_comments ? "" : "!!! ",
buffer);
}
else
{
if (echo_comments)
fprintf (stderr, "%s", buffer);
if (!strip_comments)
printf ("%s", buffer);
}
break;
case PARSE_UNIDIFF:
{
char *cursor;
if (!string_equal (buffer, "@@ -", 4))
{
found_index = 0;
*name = '\0';
state = FIND_NEXT;
goto reprocess;
}
cursor = buffer + 4;
SCAN_INTEGER (cursor, old_start);
if (*cursor++ == ',')
{
SCAN_INTEGER (cursor, old_end);
cursor++;
}
else
old_end = 1;
if (*cursor++ != '+')
goto bad_header;
SCAN_INTEGER (cursor, new_start);
if (*cursor++ == ',')
{
SCAN_INTEGER (cursor, new_end);
cursor++;
}
else
new_end = 1;
if (*cursor != '@')
bad_header:
error (EXIT_FAILURE, 0,
_("invalid unified diff header at line %ld"),
line_number);
old_end = (old_start ? old_start + old_end - 1 : 0);
new_end = (new_start ? new_start + new_end - 1 : 0);
old_first = old_start;
new_first = new_start;
if (old_start)
old_line = old_start - 1;
else
old_line = old_last = 0;
if (new_start)
new_line = new_start - 1;
else
new_line = new_last = 0;
state = UNI_LINES;
break;
}
case UNI_LINES:
switch (*buffer)
{
case ' ':
case '=':
*buffer = ' ';
old_last = ++old_line;
new_last = ++new_line;
break;
case '-':
old_last = ++old_line;
break;
case '+':
new_last = ++new_line;
break;
default:
error (EXIT_FAILURE, 0,
_("malformed unified diff at line %ld"), line_number);
}
add_line (*buffer, 0L, buffer + 1);
if (old_line == old_end && new_line == new_end)
{
generate_output ();
state = PARSE_UNIDIFF;
}
break;
case PARSE_CDIFF:
if (!string_equal (buffer, "********", 8))
{
generate_output ();
found_index = 0;
*name = '\0';
state = FIND_NEXT;
goto reprocess;
}
state = PARSE_OLD;
break;
case PARSE_OLD:
star_in_cdiff = ' ';
old_start = -1;
if (sscanf (buffer, "*** %ld,%ld %c", &old_start, &old_end,
&star_in_cdiff) < 2)
{
if (old_start < 0)
error (EXIT_FAILURE, 0,
_("context diff missing `old' header at line %ld"),
line_number);
old_end = old_start;
star_in_cdiff = ' ';
}
else if (force_old_style)
star_in_cdiff = ' ';
if (old_last >= 0)
{
if (old_start > old_last)
generate_output ();
else
{
star_in_cdiff = ' ';
while (head->next && head->next->number != old_start)
head = head->next;
}
}
old_line = old_start - 1;
new_line = 0;
if (!old_first)
old_first = old_start;
if (!old_start)
state = PARSE_NEW;
else
state = CHECK_OLD;
break;
case CHECK_OLD:
if (string_equal (buffer, "--- ", 4))
state = PARSE_NEW;
else
{
state = OLD_LINES;
hold = head;
}
goto reprocess;
case OLD_LINES:
if (buffer[0] == '\n')
strcpy (buffer, " \n");
if (buffer[1] == '\n')
strcpy (buffer + 1, " \n");
if (buffer[1] != ' ')
error (EXIT_FAILURE, 0, _("malformed context diff at line %ld"),
line_number);
switch (*buffer)
{
case ' ':
type = ' ';
new_line++;
old_line++;
break;
case '-':
case '!':
type = '-';
old_line++;
break;
default:
error (EXIT_FAILURE, 0,
_("malformed context diff at line %ld"), line_number);
}
if (old_line > old_last)
{
add_line (type, 0L, buffer + 2);
old_last = old_line;
new_last = new_line;
}
else
{
do
{
hold = hold->next;
}
while (hold->type == '+');
if (type != ' ')
{
hold->type = type;
hold->number = 0;
}
}
if (old_line == old_end)
state = PARSE_NEW;
break;
case PARSE_NEW:
if (*buffer == '\n')
break;
new_start = -1;
if (sscanf (buffer, "--- %ld,%ld", &new_start, &new_end) != 2)
{
if (new_start < 0)
error (EXIT_FAILURE, 0,
_("context diff missing `new' header at line %ld"),
line_number);
new_end = new_start;
}
new_last = new_line;
old_line = old_start ? old_start - 1 : 0;
new_line = new_start ? new_start - 1 : 0;
new_last += new_line;
hold = head;
if (!new_first)
{
new_first = new_start;
while (hold->next && hold->next->type == '-')
{
hold = hold->next;
hold->number = ++old_line;
}
}
if (star_in_cdiff == '*' && new_last == new_end)
{
state = PARSE_CDIFF;
break;
}
state = NEW_LINES;
break;
case NEW_LINES:
if (buffer[0] == '\n')
strcpy (buffer, " \n");
if (buffer[1] == '\n')
strcpy (buffer + 1, " \n");
if (buffer[1] != ' ')
error (EXIT_FAILURE, 0,
_("malformed context diff at line %ld"), line_number);
switch (*buffer)
{
case ' ':
type = ' ';
new_line++;
old_line++;
break;
case '+':
case '!':
type = '+';
new_line++;
break;
default:
error (EXIT_FAILURE, 0,
_("malformed context diff at line %ld"), line_number);
}
if (old_line > old_last)
{
old_last = old_line;
add_line (type, old_line, buffer + 2);
new_last++;
}
else if (type != ' ')
{
add_line (type, 0L, buffer + 2);
new_last++;
}
else
{
hold = hold->next;
hold->number = old_line;
while (hold->next && !hold->next->number
&& hold->next->type != ' ')
{
hold = hold->next;
if (hold->type == '-')
hold->number = ++old_line;
}
}
if (old_line == old_end && new_line == new_end)
state = PARSE_CDIFF;
break;
}
}
/* Produce output and exit. */
generate_output ();
exit (EXIT_SUCCESS);
}
wdiff-1.2.1/src/pipes.c 0000644 0000000 0000000 00000004620 11744500575 011566 0000000 0000000 /* Open a pipe to read from or write to a program without intermediary sh.
Copyright (C) 1992, 1997, 2011 Free Software Foundation, Inc.
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
/* Written by David MacKenzie, rewritten by Martin von Gagern. */
#include "wdiff.h"
#include
#include
#include
static int
openpipe (int dir, char *progname, va_list ap)
{
int fds[2];
char *args[100];
int argno = 0;
/* Copy arguments into `args'. */
args[argno++] = progname;
while ((args[argno++] = va_arg (ap, char *)) != NULL)
;
if (pipe (fds) == -1)
return 0;
switch (fork ())
{
case 0: /* Child. Write to pipe. */
close (fds[1 - dir]); /* Not needed. */
if (dup2 (fds[dir], dir) == -1)
{
error (0, errno, _("error redirecting stream"));
_exit (2);
}
execvp (args[0], args);
error (0, errno, _("failed to execute %s"), progname);
_exit (2); /* 2 for `cmp'. */
case -1: /* Error. */
return 0;
default: /* Parent. Read from pipe. */
close (fds[dir]); /* Not needed. */
return fds[1 - dir];
}
}
/* Open a pipe to read from a program without intermediary sh. Checks
PATH. Sample use:
stream = readpipe ("progname", "arg1", "arg2", (char *) 0);
Return 0 on error. */
FILE *
readpipe (char *progname, ...)
{
va_list ap;
int fd;
va_start (ap, progname);
fd = openpipe (1, progname, ap);
va_end (ap);
return fdopen (fd, "r");
}
/* Open a pipe to write to a program without intermediary sh. Checks
PATH. Sample use:
stream = writepipe ("progname", "arg1", "arg2", (char *) 0);
Return 0 on error. */
FILE *
writepipe (char *progname, ...)
{
va_list ap;
int fd;
va_start (ap, progname);
fd = openpipe (0, progname, ap);
va_end (ap);
return fdopen (fd, "w");
}
wdiff-1.2.1/src/mdiff.c 0000644 0000000 0000000 00000360122 11744500575 011535 0000000 0000000 /* Find similar sequences in multiple files and report differences.
Copyright (C) 1992, 1997, 1998, 1999, 2011 Free Software Foundation, Inc.
Francois Pinard , 1997.
This program 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 3 of the License, or
(at your option) any later version.
This program 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#include "wdiff.h"
/* Define to 1 to compile in a debugging option. */
#define DEBUGGING 1
/* Define to the printed name of standard input. */
#define STDIN_PRINTED_NAME ""
/* Define to 1 for requesting the capability of doing full comparisons, then
not necessarily relying on checksums (both methods are available). If 0
instead, always rely on checksums and pack them with item types into the
item structure: this yields faster code and disallows paranoid mode. */
#define SAFER_SLOWER 0
/* One may also, optionally, define a default PAGER_PROGRAM. This
might be done using the --with-default-pager=PAGER configure
switch. If PAGER_PROGRAM is undefined and neither the WDIFF_PAGER
nor the PAGER environment variable is set, none will be used. */
/* We do termcap init ourselves, so pass -X.
We might do coloring, so pass -R. */
#define LESS_DEFAULT_OPTS "-X -R"
/*-----------------------.
| Library declarations. |
`-----------------------*/
#if DEBUGGING
# include
#else
# define assert (Expr)
#endif
#include
#include
char *strstr ();
#if HAVE_TPUTS
# if HAVE_TERMCAP_H
# include
# else
# if HAVE_TERMLIB_H
# include
# else
# if HAVE_CURSES_H
# include
# else
# if HAVE_NCURSES_H
# include
# endif
# endif
# if HAVE_TERM_H
# include
# endif
# endif
# endif
#endif
#include
#include
#include
#include
#include
#include
#include "regex.h"
#define CHAR_SET_SIZE 256
#define MASK(Length) (~(~0 << (Length)))
/*---------------------.
| Local declarations. |
`---------------------*/
/* Exit codes values. */
#define EXIT_DIFFERENCE 1 /* some differences found */
#define EXIT_ERROR 2 /* any other reason for exit */
/* Define pseudo short options for long options without short options. */
#define GTYPE_GROUP_FORMAT_OPTION 10
#define HORIZON_LINES_OPTION 11
#define LEFT_COLUMN_OPTION 12
#define LINE_FORMAT_OPTION 13
#define LTYPE_LINE_FORMAT_OPTION 14
#define SUPPRESS_COMMON_LINES_OPTION 15
/* The name this program was run with. */
const char *program_name;
/* If nonzero, display usage information and exit. */
static int show_help = 0;
/* If nonzero, print the version on standard output and exit. */
static int show_version = 0;
/* Other variables. */
FILE *output_file; /* file or pipe to which we write output */
int exit_status = EXIT_SUCCESS; /* status at end of execution */
/* Options variables. */
#define OPTION_STRING \
"0123ABC::D:F:GHI:J:KL:NO:PQ:RS:TU::VWX:Y:Z:abc::dehijklmnopqrs:tu::vw:xyz"
/* BC: D:F: HI: L:N P S:TU: X: abc dehi l n pqrs:tu vw:xy */
/* The line above gives GNU diff options, for reference. */
/* Long options equivalences. */
static const struct option long_options[] = {
{"auto-pager", no_argument, NULL, 'A'},
{"avoid-wraps", no_argument, NULL, 'm'},
{"brief", no_argument, NULL, 'q'},
{"context", optional_argument, NULL, 'c'},
{"debugging", no_argument, NULL, '0'},
{"ed", no_argument, NULL, 'e'},
{"exclude-from", required_argument, NULL, 'X'},
{"exclude", required_argument, NULL, 'x'},
{"expand-tabs", no_argument, NULL, 't'},
{"GTYPE-group-format", required_argument, NULL, GTYPE_GROUP_FORMAT_OPTION},
{"help", no_argument, &show_help, 1},
{"horizon-lines", required_argument, NULL, HORIZON_LINES_OPTION},
{"ifdef", required_argument, NULL, 'D'},
{"ignore-all-space", no_argument, NULL, 'w'},
{"ignore-blank-lines", no_argument, NULL, 'B'},
{"ignore-case", no_argument, NULL, 'i'},
{"ignore-matching-lines", required_argument, NULL, 'I'},
{"ignore-space-change", no_argument, NULL, 'b'},
{"initial-tab", no_argument, NULL, 'T'},
{"item-regexp", required_argument, NULL, 'O'},
{"label", required_argument, NULL, 'L'},
{"left-column", no_argument, NULL, LEFT_COLUMN_OPTION},
{"less-mode", no_argument, NULL, 'k'},
{"line-format", required_argument, NULL, LINE_FORMAT_OPTION},
{"LTYPE-line-format", required_argument, NULL, LTYPE_LINE_FORMAT_OPTION},
{"minimal", no_argument, NULL, 'd'},
{"minimum-size", required_argument, NULL, 'J'},
{"new-file", no_argument, NULL, 'N'},
{"no-common", no_argument, NULL, '3'},
{"no-deleted", no_argument, NULL, '1'},
{"no-init-term", no_argument, NULL, 'K'}, /* backwards compatibility */
{"no-inserted", no_argument, NULL, '2'},
{"ignore-delimiters", no_argument, NULL, 'j'},
{"paginate", no_argument, NULL, 'l'},
{"printer", no_argument, NULL, 'o'},
{"rcs", no_argument, NULL, 'n'},
{"recursive", no_argument, NULL, 'r'},
{"relist-files", no_argument, NULL, 'G'},
{"report-identical-files", no_argument, NULL, 's'},
{"show-c-function", no_argument, NULL, 'p'},
{"show-function-line", required_argument, NULL, 'F'},
{"show-links", no_argument, NULL, 'R'},
{"side-by-side", no_argument, NULL, 'y'},
{"speed-large-files", no_argument, NULL, 'H'},
{"starting-file", required_argument, NULL, 'S'},
{"string", optional_argument, NULL, 'Z'},
{"suppress-common-lines", no_argument, NULL, SUPPRESS_COMMON_LINES_OPTION},
{"terminal", no_argument, NULL, 'z'},
{"text", no_argument, NULL, 'a'},
{"tolerance", required_argument, NULL, 't'},
{"unidirectional-new-file", no_argument, NULL, 'P'},
{"unified", optional_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
{"version", no_argument, &show_version, 1},
{"width", required_argument, NULL, 'w'},
{"word-mode", required_argument, NULL, 'W'},
{0, 0, 0, 0},
};
/*--------------------.
| Available options. |
`--------------------*/
/* If calling the pager automatically. */
static int autopager = 0;
/* End/restart strings at end of lines. */
static int avoid_wraps = 0;
/* If nonzero, output quite verbose detail of operations. */
static int debugging = 0;
/* Initialize the termcap strings. */
static int find_termcap = -1; /* undecided yet */
/* Ignore all white space. */
static int ignore_all_space = 0;
/* Ignore changes whose lines are all blank. */
static int ignore_blank_lines = 0;
/* Consider upper-case and lower-case to be the same. */
static int ignore_case = 0;
/* If nonzero, segregate matchable only items out of normal items. */
static int ignore_delimiters = 0;
/* Ignore changes whose lines all match regular expression. */
static struct re_pattern_buffer **ignore_regexp_array = NULL;
static int ignore_regexps = 0;
/* Ignore changes in the amount of white space. */
static int ignore_space_change = 0;
/* Make tabs line up by prepending a tab. */
static int initial_tab = 0;
/* Try hard to find a smaller set of changes. Unimplemented. */
static int minimal = 0;
/* Minimum size of a cluster, not counting ignored items. */
static int minimum_size = -1; /* undecided yet */
/* If using printer overstrikes. */
static int overstrike = 0;
/* If output aimed to the "less" program (overstrike even whitespace). */
static int overstrike_for_less = 0;
/* Pass the output through `pr' to paginate it. */
static int paginate = 0;
/* List all input files with annotations. */
static int relist_files = 0;
/* Give file and line references in annotated listings. */
static int show_links = 0;
/* Assume large files and many scattered small changes. Unimplemented. */
static int speed_large_files = 0;
/* If nonzero, show progress of operations. */
static int verbose = 0;
/* Compare words, use REGEXP to define item. */
static int word_mode = 0;
static struct re_pattern_buffer *item_regexp = NULL;
/*---------------.
| diff options. |
`---------------*/
/* Treat all files as text. */
static int text = 0;
/* Output regular context diffs. */
static int context = 0;
/* Output unified context diffs or unidiffs. */
static int unified = 0;
/* Use LABEL instead of file name. */
static const char *label = NULL;
/* Show which C function each change is in. */
static int show_c_function = 0;
/* Show the most recent line matching RE. */
static const char *show_function_line = NULL;
/* Output only whether files differ. */
static int brief = 0;
/* Output an ed script. */
static int ed = 0;
/* Output an RCS format diff. */
static int rcs = 0;
/* Output in two columns. */
static int side_by_side = 0;
/* Output at most NUM characters per line. */
static int width = 130;
/* Output only the left column of common lines. */
static int left_column = 0;
/* Do not output common lines. */
static int suppress_common_lines = 0;
/* Output merged file to show `#ifdef NAME' diffs. */
static const char *ifdef = NULL;
/* GTYPE input groups with GFMT. */
static const char *gtype_group_format = NULL;
/* All input lines with LFMT. */
static const char *line_format = NULL;
/* LTYPE input lines with LFMT. */
static const char *ltype_line_format = NULL;
/* Expand tabs to spaces in output. */
static int expand_tabs = 0;
/* Recursively compare any subdirectories found. */
static int recursive = 0;
/* Treat absent files as empty. */
static int new_file = 0;
/* Treat absent first files as empty. */
static int unidirectional_new_file = 0;
/* Report when two files are the same. */
static int report_identical_files = 0;
/* Exclude files that match PAT. */
static const char *exclude = NULL;
/* Exclude files that match any pattern in FILE. */
static const char *exclude_from = NULL;
/* Start with FILE when comparing directories. */
static const char *starting_file = NULL;
/* Keep NUM lines of the common prefix and suffix. */
static int horizon_lines = 2;
/*----------------------.
| mdiff draft options. |
`----------------------*/
/* Maximum number of non-matching items for cluster members. */
static int tolerance = 0;
/* Regular expressions. */
/*-------------------------------------------------------------------.
| Compile the regex represented by STRING, diagnose and abort if any |
| error. Returns the compiled regex structure. |
`-------------------------------------------------------------------*/
static struct re_pattern_buffer *
alloc_and_compile_regex (const char *string)
{
struct re_pattern_buffer *pattern; /* newly allocated structure */
const char *message; /* error message returned by regex.c */
pattern = (struct re_pattern_buffer *)
xmalloc (sizeof (struct re_pattern_buffer));
memset (pattern, 0, sizeof (struct re_pattern_buffer));
pattern->buffer = NULL;
pattern->allocated = 0;
#if 0
/* FIXME */
pattern->translate = ignore_case ? (char *) folded_chars : NULL;
#endif
pattern->fastmap = xmalloc ((size_t) CHAR_SET_SIZE);
message = re_compile_pattern (string, (int) strlen (string), pattern);
if (message)
error (EXIT_ERROR, 0, _("%s (for regexp `%s')"), message, string);
/* The fastmap should be compiled before `re_match'. This would not be
necessary if `re_search' was called first. */
re_compile_fastmap (pattern);
#if WITH_REGEX
/* Do not waste extra allocated space. */
if (pattern->allocated > pattern->used)
{
pattern->buffer = xrealloc (pattern->buffer, (size_t) pattern->used);
pattern->allocated = pattern->used;
}
#endif
return pattern;
}
/* Items. */
/* Each item has a type which is meaningful to the clustering process.
NORMAL items and DELIMS items fully participate in cluster
construction, yet only NORMAL items are worth participating into building
the minimum size count, merely DELIMS items do not. WHITE items, even if
they do exist in input files, are a little like if they were just not
there: they are often skipped over. SENTINEL items do not correspond to
any real input item, they are used to mark file boundaries, and may not
compare equally to any other item.
The names NORMAL, DELIMS, WHITE and SENTINEL are a bit generic and are
used mainly to trigger the imagination of the reader. Practice may be
quite different. For example, actual white items may well be classified
as DELIMS or NORMAL, items having only delimiters may be seen as NORMAL,
items making up a block comment may be considered as WHITE. Moreover,
SENTINEL items could be introduced at function boundaries, say, if we
wanted to limit cluster members to a single function, etc. */
enum type
{
NORMAL, /* meaningful, countable items */
DELIMS, /* items having only delimiters */
WHITE, /* white items */
SENTINEL /* file boundaries */
};
/* Comparison work is done on checksums of items, rather than input items
themselves. The following array maintains one entry for each item,
whether a real item or a sentinel. Checksums, which are meaningful only
for NORMAL or DELIMS items, are computed so they ignore parts of the item
which are not really meaningful for the purpose of comparisons.
If SAFER_SLOWER has been selected, checksums may be avoided and pointers
used instead. For pointers to occupy the full space they might need, the
type bits are kept apart but tightly packed. Otherwise, the TYPE bits
are part of the structured item, eating out some chekcsum space. */
#define BITS_PER_CHAR 8
#define BITS_PER_TYPE 2
#define BITS_PER_WORD (sizeof (unsigned) * BITS_PER_CHAR)
#define TYPES_PER_WORD (BITS_PER_WORD / BITS_PER_TYPE)
#if SAFER_SLOWER
# define ITEM union item
union item
{
unsigned checksum;
char *pointer;
};
static union item *item_array = NULL;
static unsigned *type_array = NULL;
static int items = 0;
static inline enum type
item_type (ITEM * item)
{
int position = item - item_array;
int shift = position % TYPES_PER_WORD * BITS_PER_TYPE;
unsigned *pointer = type_array + position / TYPES_PER_WORD;
return (enum type) (MASK (BITS_PER_TYPE) & *pointer >> shift);
}
static inline void
set_item_type (ITEM * item, enum type type)
{
int position = item - item_array;
int shift = position % TYPES_PER_WORD * BITS_PER_TYPE;
unsigned *pointer = type_array + position / TYPES_PER_WORD;
*pointer &= ~MASK (BITS_PER_TYPE) << shift;
*pointer |= type << shift;
}
#else /* not SAFER_SLOWER */
# define ITEM struct item
struct item
{
enum type type:BITS_PER_TYPE;
unsigned checksum:BITS_PER_WORD - BITS_PER_TYPE;
};
static struct item *item_array = NULL;
static int items = 0;
static inline enum type
item_type (ITEM * item)
{
return item->type;
}
static inline void
set_item_type (ITEM * item, enum type type)
{
item->type = type;
}
#endif /* not SAFER_SLOWER */
#if DEBUGGING
/*---------------------.
| Dump a given INPUT. |
`---------------------*/
static void
dump_item (ITEM * item)
{
static const char *item_type_string[4] = { "", "delim", "white", "SENTIN" };
fprintf (stderr, "(%ld)\t%s\t%08x\n", (long) (item - item_array),
item_type_string[item_type (item)], item->checksum);
}
/*------------------.
| Dump all items. |
`------------------*/
static void
dump_all_items (void)
{
int counter;
fputs ("\f\n", stderr);
for (counter = 0; counter < items; counter++)
dump_item (item_array + counter);
}
#endif /* DEBUGGING */
/*-------------------------------------------------------------------.
| Move item pointer forward or backward, skipping over white items. |
`-------------------------------------------------------------------*/
#define FORWARD_ITEM(Pointer) \
do { Pointer++; } while (item_type (Pointer) == WHITE)
#define BACKWARD_ITEM(Pointer) \
do { Pointer--; } while (item_type (Pointer) == WHITE)
/*------------------------------------------------------------------.
| Sort helper. Compare two item indices. Lower indices go first. |
`------------------------------------------------------------------*/
static int
compare_for_positions (const void *void_first, const void *void_second)
{
#define value1 *((int *) void_first)
#define value2 *((int *) void_second)
return value1 - value2;
#undef value1
#undef value2
}
/*-------------------------------------------------------------------------.
| Sort helper. Compare two item indices. Items having identical |
| checksums should be brought together. Whenever two checksums are equal, |
| items are then ordered by the checksum of the following items, and this |
| way going forward until a difference is found. |
`-------------------------------------------------------------------------*/
static int
compare_for_checksum_runs (const void *void_first, const void *void_second)
{
#define value1 *((int *) void_first)
#define value2 *((int *) void_second)
ITEM *item1 = item_array + value1;
ITEM *item2 = item_array + value2;
int result;
while (1)
{
/* Order checksums. */
result = item1->checksum - item2->checksum;
if (result)
return result;
/* Seek forward for a difference. */
FORWARD_ITEM (item1);
FORWARD_ITEM (item2);
/* Sentinels are never equal (unless really the same). They go after
all checksums, and compare so to stabilise the sort. */
if (item_type (item1) == SENTINEL)
return item_type (item2) == SENTINEL ? value1 - value2 : 1;
if (item_type (item2) == SENTINEL)
return -1;
}
#undef value1
#undef value2
}
/*-----------------.
| Add a new item. |
`-----------------*/
static inline void
new_item (enum type type, int checksum)
{
ITEM *item;
if (items % (64 * TYPES_PER_WORD) == 0)
{
item_array = (ITEM *)
xrealloc (item_array, (items + 64 * TYPES_PER_WORD) * sizeof (ITEM));
#if SAFER_SLOWER
type_array = (unsigned *)
xrealloc (type_array,
(items / TYPES_PER_WORD + 64) * sizeof (unsigned));
#endif
}
item = item_array + items++;
set_item_type (item, type);
item->checksum = checksum;
}
/*---------------------.
| Add a new sentinel. |
`---------------------*/
static void
new_sentinel (void)
{
new_item (SENTINEL, 0);
}
/*------------------------------------------------------------------------.
| Find how many identical normal items follow, given two start items. |
| Ensure matchable items correspond to each other, but skip over white |
| items. The starting items may not be sentinels nor white items. Fuzzy |
| items, if any, ought to be embedded and correspond to each other. |
`------------------------------------------------------------------------*/
static int
identical_size (int index1, int index2)
{
ITEM *item1 = item_array + index1;
ITEM *item2 = item_array + index2;
int normal_count = 0;
int mismatch_count = 0;
while (1)
{
if (item1->checksum == item2->checksum
#if 0
/* Just assume that identical checksums imply identical types. */
&& item_type (item1) == item_type (item2)
#endif
)
{
if (item_type (item1) == NORMAL)
normal_count++;
}
else if (normal_count > 0 && mismatch_count < tolerance)
{
if (item_type (item1) == NORMAL && item_type (item2) == NORMAL)
normal_count++;
mismatch_count++;
}
else
break;
FORWARD_ITEM (item1);
FORWARD_ITEM (item2);
if (item_type (item1) == SENTINEL || item_type (item2) == SENTINEL)
break;
}
return normal_count;
}
/*-----------------------------------------------------------------------.
| Count normal items from START to FINISH (excluded). However, if there |
| are MAXIMUM or more normal input items, return a negative number. |
`-----------------------------------------------------------------------*/
static int
item_distance (int start, int finish, int maximum)
{
int counter = 0;
ITEM *item;
assert (start < finish);
assert (maximum > 0);
for (item = item_array + start; item < item_array + finish; item++)
if (item_type (item) == NORMAL)
{
counter++;
if (counter == maximum)
return -1;
}
return counter;
}
/* Files. */
/* All input files use a single continuous item counting scheme. To revert
item numbers back to actual file and item references, the following array
maintains the cumulated number items seen prior to the beginning of each
file, for each file given as argument to the program. To ease some
algorithms, a few sentinel items exist: one before the first file, one
between each file, and one after the last file. Each file counts all
sentinels preceding it. */
struct input
{
const char *file_name; /* name of input file */
struct stat stat_buffer; /* stat information for the file */
char nick_name[4]; /* short name of the file */
FILE *file; /* file being read */
char *memory_copy; /* buffer containing the file, or NULL */
/* Reading the file, one line or one character at a time. */
char *line; /* line from file */
char *cursor; /* cursor into line, or NULL at end of file */
char *limit; /* limit value for cursor */
size_t line_allocated; /* allocated length of line */
/* Rescanning of the file, one item at a time. */
int first_item; /* index of first item in this file */
int item_limit; /* one past last item index in this file */
int item; /* index of next item to consider */
/* Merging views. */
int *indirect_cursor; /* cursor into indirect_array */
int *indirect_limit; /* one past limit value of indirect_cursor */
/* Output control. */
short listing_allowed; /* if difference output allowed */
const char *user_start; /* user string before difference */
const char *user_stop; /* user string after difference */
const char *term_start; /* terminal string before difference */
const char *term_stop; /* terminal string after difference */
};
static struct input *input_array = NULL;
static int inputs = 0;
int common_listing_allowed; /* if common output allowed */
/* Convenience macros. */
#define left (input_array + 0)
#define right (input_array + 1)
#define INPUT_MEMBER(Input) \
(member_array + *(Input)->indirect_cursor)
#define INPUT_CLUSTER(Input) \
(cluster_array + member_array[*(Input)->indirect_cursor].cluster_number)
#if DEBUGGING
/*---------------------.
| Dump a given INPUT. |
`---------------------*/
static void
dump_input (struct input *input)
{
fprintf (stderr, "%s1,%d\t%7d\t%s\n",
input->nick_name, input->item_limit - input->first_item,
input->first_item, input->file_name);
}
/*------------------.
| Dump all inputs. |
`------------------*/
static void
dump_all_inputs (void)
{
int counter;
fputs ("\f\n", stderr);
for (counter = 0; counter < inputs; counter++)
dump_input (input_array + counter);
}
#endif /* DEBUGGING */
/*---------------------------------------------------------------------.
| Swallow the whole INPUT into a contiguous region of memory. In the |
| INPUT structure, file name and stat buffer are already initialised. |
`---------------------------------------------------------------------*/
/* Define to reallocation increment when swallowing input. */
#define SWALLOW_BUFFER_STEP 20000
static void
swallow_input (struct input *input)
{
int handle; /* file descriptor number */
size_t allocated_length; /* allocated length of memory buffer */
size_t length; /* total length read so far */
int read_length; /* number of character gotten on last read */
/* Standard input is already opened. In all other cases, open the file
from its name. */
if (strcmp (input->file_name, STDIN_PRINTED_NAME) == 0)
handle = fileno (stdin);
else if (handle = open (input->file_name, O_RDONLY), handle < 0)
error (EXIT_ERROR, errno, "%s", input->file_name);
/* If the file is a plain, regular file, allocate the memory buffer all at
once and swallow the file in one blow. In other cases, read the file
repeatedly in smaller chunks until we have it all, reallocating memory
once in a while, as we go. */
#if MSDOS
/* On MSDOS, we cannot predict in memory size from file size, because of
end of line conversions. */
#else
if (S_ISREG (input->stat_buffer.st_mode))
{
input->memory_copy = (char *)
xmalloc ((size_t) input->stat_buffer.st_size);
if (read
(handle, input->memory_copy,
(size_t) input->stat_buffer.st_size) != input->stat_buffer.st_size)
error (EXIT_ERROR, errno, "%s", input->file_name);
}
else
#endif
{
input->memory_copy = xmalloc ((size_t) SWALLOW_BUFFER_STEP);
allocated_length = SWALLOW_BUFFER_STEP;
length = 0;
while (read_length = read (handle, input->memory_copy + length,
allocated_length - length), read_length > 0)
{
length += read_length;
if (length == allocated_length)
{
allocated_length += SWALLOW_BUFFER_STEP;
input->memory_copy = (char *)
xrealloc (input->memory_copy, allocated_length);
}
}
if (read_length < 0)
error (EXIT_ERROR, errno, "%s", input->file_name);
}
/* Close the file, but only if it was not the standard input. */
if (handle != fileno (stdin))
close (handle);
}
/*-------------------------------------------.
| Register a file NAME to be later studied. |
`-------------------------------------------*/
static void
new_input (const char *name)
{
static int stdin_swallowed = 0;
struct input *input;
/* Add a new input file descriptor, read in stdin right away. */
if (inputs % 16 == 0)
input_array = (struct input *)
xrealloc (input_array, (inputs + 16) * sizeof (struct input));
input = input_array + inputs++;
if (strcmp (name, "") == 0 || strcmp (name, "-") == 0)
if (stdin_swallowed)
error (EXIT_ERROR, 0, _("only one file may be standard input"));
else
{
input->file_name = STDIN_PRINTED_NAME;
if (fstat (fileno (stdin), &input->stat_buffer) != 0)
error (EXIT_ERROR, errno, "%s", input->file_name);
swallow_input (input);
stdin_swallowed = 1;
}
else
{
input->file_name = name;
if (stat (input->file_name, &input->stat_buffer) != 0)
error (EXIT_ERROR, errno, "%s", input->file_name);
if ((input->stat_buffer.st_mode & S_IFMT) == S_IFDIR)
error (EXIT_ERROR, 0, _("directories not supported"));
input->memory_copy = NULL;
}
}
/*-------------------------------.
| Prepare INPUT for re-reading. |
`-------------------------------*/
static void
open_input (struct input *input)
{
if (input->memory_copy)
input->limit = input->memory_copy;
else
{
if (input->file = fopen (input->file_name, "r"), !input->file)
error (EXIT_ERROR, errno, "%s", input->file_name);
input->line = NULL;
}
input->line_allocated = 0;
}
static void
close_input (struct input *input)
{
if (input->line_allocated > 0)
free (input->line);
if (!input->memory_copy)
fclose (input->file);
}
/*-------------------------------------------------------------------------.
| Prepare INPUT for next line, then available from INPUT->LINE through |
| INPUT->LIMIT (excluded). INPUT->CURSOR will point to first character of |
| the line, or will be NULL at end of file. |
`-------------------------------------------------------------------------*/
static void
input_line (struct input *input)
{
if (input->memory_copy)
{
const char *limit = input->memory_copy + input->stat_buffer.st_size;
char *cursor;
input->line = input->limit;
for (cursor = input->line; cursor < limit && *cursor != '\n'; cursor++)
;
if (cursor < limit)
{
cursor++;
input->cursor = input->line;
}
else if (cursor == input->line)
input->cursor = NULL;
else
input->cursor = input->line;
input->limit = cursor;
}
else
{
int length
= getline (&input->line, &input->line_allocated, input->file);
if (length < 0)
input->cursor = NULL;
else
{
input->cursor = input->line;
input->limit = input->line + length;
}
}
}
/*-------------------------------------------------------------------------.
| Prepare INPUT for next character, then available through *INPUT->CURSOR, |
| unless INPUT->CURSOR is NULL for indicating end of file. |
`-------------------------------------------------------------------------*/
static void
input_character_helper (struct input *input)
{
int counter;
/* Read in a new line, but skip ignorable ones. FIXME: This is just not
right. Ignorable lines may need copying! */
do
{
input_line (input);
/* Possibly check if the line should be ignored. */
for (counter = 0; counter < ignore_regexps; counter++)
if (re_match (ignore_regexp_array[counter],
input->line, input->limit - input->line, 0, NULL) > 0)
break;
}
while (counter < ignore_regexps);
assert (!input->cursor || input->cursor < input->limit);
}
static inline void
input_character (struct input *input)
{
assert (input->cursor);
input->cursor++;
if (input->cursor == input->limit)
input_character_helper (input);
}
/*------------------------------------------------------------.
| Construct descriptors for all items of a given INPUT file. |
`------------------------------------------------------------*/
static void
study_input (struct input *input)
{
#if SAVE_AND_SLOW
# define ADJUST_CHECKSUM(Character) \
checksum = (checksum << 5) + (checksum >> (BITS_PER_WORD - 5)) \
+ (Character & 0xFF)
#else
# define ADJUST_CHECKSUM(Character) \
checksum = (checksum << 5) + \
(checksum >> (BITS_PER_WORD - BITS_PER_TYPE - 5)) \
+ (Character & 0xFF)
#endif
int item_count; /* number of items read */
char *buffer = NULL; /* line buffer */
int length = 0; /* actual line length in buffer */
/* Read the file and checksum all items. */
if (verbose)
fprintf (stderr, _("Reading %s"), input->file_name);
open_input (input);
input->first_item = items;
item_count = 0;
/* Read all lines. */
while (input_line (input), input->cursor)
{
int counter;
/* Possibly check if the line should be ignored. */
for (counter = 0; counter < ignore_regexps; counter++)
if (re_match (ignore_regexp_array[counter],
input->line, input->limit - input->line, 0, NULL) > 0)
break;
if (counter < ignore_regexps)
{
if (!word_mode)
new_item (WHITE, 0);
continue;
}
/* The line is not being ignored. */
/* We prefer `cursor < buffer + length' over `*cursor' in the loop
tests, so embedded NULs can be handled. */
if (word_mode)
{
char *cursor = input->line;
unsigned checksum;
/* FIXME: Might be simplified out of the line loop. */
while (cursor < input->limit)
{
while (cursor < input->limit && isspace (*cursor))
cursor++;
if (cursor < input->limit)
{
checksum = 0;
while (cursor < input->limit && !isspace (*cursor))
{
ADJUST_CHECKSUM (*cursor);
cursor++;
}
new_item (NORMAL, checksum);
item_count++;
}
}
}
else
{
char *cursor;
unsigned checksum = 0;
int line_has_delims = 0;
int line_has_alnums = 0;
for (cursor = input->line; cursor < input->limit; cursor++)
if (isspace (*cursor))
{
if (!ignore_all_space)
{
if (ignore_space_change)
{
ADJUST_CHECKSUM (' ');
while (cursor + 1 < buffer + length
&& isspace (cursor[1]))
cursor++;
}
else
ADJUST_CHECKSUM (*cursor);
}
}
else if (isalpha (*cursor))
{
line_has_alnums = 1;
if (ignore_case && islower (*cursor))
{
char character = toupper (*cursor);
ADJUST_CHECKSUM (character);
}
else
ADJUST_CHECKSUM (*cursor);
}
else if (isdigit (*cursor))
{
line_has_alnums = 1;
ADJUST_CHECKSUM (*cursor);
}
else
{
line_has_delims = 1;
ADJUST_CHECKSUM (*cursor);
}
/* Register the checksum. */
if (line_has_alnums)
new_item (NORMAL, checksum);
else if (line_has_delims)
new_item (ignore_delimiters ? DELIMS : NORMAL, checksum);
else if (ignore_blank_lines)
new_item (WHITE, checksum);
else
new_item (ignore_delimiters ? DELIMS : NORMAL, checksum);
item_count++;
}
}
input->item_limit = items;
/* Cleanup. */
close_input (input);
if (verbose)
fprintf (stderr, ngettext (", %d item\n", ", %d items\n", item_count),
item_count);
#undef ADJUST_CHECKSUM
}
/*------------------------.
| Study all input files. |
`------------------------*/
/* If all input files fit in MAXIMUM_TOTAL_BUFFER, they are all swallowed in
memory at once. Otherwise, they are read from disk one line at a time.
A fixed value is far than ideal: we should consider how much real memory
space is available, and I do not know how to do this portably. */
#define MAXIMUM_TOTAL_BUFFER 500000
static void
study_all_inputs (void)
{
struct input *input;
int total_size;
/* Compute nick names for all files. */
if (inputs == 2)
{
/* If only two input files, just mimick `diff' output. */
strcpy (input_array[0].nick_name, "-");
strcpy (input_array[1].nick_name, "+");
}
else
{
int name_length = 1;
int file_limit = 26;
/* Choose nick names as sequences of lower case letters. */
while (inputs > file_limit)
{
name_length++;
file_limit *= 26;
}
for (input = input_array; input < input_array + inputs; input++)
{
int value = input - input_array;
char *cursor = input->nick_name + name_length;
*cursor-- = '\0';
while (cursor >= input->nick_name)
{
*cursor-- = value % 26 + 'a';
value /= 26;
}
}
}
/* Swallow all files not already copied in memory, if room permits. */
total_size = 0;
for (input = input_array; input < input_array + inputs; input++)
total_size += input->stat_buffer.st_size;
if (total_size <= MAXIMUM_TOTAL_BUFFER)
for (input = input_array; input < input_array + inputs; input++)
if (!input->memory_copy)
swallow_input (input);
/* Compute all checksums. */
new_sentinel ();
for (input = input_array; input < input_array + inputs; input++)
{
study_input (input);
new_sentinel ();
}
if (verbose)
{
fprintf (stderr, _("Read summary:"));
fprintf (stderr, ngettext (" %d file,", " %d files,", inputs), inputs);
fprintf (stderr, ngettext (" %d item\n", " %d items\n",
items - inputs - 1), items - inputs - 1);
}
#if DEBUGGING
if (debugging)
{
dump_all_items ();
dump_all_inputs ();
}
#endif
}
/* Item references. */
struct reference
{
struct input *input; /* input file for reference */
int number; /* item number for reference */
};
/*-------------------------------------------------------------------------.
| Explicit a reference for internal item NUMBER. The first sentinel has |
| line 0, other sentinels have one more than number of lines in the file. |
`-------------------------------------------------------------------------*/
static struct reference
get_reference (int number)
{
struct input *input;
struct reference result;
assert (number < items);
/* FIXME: if we are studying many files, linear searches become a bit
crude, binary searches would be better in such cases. */
for (input = input_array; number >= input->item_limit + 1; input++)
;
result.input = input;
result.number = number - input->first_item + 1;
return result;
}
/*------------------------------------------------------------------------.
| Produce a short string referencing an internal item NUMBER. The result |
| is statically allocated into a ring of little buffers. |
`------------------------------------------------------------------------*/
static char *
reference_string (int number)
{
#define RING_LENGTH 4
struct reference reference;
static char buffer[RING_LENGTH][20];
static int next = RING_LENGTH - 1;
if (next == RING_LENGTH - 1)
next = 0;
else
next++;
reference = get_reference (number);
if (number == reference.input->item_limit)
sprintf (buffer[next], "%s.EOF", reference.input->nick_name);
else
sprintf (buffer[next], "%s%d",
reference.input->nick_name, reference.number);
return buffer[next];
#undef RING_LENGTH
}
#if DEBUGGING
/*-------------------------------------------------------------------------.
| Dump a reference to a given item in compilation error format. Ensure at |
| least one space, and in fact, enough to align diagnostics as we go. |
`-------------------------------------------------------------------------*/
static void
dump_reference (int item)
{
struct reference reference;
char buffer[20];
static int last_width = 0;
int width;
reference = get_reference (item);
sprintf (buffer, "%d", reference.number);
fprintf (stderr, "%s:%s: ", reference.input->file_name, buffer);
width = strlen (reference.input->file_name) + strlen (buffer);
if (width < last_width)
while (width++ < last_width)
putc (' ', stderr);
else
last_width = width;
}
#endif /* DEBUGGING */
/* Clusters and members. */
/* A cluster represents one set of items which is repeated at two or more
places in the input files, while each repetition is called a cluster
member. The member size is an item count which excludes white items. */
struct cluster
{
short first_member; /* index in member_array array */
short item_count; /* size of each member */
};
static struct cluster *cluster_array = NULL;
int clusters = 0;
/* A cluster member starts at some item number and runs for a given number
of items. Ignorable items may be embedded in a cluster member, so
cluster members of a single cluster may have different lengths, but a
cluster member never starts nor end with an white item. Sentinels
are never part of any cluster. By construction, all cluster members of a
same cluster are next to each other. */
struct member
{
short cluster_number; /* ordinal of cluster, counted from 0 */
int first_item; /* number of first item for this member */
};
static struct member *member_array = NULL;
static int members = 0;
/* Convenience macros. */
#define MEMBER_LIMIT(Cluster) \
(member_array + ((Cluster) + 1)->first_member)
#define MEMBERS(Cluster) \
(((Cluster) + 1)->first_member - (Cluster)->first_member)
/*---------------------------------------------------------------------.
| Find how many input items are part of a given cluster MEMBER. The |
| returned count includes embedded items having less significance, but |
| exclude last white items. |
`---------------------------------------------------------------------*/
static int
real_member_size (struct member *member)
{
int number = cluster_array[member->cluster_number].item_count;
ITEM *item = item_array + member->first_item;
ITEM *last_item;
/* Skip over NUMBER normal items. */
while (number > 0)
switch (item_type (item))
{
case NORMAL:
number--;
/* Fall through. */
case DELIMS:
case WHITE:
item++;
break;
case SENTINEL:
/* Cannot happen. */
abort ();
}
/* Skip over supplementary matchable or white items, return the item
count as for the last normal or matchable item. */
last_item = item;
while (1)
switch (item_type (item))
{
case NORMAL:
case SENTINEL:
return last_item - item_array - member->first_item;
case DELIMS:
last_item = item++;
break;
case WHITE:
item++;
break;
}
}
#if DEBUGGING
/*-----------------------.
| Dump a given CLUSTER. |
`-----------------------*/
static void
dump_cluster (struct cluster *cluster)
{
int counter;
struct member *member;
fprintf (stderr, "{%ld},%d",
(long) (cluster - cluster_array), cluster->item_count);
for (counter = cluster->first_member;
counter < (cluster + 1)->first_member; counter++)
{
member = member_array + counter;
fprintf (stderr, "%c[%d] %s,%d",
counter == cluster->first_member ? '\t' : ' ', counter,
reference_string (member->first_item),
real_member_size (member));
}
putc ('\n', stderr);
}
/*--------------------.
| Dump all clusters. |
`--------------------*/
static void
dump_all_clusters (void)
{
int counter;
fputs ("\f\n", stderr);
for (counter = 0; counter < clusters; counter++)
dump_cluster (cluster_array + counter);
}
/*----------------------.
| Dump a given MEMBER. |
`----------------------*/
static void
dump_member (struct member *member)
{
fprintf (stderr, " [%ld]\t{%d}\t%s,%d+\n",
(long) (member - member_array), member->cluster_number,
reference_string (member->first_item),
cluster_array[member->cluster_number].item_count);
}
/*-------------------.
| Dump all members. |
`-------------------*/
static void
dump_all_members (void)
{
int counter;
fputs ("\f\n", stderr);
for (counter = 0; counter < members; counter++)
dump_member (member_array + counter);
}
#endif /* DEBUGGING */
/*----------------------------------------------------------------------.
| Sort helper. Compare two member indices, using the original input |
| order. When two members have the same start, put the longest first. |
`----------------------------------------------------------------------*/
static int
compare_for_member_start (const void *void_first, const void *void_second)
{
#define value1 *((int *) void_first)
#define value2 *((int *) void_second)
int result;
struct member *member1 = member_array + value1;
struct member *member2 = member_array + value2;
result = member1->first_item - member2->first_item;
if (result)
return result;
return (cluster_array[member2->cluster_number].item_count
- cluster_array[member1->cluster_number].item_count);
#undef value1
#undef value2
}
/*---------------------------------------------------------------------.
| Add a new cluster, for which each member has COUNT non-white items. |
`---------------------------------------------------------------------*/
static inline void
new_cluster (int count)
{
struct cluster *cluster;
if (clusters % 8 == 0)
cluster_array = (struct cluster *)
xrealloc (cluster_array, (clusters + 8) * sizeof (struct cluster));
cluster = cluster_array + clusters++;
cluster->first_member = members;
cluster->item_count = count;
}
/*---------------------------.
| Add a new cluster member. |
`---------------------------*/
static inline void
new_member (int item)
{
struct member *member;
if (members % 8 == 0)
member_array = (struct member *)
xrealloc (member_array, (members + 8) * sizeof (struct member));
member = member_array + members++;
member->cluster_number = clusters - 1;
member->first_item = item;
}
/*------------------------------------.
| Output a cluster explanation line. |
`------------------------------------*/
static void
explain_member (char prefix, struct member *quote)
{
struct cluster *cluster = cluster_array + quote->cluster_number;
struct member *member;
int counter;
struct reference reference;
putc (prefix, output_file);
for (member = member_array + cluster->first_member;
member < MEMBER_LIMIT (cluster); member++)
{
reference = get_reference (member->first_item);
fprintf (output_file, member == quote ? " %s%d,%d" : " (%s%d,%d)",
reference.input->nick_name, reference.number,
real_member_size (member));
}
putc ('\n', output_file);
}
/*----------------------.
| Search for clusters. |
`----------------------*/
static void
prepare_clusters (void)
{
/* The array of indirect items have similar contents next to each other. */
int *indirect_item_array = xmalloc (items * sizeof (int));
int indirect_items = 0; /* number of entries in indirect_item_array */
int *cluster_set; /* index for first member in set of clusters */
int *member_set; /* index for first member in current cluster */
/* For a given index, SIZE_ARRAY[index] describes the common item size
between item CLUSTER_SET[index] and CLUSTER_SET[index + 1]. */
int *size_array = NULL;
int allocated_sizes = 0; /* allocated entries for size_array */
int sizes; /* number of entries in size_array */
int *size; /* cursor in size_array */
/* Here is a bag of starts indices for members of the same cluster (having
all CLUSTER_SIZE worth items). These indices are values selected out
of INDIRECT_ITEM_ARRAY, between FIRST and LAST (included). */
int *sorter_array = NULL; /* for ensuring members are in nice order */
int sorters; /* number of members in sorter_array */
int *sorter; /* cursor into sorter_array */
int *cursor; /* cursor into sorter_array */
ITEM *item; /* cursor in item_array */
int cluster_size; /* size of current cluster */
int size_value; /* current size, or previous cluster size */
int counter; /* all purpose counter */
int checksum; /* possible common cheksum of previous items */
/* Sort indices. */
#if DEBUGGING
if (debugging)
fprintf (stderr, _("Sorting"));
#endif
for (counter = 0; counter < items; counter++)
if (item_type (item_array + counter) == NORMAL
|| item_type (item_array + counter) == DELIMS)
indirect_item_array[indirect_items++] = counter;
if (indirect_items < items)
indirect_item_array = (int *)
xrealloc (indirect_item_array, indirect_items * sizeof (int));
qsort (indirect_item_array, indirect_items, sizeof (int),
compare_for_checksum_runs);
/* Find all clusters. */
#if DEBUGGING
if (debugging)
fprintf (stderr, _(", clustering"));
#endif
for (cluster_set = indirect_item_array;
cluster_set + 1 < indirect_item_array + indirect_items;
cluster_set += sizes + 1)
{
/* Find all members beginning with the same run of checksums. These
will be later distributed among a few clusters of various sizes,
and so, are common to the incoming set of clusters. */
sizes = 0;
while (cluster_set + sizes + 1 < indirect_item_array + indirect_items)
{
size_value
= identical_size (cluster_set[sizes], cluster_set[sizes + 1]);
if (size_value < minimum_size)
break;
if (sizes == allocated_sizes)
{
allocated_sizes += 32;
size_array = (int *)
xrealloc (size_array, allocated_sizes * sizeof (int));
sorter_array = (int *)
xrealloc (sorter_array, (allocated_sizes + 1) * sizeof (int));
}
size_array[sizes++] = size_value;
}
/* This test is not necessary for the algorithm to work, but this
fairly common case might be worth a bit of speedup. Maybe! */
if (sizes == 0)
continue;
/* Output all clusters of the set from the tallest to the shortest.
Here, size refers to number of items in members, and not to the
number of members in a cluster. (In fact, it is very expectable
that shortest clusters have more members.) */
cluster_size = 0;
while (1)
{
/* Discover the maximum cluster size not yet processed. */
size_value = cluster_size;
cluster_size = 0;
for (size = size_array; size < size_array + sizes; size++)
if ((size_value == 0 || *size < size_value)
&& *size > cluster_size)
cluster_size = *size;
/* If the cluster size did not decrease, we cannot do more. */
if (cluster_size == 0)
break;
/* Consider all consecutive members having at least the cluster
size in common: they form a cluster. But any gap in the
sequence represents a change of cluster: same length, but
different contents. */
size = size_array;
while (1)
{
/* Find all members for one cluster. However, after having
skipped over the gap, just break out if nothing remains. */
while (size < size_array + sizes && *size < cluster_size)
size++;
if (size == size_array + sizes)
break;
member_set = cluster_set + (size - size_array);
sorters = 1;
while (size < size_array + sizes && *size >= cluster_size)
{
sorters++;
size++;
}
/* No cluster may be a proper subset of another. That is, if
all putative members are preceded by identical items, then
they are indeed part of a bigger cluster, which has already
been or will later be caught. In such case, just avoid
retaining them here. This also prevents quadratic
behaviour which, I presume, would be heavy on computation.
This test may be defeated by tolerant matches. Maybe
tolerant matches will just go away. Surely, tolerant
matches later require subset member elimination. */
item = item_array + member_set[0];
BACKWARD_ITEM (item);
if (item_type (item) != SENTINEL)
{
checksum = item->checksum;
for (counter = 1; counter < sorters; counter++)
{
item = item_array + member_set[counter];
BACKWARD_ITEM (item);
if (item_type (item) == SENTINEL
|| item->checksum != checksum)
break;
}
if (counter == sorters)
continue;
}
/* Skip any cluster member overlapping with the previous
member of the same cluster. If doing so, chop the size of
the first member just before the overlap point: this should
later trigger a cluster having this reduced size. */
memcpy (sorter_array, member_set, sorters * sizeof (int));
qsort (sorter_array, sorters, sizeof (int),
compare_for_positions);
cursor = sorter_array;
for (counter = 1; counter < sorters; counter++)
{
size_value = item_distance (*cursor, sorter_array[counter],
cluster_size);
if (size_value < 0)
*++cursor = sorter_array[counter];
else
{
int counter2;
for (counter2 = 0; counter2 < sizes; counter2++)
if (cluster_set[counter2] == *cursor
|| cluster_set[counter2] == sorter_array[counter])
{
assert (size_value < size_array[counter2]);
size_array[counter2] = size_value;
break;
}
assert (counter2 < sizes);
}
}
sorters = cursor - sorter_array + 1;
/* Create the cluster only if at least two members remain. */
if (sorters >= 2)
{
new_cluster (cluster_size);
for (counter = 0; counter < sorters; counter++)
new_member (sorter_array[counter]);
}
}
}
}
/* Add a sentinel cluster at the end. */
new_cluster (0);
clusters--;
/* Cleanup. */
free (indirect_item_array);
free (size_array);
#if DEBUGGING
if (debugging)
{
fprintf (stderr, _(", done\n"));
dump_all_clusters ();
}
#endif
}
/*------------------------------------------------------------.
| Check if a MEMBER is active in some file other than INPUT. |
`------------------------------------------------------------*/
static int
active_elsewhere (struct member *member, struct input *input)
{
struct cluster *cluster = cluster_array + member->cluster_number;
/* FIXME: maybe it is sufficient to test first and last member only? */
for (member = member_array + cluster->first_member;
member < MEMBER_LIMIT (cluster); member++)
if (member->first_item < input->first_item
|| member->first_item + real_member_size (member) > input->item_limit)
return 1;
return 0;
}
/* Indirect members. */
/* The following array gives indices into the array of cluster members,
member_array above, in such a way that the succession of indices points
to members in the original textual order of input files. */
static int *indirect_array;
static int indirects;
/*----------------------------------------.
| Compute the array of indirect members. |
`----------------------------------------*/
static void
prepare_indirects (void)
{
int counter;
struct member *member;
struct input *input;
int duplicated_items;
#if DEBUGGING
if (debugging)
fprintf (stderr, _("Sorting members"));
#endif
indirect_array = xmalloc (members * sizeof (int));
for (counter = 0; counter < members; counter++)
indirect_array[counter] = counter;
if (members > 1)
qsort (indirect_array, members, sizeof (int), compare_for_member_start);
indirects = members;
#if DEBUGGING
if (debugging)
{
fprintf (stderr, _(", done\n"));
fputs ("\f\n", stderr);
for (counter = 0; counter < indirects; counter++)
{
member = member_array + indirect_array[counter];
dump_reference (member->first_item);
dump_member (member_array + indirect_array[counter]);
if (counter < indirects - 1
&& (member_array[indirect_array[counter + 1]].first_item
< member->first_item + real_member_size (member)))
{
dump_reference (member->first_item);
fprintf (stderr, "Overlapping with next member\n");
}
}
}
#endif
if (verbose)
{
fprintf (stderr, _("Work summary:"));
fprintf (stderr, ngettext (" %d cluster,", " %d clusters,", clusters),
clusters);
fprintf (stderr, ngettext (" %d member\n", " %d members\n", members),
members);
}
}
/* Mergings. */
/* A merging is an indication for advancing in one given input file, by
catching up all items (differences) until a cluster member, and then
skipping over that member. Mergings are ordered so to maintain parallel
advancement between files. A merging group is a fragment in the sequence
of consecutive mergings, all mergings in a group have members from the
same cluster. A merging group is then variable in length, a flag in the
merging sequence signals the beginning of a new group.
However, some cluster members might have to be considered as differences
preceding the more genuine member of a group, because they represent
cross matches which are not easily represented in a parallel sequence.
Another flag signals such members, which then escape the rule that all
members of a group share the same cluster. */
struct merging
{
unsigned group_flag:1; /* beginning of a new merge group */
unsigned cross_flag:1; /* member isolated by cross matches */
unsigned input_number:14; /* input file designator */
unsigned member_number:16; /* member designator */
};
static struct merging *merging_array = NULL;
static int mergings = 0;
#if DEBUGGING
/*--------------------.
| Dump all mergings. |
`--------------------*/
static void
dump_all_mergings (void)
{
struct merging *merging;
struct reference reference;
fputs ("\f\n", stderr);
for (merging = merging_array; merging < merging_array + mergings; merging++)
{
if (merging->group_flag)
{
if (merging > merging_array)
putc ('\n', stderr);
fprintf (stderr, "<%ld>", (long) (merging - merging_array));
}
reference
= get_reference (member_array[merging->member_number].first_item);
fprintf (stderr, "\t[%d]%c%s%d", merging->member_number,
merging->cross_flag ? 'X' : ' ',
reference.input->nick_name, reference.number);
assert (reference.input == input_array + merging->input_number);
}
putc ('\n', stderr);
}
#endif /* DEBUGGING */
/*------------------------------------------------------------------.
| After having output PREFIX, explain the merging group starting at |
| MERGING and extending until LIMIT. |
`------------------------------------------------------------------*/
static void
explain_group (char prefix, struct merging *merging, struct merging *limit)
{
struct cluster *cluster
= cluster_array + member_array[merging->member_number].cluster_number;
int counter;
struct input *input;
struct member *member;
struct merging *cursor;
struct reference reference;
putc (prefix, output_file);
for (counter = cluster->first_member;
counter < (cluster + 1)->first_member; counter++)
{
member = member_array + counter;
reference = get_reference (member->first_item);
for (cursor = merging;
cursor < limit && cursor->member_number != counter; cursor++)
;
fprintf (output_file, cursor < limit ? " %s%d,%d" : " (%s%d,%d)",
reference.input->nick_name,
reference.number, real_member_size (member));
}
putc ('\n', output_file);
}
/*--------------------.
| Add a new merging. |
`--------------------*/
static void
new_merging (int group, int cross, struct input *input, struct member *member)
{
struct merging *merging = merging_array + mergings++;
merging->group_flag = group;
merging->cross_flag = cross;
merging->input_number = input - input_array;
merging->member_number = member - member_array;
}
/*------------------------------.
| Decide the merging sequence. |
`------------------------------*/
void
prepare_mergings (void)
{
int *cursor;
struct input *input0;
struct input *input;
struct member *member;
struct cluster *cluster; /* current cluster candidate */
int cost; /* cost associate with current candidate */
struct cluster *best_cluster; /* best cluster candidate for hunk */
int best_cost; /* cost associated with best cluster */
int group_flag; /* set if next merging starts group */
/* Remove member overlaps. */
if (members > 0)
{
int counter;
/* When members overlap, retain only the shortest ones (for now). */
indirects = 0;
for (counter = 0; counter < members - 1; counter++)
{
member = member_array + indirect_array[counter];
if (member->first_item + real_member_size (member)
<= member_array[indirect_array[counter + 1]].first_item)
indirect_array[indirects++] = indirect_array[counter];
else
/* Invalidate this member. */
member->cluster_number = -1;
}
indirect_array[indirects++] = indirect_array[counter];
}
/* Once indirects sorted and ready, this array is logically split into
segments, one per input file, which segments might be later scanned in
parallel a few times. All required state variables for resuming the
scan are held into the last few fields of the input structure. */
cursor = indirect_array;
for (input = input_array; input < input_array + inputs; input++)
{
input->item = input->first_item;
input->indirect_cursor = cursor;
while (cursor < indirect_array + indirects
&& member_array[*cursor].first_item < input->item_limit)
cursor++;
input->indirect_limit = cursor;
}
/* Allocate an array for discovered mergings. */
merging_array = xmalloc (indirects * sizeof (struct merging));
mergings = 0;
/* Repetitively consider the incoming cluster members for all inputs, and
select at each iteration the cluster members causing least differences.
This may indirectly trigger bigger differences into later iterations.
Some thought should be given to global optimisation. FIXME. */
while (1)
{
#if DEBUGGING
if (debugging)
{
fprintf (stderr, "\nCHOOSING NEXT CLUSTER\n");
for (input = input_array; input < input_array + inputs; input++)
if (input->indirect_cursor < input->indirect_limit)
{
fprintf (stderr, "%s:\t", reference_string (input->item));
dump_member (INPUT_MEMBER (input));
}
else
fprintf (stderr, "%s:\tNone\n", reference_string (input->item));
putc ('\n', stderr);
}
#endif
best_cluster = NULL;
for (input0 = input_array; input0 < input_array + inputs; input0++)
if (input0->indirect_cursor < input0->indirect_limit)
{
cluster = INPUT_CLUSTER (input0);
#if DEBUGGING
if (debugging)
{
fprintf (stderr, "%s:\t", reference_string (input0->item));
dump_cluster (cluster);
}
#endif
/* Skip this input if we have already evaluated the cluster. */
for (input = input_array; input < input0; input++)
if (input->indirect_cursor < input->indirect_limit
&& INPUT_CLUSTER (input) == cluster)
break;
if (input < input0)
continue;
/* Evaluate the cost of the cluster. This will be the total
number of difference items needed in the listing for getting
to the point of printing the cluster. For computing it,
check all members of the evaluated cluster, retaining only
one member per file, in fact, exactly the first which has not
been listed yet. */
cost = 0;
input = input_array;
member = member_array + cluster->first_member;
while (member < MEMBER_LIMIT (cluster))
{
/* Just ignore invalidated members. */
if (member->cluster_number < 0)
{
member++;
continue;
}
/* Find the proper file. */
while (member->first_item >= input->item_limit)
input++;
/* Ignore a member that would have been already listed. */
if (member->first_item < input->item)
{
member++;
continue;
}
/* Accumulate cost for this member. */
#if DEBUGGING
if (debugging)
fprintf (stderr, " Cost += %d [%s..%s)\n",
member->first_item - input->item,
reference_string (input->item),
reference_string (member->first_item));
#endif
cost += (member++)->first_item - input->item;
/* Skip other members that would appear later in same file. */
while (member < MEMBER_LIMIT (cluster)
&& member->first_item < input->item_limit)
member++;
}
/* Retain the best cluster so far. */
#if DEBUGGING
if (debugging)
{
if (best_cluster)
fprintf (stderr, " {%ld}=%d <-> {%ld}=%d\n",
(long) (best_cluster - cluster_array), best_cost,
(long) (cluster - cluster_array), cost);
else
fprintf (stderr, " {%ld}=%d\n",
(long) (cluster - cluster_array), cost);
}
#endif
if (!best_cluster || cost < best_cost)
{
best_cluster = cluster;
best_cost = cost;
}
}
/* Get out if everything has been done. */
if (!best_cluster)
break;
#if DEBUGGING
if (debugging)
{
fprintf (stderr, "\nCHOICE\t");
dump_cluster (best_cluster);
putc ('\n', stderr);
}
#endif
/* Save found mergings, while moving all items pointers to after the
members of the best cluster. */
input = input_array;
group_flag = 1;
member = member_array + best_cluster->first_member;
while (member < MEMBER_LIMIT (best_cluster))
{
/* Just ignore invalidated members. */
if (member->cluster_number < 0)
{
member++;
continue;
}
/* Find the proper file. */
#if DEBUGGING
if (debugging)
{
putc ('v', stderr);
dump_member (member);
}
#endif
while (member->first_item >= input->item_limit)
input++;
/* Ignore a member that would have been already listed. */
if (member->first_item < input->item)
{
member++;
continue;
}
/* Skip all crossed members while adding them as crossed mergings. */
while (INPUT_MEMBER (input) != member)
{
new_merging (group_flag, 1, input, INPUT_MEMBER (input));
group_flag = 0;
input->indirect_cursor++;
}
assert (input->indirect_cursor < input->indirect_limit);
assert (INPUT_MEMBER (input)->first_item < input->item_limit);
/* Skip the selected member while adding it as a direct merging. */
new_merging (group_flag, 0, input, member);
group_flag = 0;
input->item = member->first_item + real_member_size (member);
input->indirect_cursor++;
/* Skip other members that would appear later in same file. */
while (member < MEMBER_LIMIT (best_cluster)
&& member->first_item < input->item_limit)
member++;
}
}
#if DEBUGGING
if (debugging)
dump_all_mergings ();
#endif
assert (mergings == indirects);
if (verbose)
{
fprintf (stderr, _("Work summary:"));
fprintf (stderr, ngettext (" %d cluster,", " %d clusters,", clusters),
clusters);
fprintf (stderr, ngettext (" %d member,", " %d members,", members),
members);
fprintf (stderr, ngettext (" %d overlap\n", " %d overlaps\n",
members - indirects), members - indirects);
}
}
/* Terminal and pager support. */
/* How to start underlining. */
const char *termcap_start_underline = NULL;
/* How to stop underlining. */
const char *termcap_stop_underline = NULL;
/* How to start bolding. */
const char *termcap_start_bold = NULL;
/* How to stop bolding. */
const char *termcap_stop_bold = NULL;
enum emphasis
{
STRAIGHT, /* no emphasis */
UNDERLINED, /* underlined text */
BOLD /* bold text */
};
/* Current output emphasis. */
enum emphasis current_emphasis = STRAIGHT;
/*-----------------------------.
| Select strings for marking. |
`-----------------------------*/
static void
initialize_strings (void)
{
struct input *input;
#if HAVE_TPUTS
if (find_termcap)
{
const char *name; /* terminal capability name */
char term_buffer[2048]; /* terminal description */
static char *buffer; /* buffer for capabilities */
char *filler; /* cursor into allocated strings */
int success; /* tgetent results */
name = getenv ("TERM");
if (name == NULL)
error (EXIT_ERROR, 0,
_("select a terminal through the TERM environment variable"));
success = tgetent (term_buffer, name);
if (success < 0)
error (EXIT_ERROR, 0, _("could not access the termcap data base"));
if (success == 0)
error (EXIT_ERROR, 0, _("terminal type `%s' is not defined"), name);
buffer = (char *) malloc (strlen (term_buffer));
filler = buffer;
termcap_start_underline = tgetstr ("us", &filler);
termcap_stop_underline = tgetstr ("ue", &filler);
termcap_start_bold = tgetstr ("so", &filler);
termcap_stop_bold = tgetstr ("se", &filler);
}
#endif /* HAVE_TPUTS */
/* Ensure some default strings. For all input files except last, prefer
underline. For last input file, prefer bold. */
for (input = input_array; input < input_array + inputs - 1; input++)
{
input->term_start = termcap_start_underline;
input->term_stop = termcap_stop_underline;
if (!overstrike)
{
if (!termcap_start_underline && !input->user_start)
input->user_start = "[-";
if (!termcap_stop_underline && !input->user_stop)
input->user_stop = "-]";
}
}
input->term_start = termcap_start_bold;
input->term_stop = termcap_stop_bold;
if (!overstrike)
{
if (!termcap_start_bold && !input->user_start)
input->user_start = "{+";
if (!termcap_stop_bold && !input->user_stop)
input->user_stop = "+}";
}
}
#if HAVE_TPUTS
/*-----------------------------------------.
| Write one character for tputs function. |
`-----------------------------------------*/
static int
putc_for_tputs (int character)
{
return putc (character, output_file);
}
#endif /* HAVE_TPUTS */
/*-----------------------.
| Set current EMPHASIS. |
`-----------------------*/
static void
set_emphasis (enum emphasis emphasis)
{
#if HAVE_TPUTS
switch (current_emphasis)
{
case STRAIGHT:
switch (emphasis)
{
case STRAIGHT:
/* Done. */
break;
case UNDERLINED:
if (termcap_start_underline)
tputs (termcap_start_underline, 0, putc_for_tputs);
break;
case BOLD:
if (termcap_start_bold)
tputs (termcap_start_bold, 0, putc_for_tputs);
break;
}
break;
case UNDERLINED:
switch (emphasis)
{
case STRAIGHT:
if (termcap_stop_underline)
tputs (termcap_stop_underline, 0, putc_for_tputs);
break;
case UNDERLINED:
/* Done. */
break;
case BOLD:
if (termcap_stop_underline)
tputs (termcap_stop_underline, 0, putc_for_tputs);
if (termcap_start_bold)
tputs (termcap_start_bold, 0, putc_for_tputs);
break;
}
break;
case BOLD:
switch (emphasis)
{
case STRAIGHT:
if (termcap_stop_bold)
tputs (termcap_stop_bold, 0, putc_for_tputs);
break;
case UNDERLINED:
if (termcap_stop_bold)
tputs (termcap_stop_bold, 0, putc_for_tputs);
if (termcap_start_underline)
tputs (termcap_start_underline, 0, putc_for_tputs);
break;
case BOLD:
/* Done. */
break;
}
break;
}
#endif /* HAVE_TPUTS */
current_emphasis = emphasis;
}
/*---------------------------------------------------------.
| Push a new EMPHASIS, or pop it out back to what it was. |
`---------------------------------------------------------*/
#define EMPHASIS_STACK_LENGTH 1
static enum emphasis emphasis_array[EMPHASIS_STACK_LENGTH];
static int emphasises = 0;
static void
push_emphasis (enum emphasis emphasis)
{
assert (emphasises < EMPHASIS_STACK_LENGTH);
emphasis_array[emphasises++] = current_emphasis;
set_emphasis (emphasis);
}
static void
pop_emphasis (void)
{
assert (emphasises > 0);
set_emphasis (emphasis_array[--emphasises]);
}
/*--------------------------------------------------------------------------.
| Output a STRING having LENGTH characters, subject to the current |
| emphasis. If EXPAND is nonzero, expand TABs. For expansion to work |
| properly, this routine should always be called while copying input data. |
`--------------------------------------------------------------------------*/
static void
output_characters (const char *string, int length, int expand)
{
static unsigned column = 0;
const char *cursor;
int counter;
if (overstrike || expand)
for (cursor = string; cursor < string + length; cursor++)
switch (*cursor)
{
/* Underlining or overstriking whitespace surely looks strange,
but "less" does understand such things as emphasis requests. */
case '\n':
case '\r':
case '\v':
case '\f':
putc (*cursor, output_file);
column = 0;
break;
case '\b':
putc ('\b', output_file);
if (column > 0)
column--;
break;
case '\t':
if (expand)
do
{
if (overstrike)
switch (current_emphasis)
{
case STRAIGHT:
putc (' ', output_file);
break;
case UNDERLINED:
putc ('_', output_file);
if (overstrike_for_less)
{
putc ('\b', output_file);
putc (' ', output_file);
}
break;
case BOLD:
putc (*cursor, output_file);
if (overstrike_for_less)
{
putc ('\b', output_file);
putc (' ', output_file);
}
break;
}
else
putc (' ', output_file);
column++;
}
while (column % 8 != 0);
else
putc ('\t', output_file);
break;
case ' ':
if (overstrike)
switch (current_emphasis)
{
case STRAIGHT:
putc (' ', output_file);
break;
case UNDERLINED:
putc ('_', output_file);
if (overstrike_for_less)
{
putc ('\b', output_file);
putc (' ', output_file);
}
break;
case BOLD:
putc (' ', output_file);
if (overstrike_for_less)
{
putc ('\b', output_file);
putc (' ', output_file);
}
break;
}
else
putc (' ', output_file);
column++;
break;
case '_':
if (overstrike_for_less && current_emphasis == UNDERLINED)
{
/* Overstriking an underline would make it bold in "less". */
putc ('_', output_file);
column++;
break;
}
/* Fall through. */
default:
if (overstrike)
switch (current_emphasis)
{
case STRAIGHT:
putc (*cursor, output_file);
break;
case UNDERLINED:
putc ('_', output_file);
putc ('\b', output_file);
putc (*cursor, output_file);
break;
case BOLD:
putc (*cursor, output_file);
putc ('\b', output_file);
putc (*cursor, output_file);
break;
}
else
putc (*cursor, output_file);
column++;
break;
}
else
fwrite (string, length, 1, output_file);
}
/*------------------------------------------------------------------------.
| While copying INPUT, select EMPHASIS, with preferred type for printer. |
`------------------------------------------------------------------------*/
static void
start_of_emphasis (struct input *input, enum emphasis emphasis)
{
assert (current_emphasis == STRAIGHT);
/* Avoid any emphasis if it would be useless. */
#if FIXME
if (!common_listing_allowed
&& (!right->listing_allowed || !left->listing_allowed))
return;
#endif
#if HAVE_TPUTS
if (input->term_start)
tputs (input->term_start, 0, putc_for_tputs);
#endif
if (input->user_start)
fprintf (output_file, "%s", input->user_start);
current_emphasis = emphasis;
}
/*-----------------------------------------------.
| Indicate end of emphasis while copying INPUT. |
`-----------------------------------------------*/
static void
end_of_emphasis (struct input *input)
{
assert (current_emphasis != STRAIGHT);
/* Avoid any emphasis if it would be useless. */
#if FIXME
if (!common_listing_allowed
&& (!right->listing_allowed || !left->listing_allowed))
return;
#endif
if (input->user_stop)
fprintf (output_file, "%s", input->user_stop);
#if HAVE_TPUTS
if (input->term_stop)
tputs (input->term_stop, 0, putc_for_tputs);
#endif
current_emphasis = STRAIGHT;
}
/*-------------------------------------------------------------------.
| Launch the output pager if any. If INPUT is not NULL, do it for a |
| specific input file. |
`-------------------------------------------------------------------*/
static void
launch_output_program (struct input *input)
{
if (paginate)
{
if (input)
output_file = writepipe ("pr", "-f", "-h", input->file_name, NULL);
else
output_file = writepipe ("pr", "-f", NULL);
}
else
{
char *program; /* name of the pager */
char *basename; /* basename of the pager */
/* Check if a output program should be called, and which one. Avoid
all paging if only statistics are needed. */
if (autopager && isatty (fileno (stdout))
#if FIXME
&& (left->listing_allowed
|| right->listing_allowed || common_listing_allowed)
#endif
)
{
program = getenv ("WDIFF_PAGER");
if (program == NULL)
program = getenv ("PAGER");
#ifdef PAGER_PROGRAM
if (program == NULL)
program = PAGER_PROGRAM;
#endif
}
else
program = NULL;
/* Use stdout as default output. */
#if DEBUGGING
output_file = debugging ? stderr : stdout;
#else
output_file = stdout;
#endif
/* If we should use a pager, launch it. */
if (program && *program)
{
char *lessenv;
lessenv = getenv ("LESS");
if (lessenv == NULL)
{
setenv ("LESS", LESS_DEFAULT_OPTS, 0);
}
else
{
if (asprintf (&lessenv, "%s %s", LESS_DEFAULT_OPTS, lessenv) ==
-1)
{
xalloc_die ();
return;
}
else
{
setenv ("LESS", lessenv, 1);
}
}
output_file = writepipe (program, NULL);
if (!output_file)
error (EXIT_ERROR, errno, "%s", program);
}
}
}
/*-----------------------------.
| Complete the pager program. |
`-----------------------------*/
static void
complete_output_program (void)
{
/* Let the user play at will inside the pager, until s/he exits, before
proceeding any further. */
if (output_file && output_file != stdout)
{
fclose (output_file);
wait (NULL);
}
}
/* Other listing services. */
enum margin_mode
{
EMPTY_MARGIN, /* nothing in left margin */
LOCATION_IN_MARGIN, /* number of next item */
FILLER_IN_MARGIN, /* bars for the length of nick name */
FILE_IN_MARGIN /* nick name for file */
};
/*-------------------------------------------.
| For file INPUT, produce a kind of MARGIN. |
`-------------------------------------------*/
static void
make_margin (struct input *input, enum margin_mode margin)
{
char buffer[15];
char *cursor;
switch (margin)
{
case EMPTY_MARGIN:
return;
case LOCATION_IN_MARGIN:
sprintf (buffer, "%s%d", input->nick_name,
input->item - input->first_item + 1);
break;
case FILLER_IN_MARGIN:
cursor = buffer + strlen (input->nick_name);
*cursor-- = '\0';
while (cursor > buffer)
*cursor-- = '|';
break;
case FILE_IN_MARGIN:
strcpy (buffer, input->nick_name);
break;
}
if (word_mode)
{
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
putc (initial_tab ? '\t' : ' ', output_file);
}
else
{
push_emphasis (STRAIGHT);
output_characters (buffer, strlen (buffer), 0);
putc (initial_tab ? '\t' : ' ', output_file);
pop_emphasis ();
}
}
/*-------------------------.
| Skip a line from INPUT. |
`-------------------------*/
static void
skip_line_item (struct input *input)
{
input_line (input);
assert (input->cursor);
input->item++;
}
/*-------------------------.
| Copy a line from INPUT. |
`-------------------------*/
static void
copy_line_item (struct input *input, enum margin_mode margin)
{
input_line (input);
assert (input->cursor);
make_margin (input, margin);
output_characters (input->line, input->limit - input->line, expand_tabs);
input->item++;
}
/*---------------------------------.
| Skip over white space on INPUT. |
`---------------------------------*/
static void
skip_whitespace (struct input *input)
{
assert (input->cursor);
while (input->cursor && isspace (*input->cursor))
input_character (input);
/* FIXME: Maybe worth following columns for TAB expansion, maybe not? */
}
/*-----------------------------------------------------------------.
| Copy white space from INPUT to FILE, ensuring a kind of MARGIN. |
`-----------------------------------------------------------------*/
static void
copy_whitespace (struct input *input, enum margin_mode margin)
{
char *string = input->cursor;
assert (input->cursor);
while (input->cursor && isspace (*input->cursor))
if (++input->cursor == input->limit)
{
if (input->cursor[-1] == '\n')
{
output_characters (string, input->cursor - string - 1,
expand_tabs);
/* While changing lines, ensure we stop any special display
prior to, and restore the special display after. */
if (avoid_wraps && input->user_stop)
fprintf (output_file, "%s", input->user_stop);
#if HAVE_TPUTS
if (input->term_stop)
tputs (input->term_stop, 0, putc_for_tputs);
#endif
output_characters (input->cursor - 1, 1, expand_tabs);
make_margin (input, margin);
#if HAVE_TPUTS
if (input->term_start)
tputs (input->term_start, 0, putc_for_tputs);
#endif
if (avoid_wraps && input->user_start)
fprintf (output_file, "%s", input->user_start);
}
else
output_characters (string, input->cursor - string, expand_tabs);
input_character_helper (input);
string = input->cursor;
}
if (string && input->cursor > string)
output_characters (string, input->cursor - string, expand_tabs);
}
/*-------------------------------------.
| Skip over non-white space on INPUT. |
`-------------------------------------*/
static void
skip_word_item (struct input *input)
{
assert (input->cursor && !isspace (*input->cursor));
while (input->cursor && !isspace (*input->cursor))
input_character (input);
/* FIXME: Maybe worth following columns for TAB expansion, maybe not? */
input->item++;
}
/*------------------------------------------.
| Copy non white space from INPUT to FILE. |
`------------------------------------------*/
static void
copy_word_item (struct input *input)
{
char *string = input->cursor;
assert (input->cursor && !isspace (*input->cursor));
while (input->cursor && !isspace (*input->cursor))
input->cursor++;
output_characters (string, input->cursor - string, expand_tabs);
if (input->cursor == input->limit)
input_character_helper (input);
input->item++;
}
/*------------------------------------------.
| Skip a difference from INPUT up to ITEM. |
`------------------------------------------*/
static void
skip_until (struct input *input, int item)
{
assert (input->item <= item);
if (word_mode)
while (input->item < item)
{
skip_whitespace (input);
skip_word_item (input);
}
else
while (input->item < item)
skip_line_item (input);
}
/*------------------------------------------------------------------.
| Copy a difference from INPUT up to ITEM, using a kind of MARGIN. |
`------------------------------------------------------------------*/
static void
copy_until (struct input *input, int item, enum margin_mode margin)
{
assert (input->item <= item);
if (word_mode)
while (input->item < item)
{
copy_whitespace (input, margin);
copy_word_item (input);
}
else
while (input->item < item)
copy_line_item (input, margin);
}
/*------------------------------------.
| From INPUT, skip a cluster MEMBER. |
`------------------------------------*/
static void
skip_member_proper (struct input *input, struct member *member)
{
assert (input->item == member->first_item);
skip_until (input, member->first_item + real_member_size (member));
}
/*------------------------------------.
| From INPUT, copy a cluster MEMBER. |
`------------------------------------*/
static void
copy_member_proper (struct input *input, struct member *member)
{
assert (input->item == member->first_item);
copy_until (input, member->first_item + real_member_size (member),
FILLER_IN_MARGIN);
}
/* Listing control. */
/*------------------------------------------.
| Relist all input files with annotations. |
`------------------------------------------*/
static void
relist_annotated_files (void)
{
/* The array of actives holds all members being concurrently listed. If
there is no overlapping members, the array will never hold more than
one member. The index in this array is also the column position of the
vertical line bracing the member, in the annotated listing. For
preserving verticality of lines after the termination of some members,
NULL members in the array stand for embedded white columns. */
struct active
{
struct member *member; /* active member, or NULL */
int remaining; /* count of remaining lines to list */
};
struct active *active_array = NULL;
int actives = 0;
int allocated_actives = 0;
int other_count = 0; /* how many actives in other files */
enum margin_mode margin_mode =
show_links ? LOCATION_IN_MARGIN : EMPTY_MARGIN;
struct input *input = NULL;
int *cursor;
int counter;
FILE *file;
ITEM *item;
struct active *active;
struct member *member;
struct cluster *cluster;
int ordinal;
struct reference reference;
char buffer[20];
#if DEBUGGING
if (debugging)
fputs ("\f\n", stderr);
#endif
/* Prepare terminal. */
if (!paginate)
{
launch_output_program (input);
initialize_strings ();
}
/* Prepare to scan all members. */
if (indirects > 0)
{
cursor = indirect_array;
member = member_array + *cursor;
}
else
cursor = NULL;
/* Process all files. */
for (input = input_array; input < input_array + inputs; input++)
{
/* Prepare terminal. */
if (paginate)
{
launch_output_program (input);
if (input == input_array)
initialize_strings ();
}
else
{
if (input > input_array)
fputs ("\f\n", output_file);
fprintf (output_file, "@@@ %s\n", input->file_name);
}
/* Prepare for file. */
open_input (input);
input->item = input->first_item;
/* Process all items. */
if (word_mode && input->item < input->item_limit)
{
make_margin (input, margin_mode);
input_line (input);
}
while (input->item < input->item_limit)
{
if (word_mode)
copy_whitespace (input, margin_mode);
item = item_array + input->item;
/* See if we are starting any member. */
while (cursor && member->first_item == input->item)
{
cluster = cluster_array + member->cluster_number;
ordinal = member - member_array - cluster->first_member - 1;
/* Obtain some active slot for the new member. */
if (actives)
{
/* Set ACTIVE to the rightmost not-in-use active, or after
all actives if they are all in use. */
active = active_array + actives;
for (counter = 0; counter < actives; counter++)
if (!active_array[counter].member)
active = active_array + counter;
/* Output vertical bars as needed for all prior actives. */
if (!word_mode)
for (counter = 0;
active_array + counter < active; counter++)
if (active_array[counter].member)
putc ('|', output_file);
else
putc (' ', output_file);
/* Ensure active will be allocated if necessary. */
if (active == active_array + actives)
active = NULL;
}
else
active = NULL;
/* Allocate and initialise the active. */
if (!active)
{
if (actives == allocated_actives)
{
allocated_actives += 8;
active_array = (struct active *)
xrealloc (active_array,
allocated_actives *
(sizeof (struct active)));
}
active = active_array + actives++;
}
active->member = member;
active->remaining
= cluster_array[member->cluster_number].item_count;
/* Print a pointer to the previous member of same cluster. */
if (ordinal >= 0)
{
reference = get_reference
(member_array
[cluster->first_member + ordinal].first_item);
if (word_mode)
{
if (show_links)
{
sprintf (buffer, "[%c%s%d",
(char) (active - active_array + 'A'),
reference.input->nick_name,
reference.number);
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
putc (' ', output_file);
}
}
else
{
fprintf (output_file, ".-> [%d/%d] ",
ordinal + 1, MEMBERS (cluster));
sprintf (buffer, "%s%d",
reference.input->nick_name, reference.number);
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
if (reference.input != input)
fprintf (output_file, " (%s)",
reference.input->file_name);
putc ('\n', output_file);
}
}
else if (word_mode)
{
if (show_links)
{
sprintf (buffer, "[%c",
(char) (active - active_array + 'A'));
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
putc (' ', output_file);
}
}
else
fputs (".-\n", output_file);
/* Bold text appearing in other files. */
if (active_elsewhere (member, input))
if (other_count++ == 0)
set_emphasis (BOLD);
/* Advance cursor. */
if (++cursor < indirect_array + indirects)
member = member_array + *cursor;
else
cursor = NULL;
}
/* List the item itself. */
if (word_mode)
copy_word_item (input);
else
{
for (counter = 0; counter < actives; counter++)
if (active_array[counter].member)
putc ('|', output_file);
else
putc (' ', output_file);
if (counter < 7)
{
sprintf (buffer, "%s%d", input->nick_name,
input->item - input->first_item + 1);
for (counter += strlen (buffer); counter < 7; counter++)
putc (' ', output_file);
push_emphasis (UNDERLINED);
output_characters (buffer + counter - 7,
strlen (buffer + counter - 7), 0);
pop_emphasis ();
}
if (initial_tab)
putc ('\t', output_file);
else
putc (' ', output_file);
copy_line_item (input, EMPTY_MARGIN);
}
/* See if we are ending any member. */
if (!actives)
continue;
active = active_array + actives;
while (--active >= active_array)
if (item_type (item) == NORMAL && --active->remaining == 0)
{
cluster = cluster_array + active->member->cluster_number;
ordinal
= active->member - member_array - cluster->first_member + 1;
/* Print a pointer to the next member of same cluster. */
if (!word_mode)
{
for (counter = 0;
active_array + counter < active; counter++)
if (active_array[counter].member)
putc ('|', output_file);
else
putc (' ', output_file);
}
if (ordinal < MEMBERS (cluster))
{
reference = get_reference
(member_array
[cluster->first_member + ordinal].first_item);
if (word_mode)
{
if (show_links)
{
putc (' ', output_file);
sprintf (buffer, "%s%d%c]",
reference.input->nick_name,
reference.number,
(char) (active - active_array + 'A'));
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
}
}
else
{
fprintf (output_file, "`-> [%d/%d] ",
ordinal + 1, MEMBERS (cluster));
sprintf (buffer, "%s%d",
reference.input->nick_name,
reference.number);
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
if (reference.input != input)
fprintf (output_file, " (%s)",
reference.input->file_name);
putc ('\n', output_file);
}
}
else if (word_mode)
{
if (show_links)
{
putc (' ', output_file);
sprintf (buffer, "%c]",
(char) (active - active_array + 'A'));
push_emphasis (UNDERLINED);
output_characters (buffer, strlen (buffer), 0);
pop_emphasis ();
}
}
else
fputs ("`-\n", output_file);
/* Do not bold text not appearing in any other file. */
if (active_elsewhere (active->member, input))
if (--other_count == 0)
set_emphasis (STRAIGHT);
/* Remove as many active members as we can. */
active->member = NULL;
if (active == active_array + actives - 1)
while (actives > 0 && !active_array[actives - 1].member)
actives--;
}
}
/* Finish file. */
assert (actives == 0);
assert (other_count == 0);
close_input (input);
if (paginate)
complete_output_program ();
}
if (!paginate)
complete_output_program ();
}
/*--------------------------------------------------------------------.
| Make a merged listing of input files. If UNIFIED, produce unified |
| context diffs instead of plain context diffs. If CROSSED, identify |
| crossed blocks. |
`--------------------------------------------------------------------*/
static void
relist_merged_lines (int unified, int crossed)
{
int counter;
struct input *input;
struct member *member;
struct cluster *chosen_cluster;
struct reference reference;
struct merging *merging;
struct merging *group_limit;
struct merging *cursor;
int listed;
/* Prepare terminal. */
launch_output_program (NULL);
initialize_strings ();
/* FIXME: Merging requires all input files to be opened in parallel. This
is not realistic when there are really many input files: in such cases,
one has no other choice than to avoid merged listings and resort to the
full relisting option instead. */
for (input = input_array; input < input_array + inputs; input++)
{
open_input (input);
input->item = input->first_item;
}
/* Process all merging groups, one at a time. */
#if DEBUGGING
if (debugging)
fputs ("\f\n", stderr);
#endif
for (merging = merging_array;
merging < merging_array + mergings; merging = group_limit)
{
/* Find the extent of the merging group, and count genuine mergings. */
counter = 0;
if (!merging->cross_flag)
counter++;
for (cursor = merging + 1;
cursor < merging_array + mergings && !cursor->group_flag; cursor++)
if (!cursor->cross_flag)
counter++;
group_limit = cursor;
/* Prepare for a new hunk. Hmph! Not really yet... */
/* Output differences, which are items before members. Also consider
any crossed member as a difference and output it on the same blow. */
for (cursor = merging; cursor < group_limit; cursor++)
{
input = input_array + cursor->input_number;
member = member_array + cursor->member_number;
copy_until (input, member->first_item, FILE_IN_MARGIN);
if (cursor->cross_flag)
{
explain_group ('/', cursor, cursor + 1);
copy_member_proper (input, member);
explain_group ('\\', cursor, cursor + 1);
}
}
/* Describe members, which we are about to skip. */
explain_group ('/', merging, group_limit);
listed = 0;
for (cursor = merging; cursor < group_limit; cursor++)
if (!cursor->cross_flag)
{
input = input_array + cursor->input_number;
member = member_array + cursor->member_number;
if (listed)
skip_member_proper (input, member);
else
{
copy_member_proper (input, member);
listed = 1;
}
}
explain_group ('\\', merging, group_limit);
}
/* Copy remaining differences and clean up. */
for (input = input_array; input < input_array + inputs; input++)
{
copy_until (input, input->item_limit, FILE_IN_MARGIN);
close_input (input);
}
}
/*-----------------------------------------------------.
| Study diff output and use it to drive reformatting. |
`-----------------------------------------------------*/
/* Define the separator lines when output is inhibited. */
#define SEPARATOR_LINE \
"======================================================================"
static void
relist_merged_words (void)
{
int counter;
struct input *input;
struct member *member;
struct cluster *chosen_cluster;
struct reference reference;
struct merging *merging;
struct merging *group_limit;
struct merging *cursor;
int listed;
int count_total_left; /* count of total words in left file */
int count_total_right; /* count of total words in right file */
int count_isolated_left; /* count of deleted words in left file */
int count_isolated_right; /* count of added words in right file */
int count_changed_left; /* count of changed words in left file */
int count_changed_right; /* count of changed words in right file */
/* Prepare terminal. */
launch_output_program (NULL);
initialize_strings ();
/* Rewind input files. */
for (input = input_array; input < input_array + inputs; input++)
{
open_input (input);
input->item = input->first_item;
input_line (input);
}
count_total_left = left->item_limit - left->first_item;
count_total_right = right->item_limit - right->first_item;
count_isolated_left = 0;
count_isolated_right = 0;
count_changed_left = 0;
count_changed_right = 0;
/* Process all merging groups, one at a time. */
for (merging = merging_array;
merging < merging_array + mergings; merging = group_limit)
{
/* Find the extent of the merging group, and count genuine mergings. */
counter = 0;
if (!merging->cross_flag)
counter++;
for (cursor = merging + 1;
cursor < merging_array + mergings && !cursor->group_flag; cursor++)
if (!cursor->cross_flag)
counter++;
group_limit = cursor;
/* Output differences, which are items before members. Also consider
any crossed member as a difference and output it on the same blow. */
for (cursor = merging; cursor < group_limit; cursor++)
{
input = input_array + cursor->input_number;
member = member_array + cursor->member_number;
if (input->listing_allowed)
{
if (input->item < member->first_item || cursor->cross_flag)
{
if (input == left)
copy_whitespace (input, EMPTY_MARGIN);
else
skip_whitespace (input);
if (input == input_array + inputs - 1)
start_of_emphasis (input, BOLD);
else
start_of_emphasis (input, UNDERLINED);
if (input->item < member->first_item)
{
copy_word_item (input);
copy_until (input, member->first_item, FILE_IN_MARGIN);
}
if (cursor->cross_flag)
copy_member_proper (input, member);
end_of_emphasis (input);
}
}
else
{
skip_until (input, member->first_item);
if (cursor->cross_flag)
skip_member_proper (input, member);
}
}
/* Use separator lines to disambiguate the output. */
if (common_listing_allowed)
{
if (!left->listing_allowed && !right->listing_allowed)
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
}
else
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
/* Describe members, which we are about to skip. */
listed = 0;
for (cursor = merging; cursor < group_limit; cursor++)
if (!cursor->cross_flag)
{
input = input_array + cursor->input_number;
member = member_array + cursor->member_number;
if (listed)
skip_member_proper (input, member);
else
{
copy_member_proper (input, member);
listed = 1;
}
}
}
/* Copy remaining differences and clean up. Copy from left side if the
user wanted to see only the common code and deleted words. */
if (!common_listing_allowed
&& (left->listing_allowed || right->listing_allowed))
fprintf (output_file, "\n%s\n", SEPARATOR_LINE);
for (input = input_array; input < input_array + inputs; input++)
{
if (input->listing_allowed)
{
if (input->item < input->item_limit)
{
if (input == left)
copy_whitespace (input, EMPTY_MARGIN);
else
skip_whitespace (input);
if (input == input_array + inputs - 1)
start_of_emphasis (input, BOLD);
else
start_of_emphasis (input, UNDERLINED);
copy_word_item (input);
copy_until (input, input->item_limit, FILE_IN_MARGIN);
end_of_emphasis (input);
}
copy_whitespace (input, EMPTY_MARGIN);
}
close_input (input);
}
/* Print merging statistics. */
if (verbose)
{
int count_common_left; /* words unchanged in left file */
int count_common_right; /* words unchanged in right file */
count_common_left
= count_total_left - count_isolated_left - count_changed_left;
count_common_right
= count_total_right - count_isolated_right - count_changed_right;
printf (ngettext ("%s: %d word", "%s: %d words", count_total_left),
left->file_name, count_total_left);
if (count_total_left > 0)
{
printf (ngettext (" %d %.0f%% common", " %d %.0f%% common",
count_common_left), count_common_left,
count_common_left * 100. / count_total_left);
printf (ngettext (" %d %.0f%% deleted", " %d %.0f%% deleted",
count_isolated_left), count_isolated_left,
count_isolated_left * 100. / count_total_left);
printf (ngettext (" %d %.0f%% changed", " %d %.0f%% changed",
count_changed_left), count_changed_left,
count_changed_left * 100. / count_total_left);
}
printf ("\n");
printf (ngettext ("%s: %d word", "%s: %d words", count_total_right),
right->file_name, count_total_right);
if (count_total_right > 0)
{
printf (ngettext (" %d %.0f%% common", " %d %.0f%% common",
count_common_right), count_common_right,
count_common_right * 100. / count_total_right);
printf (ngettext (" %d %.0f%% inserted", " %d %.0f%% inserted",
count_isolated_right), count_isolated_right,
count_isolated_right * 100. / count_total_right);
printf (ngettext (" %d %.0f%% changed", " %d %.0f%% changed",
count_changed_right), count_changed_right,
count_changed_right * 100. / count_total_right);
}
printf ("\n");
}
/* Set exit status. */
if (count_isolated_left || count_isolated_right
|| count_changed_left || count_changed_right)
exit_status = EXIT_DIFFERENCE;
/* Reset the terminal. */
complete_output_program ();
}
/* Main control. */
/*-----------------------------------------------.
| Explain how to use the program, then get out. |
`-----------------------------------------------*/
static void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
/* *INDENT-OFF* */
fputs (_("\
mdiff - Studies multiple files and searches for similar sequences, it then\n\
produces possibly detailed lists of differences and similarities.\n"),
stdout);
fputs ("\n", stdout);
printf (_("\
Usage: %s [OPTION]... [FILE]...\n"),
program_name);
fputs (_("\nOperation modes:\n"), stdout);
fputs (_(" -h (ignored)\n"), stdout);
fputs (_(" -v, --verbose report a few statistics on stderr\n"), stdout);
fputs (_(" --help display this help then exit\n"), stdout);
fputs (_(" --version display program version then exit\n"), stdout);
fputs (_("\nFormatting output:\n"), stdout);
fputs (_(" -T, --initial-tab produce TAB instead of initial space\n"), stdout);
fputs (_(" -l, --paginate paginate output through `pr'\n"), stdout);
fputs (_(" -S, --string[=STRING] take note of another user STRING\n"), stdout);
fputs (_(" -V, --show-links give file and line references in annotations\n"), stdout);
fputs (_(" -t, --expand-tabs expand tabs to spaces in the output\n"), stdout);
#if DEBUGGING
fputs (_("\nDebugging:\n"), stdout);
fputs (_(" -0, --debugging output many details about what is going on\n"), stdout);
#endif
fputs (_("\nWord mode options:\n"), stdout);
fputs (_(" -1, --no-deleted inhibit output of deleted words\n"), stdout);
fputs (_(" -2, --no-inserted inhibit output of inserted words\n"), stdout);
fputs (_(" -3, --no-common inhibit output of common words\n"), stdout);
fputs (_(" -A, --auto-pager automatically calls a pager\n"), stdout);
fputs (_(" -k, --less-mode variation of printer mode for \"less\"\n"), stdout);
fputs (_(" -m, --avoid-wraps do not extend fields through newlines\n"), stdout);
fputs (_(" -o, --printer overstrike as for printers\n"), stdout);
fputs (_(" -z, --terminal use termcap as for terminal displays\n"), stdout);
fputs (_(" -O, --item-regexp=REGEXP compare items as defined by REGEXP\n"), stdout);
fputs (_(" -W, --word-mode compare words instead of lines\n"), stdout);
/***
fputs (_("\nComparing files:\n"), stdout);
fputs (_("* -H, --speed-large-files go faster, for when numerous small changes\n"), stdout);
fputs (_("* -a, --text report line differences (text file default)\n"), stdout);
fputs (_("* -d, --minimal try harder for a smaller set of changes\n"), stdout);
fputs (_("* -q, --brief only says if files differ (binary default)\n"), stdout);
fputs (_("* --horizon-lines=LINES keep LINES lines in common prefixes/suffixes\n"), stdout);
***/
/***
fputs (_("\nComparing directories:\n"), stdout);
fputs (_("* -N, --new-file consider missing files to be empty\n"), stdout);
fputs (_("* -P, --unidirectional-new-file consider missing old files to be empty\n"), stdout);
fputs (_("* -S, --starting-file=FILE resume directory comparison with FILE\n"), stdout);
fputs (_("* -X, --exclude-from=FILE ignore files matching patterns from FILE\n"), stdout);
fputs (_("* -r, --recursive recursively compare subdirectories\n"), stdout);
fputs (_("* -s, --report-identical-files report when two files are the same\n"), stdout);
fputs (_("* -x, --exclude=PATTERN ignore files (dirs) matching PATTERN\n"), stdout);
***/
/***
fputs (_("\nIgnoring text:\n"), stdout);
fputs (_(" -B, --ignore-blank-lines ignore blank lines\n"), stdout);
fputs (_("* -I, --ignore-matching-lines=REGEXP ignore lines matching REGEXP\n"), stdout);
fputs (_(" -b, --ignore-space-change ignore amount of white space\n"), stdout);
fputs (_(" -i, --ignore-case ignore case differences\n"), stdout);
fputs (_(" -w, --ignore-all-space ignore white space\n"), stdout);
fputs (_("\nClustering:\n"), stdout);
fputs (_(" -G, --relist-files list all input files with annotations\n"), stdout);
fputs (_(" -J, --minimum-size=ITEMS ignore clusters not having that many ITEMS\n"), stdout);
fputs (_(" -j, --ignore-delimiters do not count items having only delimiters\n"), stdout);
***/
/***
fputs (_("\nDetailed output formats:\n"), stdout);
fputs (_("* -D, --ifdef=NAME output `#ifdef NAME' format\n"), stdout);
fputs (_("* --changed-group-format=FORMAT use FORMAT for changed lines\n"), stdout);
fputs (_("* --new-group-format=FORMAT use FORMAT for inserted lines\n"), stdout);
fputs (_("* --new-line-format=FORMAT use FORMAT for inserted line\n"), stdout);
fputs (_("* --old-group-format=FORMAT use FORMAT for deleted lines\n"), stdout);
fputs (_("* --old-line-format=FORMAT use FORMAT for deleted line\n"), stdout);
fputs (_("* --unchanged-group-format=FORMAT use FORMAT for unchanged lines\n"), stdout);
fputs (_("* --unchanged-line-format=FORMAT use FORMAT for unchanged line\n"), stdout);
fputs (_("* --line-format=FORMAT --{old,new,unchanged}-line-format\n"), stdout);
***/
/***
fputs (_("\nScript-like formats:\n"), stdout);
fputs (_(" (none of -CDUcefnuy) output normal diffs\n"), stdout);
fputs (_("* -e, --ed output a valid `ed' script\n"), stdout);
fputs (_("* -f, --forward-ed mix between -e and -n (not very useful)\n"), stdout);
fputs (_("* -n, --rcs output RCS format (internally used by RCS)\n"), stdout);
***/
/***
fputs (_("\nContext and unified formats:\n"), stdout);
fputs (_("* -F, --show-function-line=REGEXP show previous context matching REGEXP\n"), stdout);
fputs (_("* -p, --show-c-function show which C function for each change\n"), stdout);
***/
/***
fputs (_("* -C, --context=LINES as -c, also select context size in lines\n"), stdout);
fputs (_("* -L, --label=LABEL use from/to LABEL instead of file name (twice)\n"), stdout);
fputs (_("* -U, --unified=LINES as -u, also select context size in lines\n"), stdout);
fputs (_("* -c, --context output context diffs (default 3 context lines)\n"), stdout);
fputs (_("* -u, --unified output unidiffs (default 3 context lines)\n"), stdout);
fputs (_("* -LINES (obsolete: select context size in lines)\n"), stdout);
***/
/***
fputs (_("\nSide by side format:\n"), stdout);
fputs (_("* -W, --width=COLUMNS use width of COLUMNS\n"), stdout);
fputs (_("* -y, --side-by-side use side by side output format\n"), stdout);
fputs (_("* --left-column print only left column line when common\n"), stdout);
fputs (_("* --sdiff-merge-assist (internally used by `sdiff')\n"), stdout);
fputs (_("* --suppress-common-lines do not print common lines\n"), stdout);
***/
/***
fputs (_("\n\
FORMAT is made up of characters standing for themselves, except:\n\
%%%% a single %%\n\
%%c'C' quoted character C\n\
%%c'\\O' character having value O, from 1 to 3 octal digits\n\
%%(A=B?T:E) if A is B then T else E; A B number or VARIABLE; T E FORMAT\n\
%%FN use SPECIF specification F to print VARIABLE value N\n\
%%< [group] old, each line through --old-line-format\n\
%%> [group] new, each line through --new-line-format\n\
%%= [group] unchanged, each line through --unchanged-line-format\n\
%%l [line] without its possible trailing newline\n\
%%L [line] with its possible trailing newline\n"),
stdout);
***/
/***
fputs (_("\n\
SPECIF is [-][W[.D]]{doxX} as in C printf\n"),
stdout);
***/
/***
fputs (_("\n\
VARIABLE is {eflmn} for old group or {EFLMN} for new group\n\
{eE} line number just before group\n\
{fF} first line number of group\n\
{lL} last line number of group\n\
{mM} line number just after group\n\
{nN} number of lines in the group\n"),
stdout);
***/
/***
fputs (_("\nStandard diff options:\n"), stdout);
fputs (_(" -i, --ignore-case consider upper- and lower-case to be the same\n"), stdout);
fputs (_(" -w, --ignore-all-space ignore all white space\n"), stdout);
fputs (_(" -b, --ignore-space-change ignore changes in the amount of white space\n"), stdout);
fputs (_(" -B, --ignore-blank-lines ignore changes whose lines are all blank\n"), stdout);
fputs (_(" -I, --ignore-matching-lines=RE ignore changes whose lines all match RE\n"), stdout);
fputs (_(" -a, --text treat all files as text\n"), stdout);
fputs (_("\
-c, --context[=NUMBER] output regular context diffs,\n\
changing to NUMBER lines of context\n"), stdout);
fputs (_("\
-u, --unified[=NUMBER] output unified context diffs or unidiffs,\n\
with NUMBER lines of context\n"), stdout);
fputs (_(" -C, --context=NUM output NUM lines of copied context\n"), stdout);
fputs (_(" -U, --unified=NUM output NUM lines of unified context\n"), stdout);
fputs (_(" -L, --label=LABEL use LABEL instead of file name\n"), stdout);
fputs (_(" -p, --show-c-function show which C function each change is in\n"), stdout);
fputs (_(" -F, --show-function-line=RE show the most recent line matching RE\n"), stdout);
fputs (_(" -q, --brief output only whether files differ\n"), stdout);
fputs (_(" -e, --ed output an ed script\n"), stdout);
fputs (_(" -n, --rcs output an RCS format diff\n"), stdout);
fputs (_(" -y, --side-by-side output in two columns\n"), stdout);
fputs (_(" -w, --width=NUM output at most NUM (default 130) characters per line\n"), stdout);
fputs (_(" --left-column output only the left column of common lines\n"), stdout);
fputs (_(" --suppress-common-lines do not output common lines\n"), stdout);
fputs (_(" -D, --ifdef=NAME output merged file to show `#ifdef NAME' diffs\n"), stdout);
fputs (_(" --GTYPE-group-format=GFMT GTYPE input groups with GFMT\n"), stdout);
fputs (_(" --line-format=LFMT all input lines with LFMT\n"), stdout);
fputs (_(" --LTYPE-line-format=LFMT LTYPE input lines with LFMT\n"), stdout);
fputs (_(" -l, --paginate pass the output through `pr' to paginate it\n"), stdout);
fputs (_(" -t, --expand-tabs expand tabs to spaces in output\n"), stdout);
fputs (_(" -T, --initial-tab make tabs line up by prepending a tab\n"), stdout);
fputs (_(" -r, --recursive recursively compare any subdirectories found\n"), stdout);
fputs (_(" -N, --new-file treat absent files as empty\n"), stdout);
fputs (_(" -P, --unidirectional-new-file treat absent first files as empty\n"), stdout);
fputs (_(" -s, --report-identical-files report when two files are the same\n"), stdout);
fputs (_(" -x, --exclude=PAT exclude files that match PAT\n"), stdout);
fputs (_(" -X, --exclude-from=FILE exclude files that match any pattern in FILE\n"), stdout);
fputs (_(" -S, --starting-file=FILE start with FILE when comparing directories\n"), stdout);
fputs (_(" --horizon-lines=NUM keep NUM lines of the common prefix and suffix\n"), stdout);
fputs (_(" -d, --minimal try hard to find a smaller set of changes\n"), stdout);
fputs (_(" -H, --speed-large-files assume large files and many scattered small changes\n"), stdout);
***/
/***
fputs (_("\
\n\
By default, context diffs have an horizon of two lines.\n"),
stdout);
***/
/***
fputs (_("\
\n\
LTYPE is `old', `new', or `unchanged'. GTYPE is LTYPE or `changed'.\n\
GFMT may contain:\n\
%< lines from FILE1\n\
%> lines from FILE2\n\
%= lines common to FILE1 and FILE2\n\
%[-][WIDTH][.[PREC]]{doxX}LETTER printf-style spec for LETTER\n\
LETTERs are as follows for new group, lower case for old group:\n\
F first line number\n\
L last line number\n\
N number of lines = L-F+1\n\
E F-1\n\
M L+1\n"),
stdout);
fputs (_("\
LFMT may contain:\n\
%L contents of line\n\
%l contents of line, excluding any trailing newline\n\
%[-][WIDTH][.[PREC]]{doxX}n printf-style spec for input line number\n\
Either GFMT or LFMT may contain:\n\
%% %\n\
%c'C' the single character C\n\
%c'\\OOO' the character with octal code OOO\n"),
stdout);
***/
/***
fputs (_("\nOld mdiff options:\n"), stdout);
fputs (_("* -f, --fuzz-items=ITEMS no more than ITEMS non matching in a cluster\n"), stdout);
***/
fputs ("\n", stdout);
fputs (_("With no FILE, or when FILE is -, read standard input.\n"), stdout);
fputs ("\n", stdout);
fputs (_("Report bugs to .\n"), stdout);
/* *INDENT-ON* */
}
exit (status);
}
/*----------------------------------------------------------------------.
| Main program. Decode ARGC arguments passed through the ARGV array of |
| strings, then launch execution. |
`----------------------------------------------------------------------*/
#define UNIMPLEMENTED(Option) \
error (0, 0, _("ignoring option %s (not implemented)"), (Option))
int
main (int argc, char *const *argv)
{
int option_char; /* option character */
struct input *input; /* cursor in input array */
int inhibit_left = 0;
int inhibit_right = 0;
int inhibit_common = 0;
const char *delete_start = NULL;
const char *delete_stop = NULL;
const char *insert_start = NULL;
const char *insert_stop = NULL;
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Decode command options. */
while (option_char = getopt_long (argc, (char **) argv, OPTION_STRING,
long_options, NULL), option_char != EOF)
switch (option_char)
{
default:
usage (EXIT_ERROR);
case '\0':
break;
case '0':
#if DEBUGGING
debugging = 1;
verbose = 1;
#else
UNIMPLEMENTED ("--debugging");
#endif
break;
case '1':
inhibit_left = 1;
break;
case '2':
inhibit_right = 1;
break;
case '3':
inhibit_common = 1;
break;
case 'A':
autopager = 1;
break;
case 'B':
ignore_blank_lines = 1;
break;
case 'D':
ifdef = optarg;
UNIMPLEMENTED ("--ifdef");
break;
case 'F':
show_function_line = optarg;
UNIMPLEMENTED ("--show-function-line");
break;
case 'G':
relist_files = 1;
break;
case 'H':
speed_large_files = 1;
UNIMPLEMENTED ("--speed-large-files");
break;
case 'I':
if (ignore_regexps % 8 == 0)
ignore_regexp_array = (struct re_pattern_buffer **)
xrealloc (ignore_regexp_array,
((ignore_regexps + 8)
* sizeof (struct re_pattern_buffer *)));
ignore_regexp_array[ignore_regexps++]
= alloc_and_compile_regex (optarg);
break;
case 'J':
minimum_size = atoi (optarg);
break;
case 'L':
label = optarg;
UNIMPLEMENTED ("--label");
break;
case 'N':
new_file = 1;
UNIMPLEMENTED ("--new-file");
break;
case 'O':
UNIMPLEMENTED ("--compare-words");
item_regexp = alloc_and_compile_regex (optarg);
break;
case 'P':
unidirectional_new_file = 1;
UNIMPLEMENTED ("--unidirectional-new-file");
break;
case 'Q':
insert_start = optarg;
break;
case 'R':
insert_stop = optarg;
break;
case 'S':
starting_file = optarg;
UNIMPLEMENTED ("--starting-file");
break;
case 'T':
initial_tab = 1;
break;
case 'V':
show_links = 1;
break;
case 'W':
word_mode = 1;
break;
case 'X':
exclude_from = optarg;
UNIMPLEMENTED ("--exclude-from");
break;
case 'Y':
delete_start = optarg;
break;
case 'Z':
delete_stop = optarg;
break;
case 'a':
text = 1;
UNIMPLEMENTED ("--text");
break;
case 'b':
ignore_space_change = 1;
ignore_blank_lines = 1;
break;
case 'C':
case 'c':
UNIMPLEMENTED ("--context");
if (optarg)
horizon_lines = atoi (optarg);
context = 1;
break;
case 'd':
minimal = 1;
UNIMPLEMENTED ("--minimal");
break;
case 'e':
ed = 1;
UNIMPLEMENTED ("--ed");
break;
#if FIXME
case 'h':
UNIMPLEMENTED ("-h");
break;
#endif
case 'i':
ignore_case = 1;
break;
case 'j':
ignore_delimiters = 1;
break;
case 'k':
if (find_termcap < 0)
find_termcap = 0;
overstrike = 1;
overstrike_for_less = 1;
break;
case 'l':
paginate = 1;
break;
case 'm':
avoid_wraps = 1;
break;
case 'n':
rcs = 1;
UNIMPLEMENTED ("--rcs");
break;
case 'o':
overstrike = 1;
break;
case 'p':
show_c_function = 1;
UNIMPLEMENTED ("--show-c-function");
break;
case 'q':
brief = 1;
UNIMPLEMENTED ("--brief");
break;
case 'r':
recursive = 1;
UNIMPLEMENTED ("--recursive");
break;
#if FIXME
case 's':
report_identical_files = 1;
UNIMPLEMENTED ("--report-identical-files");
break;
#endif
case 't': /* mdiff draft */
UNIMPLEMENTED ("--tolerance");
tolerance = atoi (optarg);
break;
#if FIXME
case 't':
expand_tabs = 1;
UNIMPLEMENTED ("--expand-tabs");
break;
#endif
case 'U':
case 'u':
UNIMPLEMENTED ("--unified");
if (optarg)
horizon_lines = atoi (optarg);
unified = 1;
break;
case 'v':
verbose = 1;
break;
case 'w':
ignore_all_space = 1;
break;
#if FIXME
case 'w':
width = atoi (optarg);
UNIMPLEMENTED ("--width");
break;
#endif
case 'x':
exclude = optarg;
UNIMPLEMENTED ("--exclude");
break;
case 'y':
side_by_side = 1;
UNIMPLEMENTED ("--side-by-side");
break;
case 'K':
/* compatibility option, equal to -t now */
/* fall through */
case 'z':
#if HAVE_TPUTS
if (find_termcap < 0)
find_termcap = 1;
break;
#else
error (EXIT_ERROR, 0, _("cannot use -z, termcap not available"));
#endif
case GTYPE_GROUP_FORMAT_OPTION:
gtype_group_format = optarg;
UNIMPLEMENTED ("--gtype-group-format");
break;
case HORIZON_LINES_OPTION:
horizon_lines = atoi (optarg);
UNIMPLEMENTED ("--horizon-lines");
break;
case LEFT_COLUMN_OPTION:
left_column = 1;
UNIMPLEMENTED ("--left-column");
break;
case LINE_FORMAT_OPTION:
line_format = optarg;
UNIMPLEMENTED ("--line-format");
break;
case LTYPE_LINE_FORMAT_OPTION:
ltype_line_format = optarg;
UNIMPLEMENTED ("--ltype-line-format");
break;
case SUPPRESS_COMMON_LINES_OPTION:
suppress_common_lines = 1;
UNIMPLEMENTED ("--suppress-common-lines");
break;
}
if (minimum_size < 0)
minimum_size = relist_files ? (word_mode ? 10 : 5) : 1;
if (!relist_files && word_mode && argc - optind != 2)
{
error (0, 0, _("word merging for two files only (so far)"));
usage (EXIT_ERROR);
}
/* If find_termcap still undecided, make it true only if autopager is
set while stdout is directed to a terminal. This decision might be
reversed later, if the pager happens to be "less". */
if (find_termcap < 0)
find_termcap = autopager && isatty (fileno (stdout));
/* Process trivial options. */
if (show_version)
{
printf ("mdiff (GNU %s) %s\n", PACKAGE, VERSION);
fputs (_("\
\n\
Copyright (C) 1992, 1997, 1998, 1999, 2010 Free Software Foundation, Inc.\n"), stdout);
fputs (_("\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), stdout);
fputs (_("\
\n\
Written by Franc,ois Pinard .\n"), stdout);
exit (EXIT_SUCCESS);
}
if (show_help)
usage (EXIT_SUCCESS);
/* Register all input files. */
if (optind == argc)
new_input ("-");
else
while (optind < argc)
new_input (argv[optind++]);
/* Save some option values. */
if (inputs == 2)
{
left->listing_allowed = !inhibit_left;
left->user_start = delete_start;
left->user_stop = delete_stop;
right->listing_allowed = !inhibit_right;
right->user_start = insert_start;
right->user_stop = insert_stop;
common_listing_allowed = !inhibit_common;
}
else
{
if (inhibit_left || inhibit_right || inhibit_common
|| delete_start || delete_stop || insert_start || insert_stop)
error (0, 0, _("options -123RSYZ meaningful only when two inputs"));
}
/* Do all the crunching. */
study_all_inputs ();
prepare_clusters ();
prepare_indirects ();
if (!relist_files)
prepare_mergings ();
/* Output results. */
output_file = stdout;
if (relist_files)
relist_annotated_files ();
else if (context)
relist_merged_lines (0, 1);
else if (unified)
relist_merged_lines (1, 1);
else if (word_mode)
relist_merged_words ();
/* Clean up. */
exit (exit_status);
}
wdiff-1.2.1/po/ 0000755 0000000 0000000 00000000000 12116513226 010176 5 0000000 0000000 wdiff-1.2.1/po/gl.gmo 0000644 0000000 0000000 00000035660 12116513226 011236 0000000 0000000 o ` ] a K 9
? E
8
1 5 : ; p ' % ' ) " ? L = > <