1.1 --- a/doc-src/System/Thy/Misc.thy Sat Jun 06 23:43:07 2009 +0200
1.2 +++ b/doc-src/System/Thy/Misc.thy Sun Jun 07 19:07:05 2009 +0200
1.3 @@ -85,6 +85,8 @@
1.4 Options are:
1.5 -a display complete environment
1.6 -b print values only (doesn't work for -a)
1.7 + -d FILE dump complete environment to FILE
1.8 + (null terminated entries)
1.9
1.10 Get value of VARNAMES from the Isabelle settings.
1.11 \end{ttbox}
1.12 @@ -95,6 +97,10 @@
1.13 Normally, output is a list of lines of the form @{text
1.14 name}@{verbatim "="}@{text value}. The @{verbatim "-b"} option
1.15 causes only the values to be printed.
1.16 +
1.17 + Option @{verbatim "-d"} produces a dump of the complete environment
1.18 + to the specified file. Entries are terminated by the ASCII null
1.19 + character, i.e.\ the C string terminator.
1.20 *}
1.21
1.22
2.1 --- a/doc-src/System/Thy/document/Misc.tex Sat Jun 06 23:43:07 2009 +0200
2.2 +++ b/doc-src/System/Thy/document/Misc.tex Sun Jun 07 19:07:05 2009 +0200
2.3 @@ -110,6 +110,8 @@
2.4 Options are:
2.5 -a display complete environment
2.6 -b print values only (doesn't work for -a)
2.7 + -d FILE dump complete environment to FILE
2.8 + (null terminated entries)
2.9
2.10 Get value of VARNAMES from the Isabelle settings.
2.11 \end{ttbox}
2.12 @@ -118,7 +120,11 @@
2.13 environment that Isabelle related programs are run in. This usually
2.14 contains much more variables than are actually Isabelle settings.
2.15 Normally, output is a list of lines of the form \isa{name}\verb|=|\isa{value}. The \verb|-b| option
2.16 - causes only the values to be printed.%
2.17 + causes only the values to be printed.
2.18 +
2.19 + Option \verb|-d| produces a dump of the complete environment
2.20 + to the specified file. Entries are terminated by the ASCII null
2.21 + character, i.e.\ the C string terminator.%
2.22 \end{isamarkuptext}%
2.23 \isamarkuptrue%
2.24 %
3.1 --- a/lib/Tools/getenv Sat Jun 06 23:43:07 2009 +0200
3.2 +++ b/lib/Tools/getenv Sun Jun 07 19:07:05 2009 +0200
3.3 @@ -17,6 +17,8 @@
3.4 echo " Options are:"
3.5 echo " -a display complete environment"
3.6 echo " -b print values only (doesn't work for -a)"
3.7 + echo " -d FILE dump complete environment to FILE"
3.8 + echo " (null terminated entries)"
3.9 echo
3.10 echo " Get value of VARNAMES from the Isabelle settings."
3.11 echo
3.12 @@ -30,8 +32,9 @@
3.13
3.14 ALL=""
3.15 BASE=""
3.16 +DUMP=""
3.17
3.18 -while getopts "ab" OPT
3.19 +while getopts "abd:" OPT
3.20 do
3.21 case "$OPT" in
3.22 a)
3.23 @@ -40,6 +43,9 @@
3.24 b)
3.25 BASE=true
3.26 ;;
3.27 + d)
3.28 + DUMP="$OPTARG"
3.29 + ;;
3.30 \?)
3.31 usage
3.32 ;;
3.33 @@ -68,3 +74,8 @@
3.34 fi
3.35 done
3.36 fi
3.37 +
3.38 +if [ -n "$DUMP" ]; then
3.39 + exec perl -w -e 'for $key (keys %ENV) { print $key, "=", $ENV{$key}, "\x00"; }' > "$DUMP"
3.40 +fi
3.41 +