[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6268] local builtin for info tests
From: |
Gavin D. Smith |
Subject: |
[6268] local builtin for info tests |
Date: |
Sun, 17 May 2015 08:24:41 +0000 |
Revision: 6268
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6268
Author: gavin
Date: 2015-05-17 08:24:39 +0000 (Sun, 17 May 2015)
Log Message:
-----------
local builtin for info tests
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/t/Init-inter.inc
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-05-16 13:54:24 UTC (rev 6267)
+++ trunk/ChangeLog 2015-05-17 08:24:39 UTC (rev 6268)
@@ -1,3 +1,8 @@
+2015-05-17 Gavin Smith <address@hidden>
+
+ * info/t/Init-inter.inc: Copy shell portability code for "local"
+ builtin from util/texi2dvi.
+
2015-05-16 Gavin Smith <address@hidden>
* info/pseudotty.c: Define a global "program_name" variable for
Modified: trunk/info/t/Init-inter.inc
===================================================================
--- trunk/info/t/Init-inter.inc 2015-05-16 13:54:24 UTC (rev 6267)
+++ trunk/info/t/Init-inter.inc 2015-05-17 08:24:39 UTC (rev 6268)
@@ -31,6 +31,43 @@
path_sep=":"
fi
+# Generic auxiliary functions.
+#
+# In case `local' is not supported by the shell, provide a function
+# that simulates it by simply performing the assignments. This means
+# that we must not expect `local' to work, i.e., we must not (i) rely
+# on it during recursion, and (ii) have two local declarations of the
+# same variable. (ii) is easy to check statically, and our test suite
+# does make sure there is never twice a static local declaration of a
+# variable. (i) cannot be checked easily, so just be careful.
+#
+# Note that since we might use a function simulating `local', we can
+# no longer rely on the fact that no IFS-splitting is performed. So,
+# while
+#
+# foo=$bar
+#
+# is fine (no IFS-splitting), never write
+#
+# local foo=$bar
+#
+# but rather
+#
+# local foo="$bar"
+(
+ foo=bar
+ test_local () {
+ local foo=foo
+ }
+ test_local >/dev/null 2>&1
+ test $foo = bar
+) || eval '
+local () {
+ case $1 in
+ *=*) eval "$1";;
+ esac
+}
+'
# findprog PROG - Return true if PROG is somewhere in PATH, else false.
findprog ()
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6268] local builtin for info tests,
Gavin D. Smith <=