bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: init.sh: work also with any non-GNU diff that support


From: Bruno Haible
Subject: Re: [PATCH] tests: init.sh: work also with any non-GNU diff that supports -u
Date: Fri, 2 Sep 2011 14:59:46 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Jim Meyering wrote:
> FYI, I've just pushed this in Bruno's name:

I see it pushed in coreutils, not in gnulib.

> Rather than checking for GNU diff via --version, simply check
> for support for -u itself.  Useful at least on OpenBSD 4.9.

Also useful on AIX 7.1, IRIX 6.5, Solaris 10.

And on AIX 6.1, HP-UX 11.31, OSF/1 5.1, Solaris 8, "diff -u" is not supported,
but "diff -c" is. (As specified by POSIX:2001.) Therefore I would go one step
further:


2011-09-02  Bruno Haible  <address@hidden>

        * tests/init.sh (compare): If "diff -c" is supported but "diff -u" is
        not, use "diff -c".

--- tests/init.sh.orig  Fri Sep  2 14:55:47 2011
+++ tests/init.sh       Fri Sep  2 14:55:26 2011
@@ -223,6 +223,8 @@
 
 if ( diff -u "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
   compare () { diff -u "$@"; }
+elif ( diff -c "$0" "$0" < /dev/null ) > /dev/null 2>&1; then
+  compare () { diff -c "$@"; }
 elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
   compare () { cmp -s "$@"; }
 else

-- 
In memoriam Robert Mensah <http://en.wikipedia.org/wiki/Robert_Mensah>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]