From f9431707a071cbace3ddb616b4b898bab0a9e1f4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 15 Feb 2012 00:46:36 +0000 Subject: [PATCH] keyfunc.sh.in, cryptop.info: Refactor property dumping. Move the functionality into the library. Also, stop mangling underscores in a broken way -- in fact, don't do it at all, so the output is acceptable to `readprops'. --- cryptop.info | 2 +- keyfunc.sh.in | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cryptop.info b/cryptop.info index 1d0ff21..7b9457a 100755 --- a/cryptop.info +++ b/cryptop.info @@ -37,7 +37,7 @@ key=$1 mktmp prepare "$key" info -set | sed -n '/^kprop_/{s///;y/_/-/;p}' +dumpprops kprop_ k_info $kdir ###----- That's all, folks -------------------------------------------------- diff --git a/keyfunc.sh.in b/keyfunc.sh.in index a618e66..89deccc 100644 --- a/keyfunc.sh.in +++ b/keyfunc.sh.in @@ -240,6 +240,16 @@ EOF done } +dumpprops () { + prefix=$1 + ## Write the properties stored in the variables beginning with PREFIX. + + set | sed -n "/^$prefix/{s/=.*\$//;p}" | sort | while read name; do + eval value=\$$name + echo "${name#$prefix}=$value" + done +} + defprops () { name=$1 ## Define a properties table NAME. -- 2.11.0