summaryrefslogtreecommitdiff
path: root/generate-wireshark-cs
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-12-06 18:47:30 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-12-06 18:47:30 +0100
commitdf38ea9ef90aaea0a51d81af35610ac7bf57bba2 (patch)
treef971811467c8975bce3b114681a0dd0d734ad20f /generate-wireshark-cs
parent964d3d58193ae4d1e877c5ced8c6762aa83ad5db (diff)
downloadwireshark-notes-df38ea9ef90aaea0a51d81af35610ac7bf57bba2.tar.gz
generate-wireshark-cs: visual alignment
Previously, everything was concatenated, making it more difficult to spot errors.
Diffstat (limited to 'generate-wireshark-cs')
-rwxr-xr-xgenerate-wireshark-cs21
1 files changed, 18 insertions, 3 deletions
diff --git a/generate-wireshark-cs b/generate-wireshark-cs
index 99cfd29..2464064 100755
--- a/generate-wireshark-cs
+++ b/generate-wireshark-cs
@@ -16,6 +16,15 @@ warn() {
printf "$cb%s$ce\n" "$*" >&2
}
+# printf conversions with padding
+_KEX=%-$(wc -L <<<KEX_RSA_PSK,)s
+_ENC=%-$(wc -L <<<ENC_CAMELLIA256,)s
+_IV_SZ=%2d
+_KEYSZ=%3d
+_EXP_KEYSZ=%3d
+_DIG=%-$(wc -L <<<DIG_SHA384,)s
+_MODE=%-$(wc -L <<<STREAM)s
+
p() {
local tmp kex keysize exp_keysize=0 dig diglen mode us_export blocksize hexid
[ $# -gt 0 ] || return
@@ -145,9 +154,15 @@ p() {
;;
esac
-cat <<EOF
- {$hexid,KEX_$kex,ENC_$cipher,$blocksize,$keysize,$exp_keysize,DIG_$dig, SSL_CIPHER_MODE_$mode}, /* $1 */
-EOF
+ printf \
+" {$hexid,${_KEX}${_ENC}${_IV_SZ},${_KEYSZ},${_EXP_KEYSZ},${_DIG} SSL_CIPHER_MODE_${_MODE}}, /* $1 */\n" \
+ "KEX_$kex," \
+ "ENC_$cipher," \
+ $blocksize \
+ $keysize \
+ $exp_keysize \
+ "DIG_$dig," \
+ "$mode"
}
# expects a line like: