diff options
Diffstat (limited to 'number-to-name.awk')
-rwxr-xr-x | number-to-name.awk | 10 |
1 files changed, 9 insertions, 1 deletions
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: <decimal-number> <name> + num = $1; + name = $2; + number_to_name[num] = name; + } else if (split($0, a, / +- +|[, ]+/) >= 2) { + # `openssl ciphers -V` format: + # 0xHH,0xHH - <name> ... num = strtonum(a[2]) * 256 + strtonum(a[3]); name = a[4]; number_to_name[num] = name; |