diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-12-06 18:47:30 +0100 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-12-06 18:47:30 +0100 |
commit | df38ea9ef90aaea0a51d81af35610ac7bf57bba2 (patch) | |
tree | f971811467c8975bce3b114681a0dd0d734ad20f /generate-wireshark-cs | |
parent | 964d3d58193ae4d1e877c5ced8c6762aa83ad5db (diff) | |
download | wireshark-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-x | generate-wireshark-cs | 21 |
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: |