autoconf-patches
[Top][All Lists]
Advanced

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

Re: AT_KEYWORDS failure: cmdline OR-combinations


From: Paul Eggert
Subject: Re: AT_KEYWORDS failure: cmdline OR-combinations
Date: Thu, 25 Aug 2005 14:31:30 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> -     if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
> -     if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
> +     if (v1"" == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = 
> substr(v1,2) }
> +     if (v2"" == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = 
> substr(v2,2) }

That looks fairly safe, but even safer would be to use the length function,
since earlier bits of the code already do that.  I installed this:

2005-08-25  Paul Eggert  <address@hidden>

        * lib/m4sugar/m4sh.m4 (_AS_VERSION_COMPARE_PREPARE):
        Work around bug in Solaris 9 (and 10) /usr/xpg4/bin/awk.

--- m4sh.m4     17 Jun 2005 20:37:37 -0000      1.148
+++ m4sh.m4     25 Aug 2005 21:29:54 -0000      1.149
@@ -1074,8 +1074,8 @@ m4_defun([_AS_VERSION_COMPARE_PREPARE],
        }
       } else {
        # The normal case, without worrying about digits.
-       if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
-       if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
+       if (length(v1)) { d1 = substr(v1, 1, 1); v1 = substr(v1,2) } else d1=v1
+       if (length(v2)) { d2 = substr(v2, 1, 1); v2 = substr(v2,2) } else d2=v2
       }
       if (d1 < d2) exit 1
       if (d1 > d2) exit 2




reply via email to

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