nss-drv: nss_stats: fix gawk regex compatibility

It's not necessary to escape '#' and '=' in awk regexes, doing so
causes gawk to throw warnings.

Busybox awk is more permissive and does not throw warnings.

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2025-05-31 03:42:44 -04:00
parent d845680ef2
commit 370137d0bf

View File

@ -2,9 +2,9 @@
# shellcheck disable=2046,3037,3010
###############################################################################
# QCA NSS Driver Debug Script
# version 20240622
# version 20250631
#
# Requires: NSS Driver 12.1+
# Requires: NSS Driver 11.4+
# Usage: /lib/debug/qca-nss-drv (no arguments)
# Description: Display non-zero NSS statistics with color highlighting
# (requires a terminal that supports ANSI escape codes)
@ -18,8 +18,8 @@ function color(c, s) {
if ($3 > 0) {
if ($3 ~ /^[0-9]+/ && $3 > 0 && $0 ~ /%/ ) c = 3
if ($2 ~ /Avg/ ) c = 4
if ($1 ~ /\#/ ) c = 7
if ($3 ~ /^[0-9]+$/ && $3 > 0 && $0 ~ /\=/ ) c = 3
if ($1 ~ /#/ ) c = 7
if ($3 ~ /^[0-9]+$/ && $3 > 0 && $0 ~ /=/ ) c = 3
if ($0 ~ /<</) c = 4
if ($4 == "error") c = 1
else if ($4 == "special") c = 6