eliminated perl: prefer elementary GNU printenv;
authorwenzelm
Wed, 14 Apr 2021 20:53:28 +0200
changeset 73581 cd84e58aed26
parent 73580 a96564139fa7
child 73582 dabe295c3f62
eliminated perl: prefer elementary GNU printenv;
lib/Tools/getenv
src/Doc/System/Misc.thy
--- a/lib/Tools/getenv	Wed Apr 14 14:36:13 2021 +0200
+++ b/lib/Tools/getenv	Wed Apr 14 20:53:28 2021 +0200
@@ -17,8 +17,7 @@
   echo "  Options are:"
   echo "    -a           display complete environment"
   echo "    -b           print values only (doesn't work for -a)"
-  echo "    -d FILE      dump complete environment to FILE"
-  echo "                 (null terminated entries)"
+  echo "    -d FILE      dump complete environment to file (NUL terminated entries)"
   echo
   echo "  Get value of VARNAMES from the Isabelle settings."
   echo
@@ -78,6 +77,5 @@
 
 if [ -n "$DUMP" ]; then
   export PATH_JVM="$(platform_path "$PATH")"
-  exec perl -w -e 'for $key (keys %ENV) { print $key, "=", $ENV{$key}, "\x00"; }' > "$DUMP"
+  "$ISABELLE_PRINTENV" -0 > "$DUMP"
 fi
-
--- a/src/Doc/System/Misc.thy	Wed Apr 14 14:36:13 2021 +0200
+++ b/src/Doc/System/Misc.thy	Wed Apr 14 20:53:28 2021 +0200
@@ -220,8 +220,7 @@
   Options are:
     -a           display complete environment
     -b           print values only (doesn't work for -a)
-    -d FILE      dump complete environment to FILE
-                 (null terminated entries)
+    -d FILE      dump complete environment to file (NUL terminated entries)
 
   Get value of VARNAMES from the Isabelle settings.\<close>}
 
@@ -232,8 +231,11 @@
   to be printed.
 
   Option \<^verbatim>\<open>-d\<close> produces a dump of the complete environment to the specified
-  file. Entries are terminated by the ASCII null character, i.e.\ the C string
-  terminator.
+  file. Entries are terminated by the ASCII NUL character, i.e.\ the string
+  terminator in C. Thus the Isabelle/Scala operation
+  \<^scala_method>\<open>isabelle.Isabelle_System.init\<close> can import the settings
+  environment robustly, and provide its own
+  \<^scala_method>\<open>isabelle.Isabelle_System.getenv\<close> function.
 \<close>