From: Mark Wooding Date: Wed, 15 Feb 2012 00:46:36 +0000 (+0000) Subject: keyfunc.sh.in, cryptop.info: Refactor property dumping. X-Git-Tag: 0.99.2~29 X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-keys/commitdiff_plain/f9431707a071cbace3ddb616b4b898bab0a9e1f4 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'. --- 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.