From 4f49800cadaa467aadfbe079de6392f72a1232d8 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 1 Oct 2013 22:51:47 +0200 Subject: number-to-name.awk: support suites.txt file format --- number-to-name.awk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'number-to-name.awk') diff --git a/number-to-name.awk b/number-to-name.awk index 8c499be..ba9a733 100755 --- a/number-to-name.awk +++ b/number-to-name.awk @@ -4,9 +4,17 @@ BEGIN { if (!cmd) cmd = "openssl ciphers -V"; + # alternative: cat suites.txt while ((cmd | getline) > 0) { - if ( split($0, a, / +- +|[, ]+/)) { + if ($1 ~ /^[0-9]+/) { + # suites.txt format: + num = $1; + name = $2; + number_to_name[num] = name; + } else if (split($0, a, / +- +|[, ]+/) >= 2) { + # `openssl ciphers -V` format: + # 0xHH,0xHH - ... num = strtonum(a[2]) * 256 + strtonum(a[3]); name = a[4]; number_to_name[num] = name; -- cgit v1.2.1