Fix AWK array initialization error
- Initialize rcpts array properly to avoid scalar/array error - Skip empty recipient strings in output formatting - Ensures proper 2D array handling in AWK 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -362,7 +362,10 @@ fi
|
||||
# AWK Analysis
|
||||
grep_chain | awk -v TO_RE="${TO_REGEX:-}" -v WANTDOM="${TARGET_DOMAIN:-}" -v MSGIDREQ="${MSGID:-}" -v FROMREQ="${FROM:-}" -v EXTRA="${GREPEXTRA:-}" '
|
||||
function trim(s){ sub(/^[ \t\r\n]+/, "", s); sub(/[ \t\r\n]+$/, "", s); return s }
|
||||
function add_rcpt(id, rc){ if (!(rc in rcpts[id])) rcpts[id][rc]=1 }
|
||||
function add_rcpt(id, rc){
|
||||
if (!(id in rcpts)) rcpts[id][""] = ""
|
||||
if (!(rc in rcpts[id])) rcpts[id][rc]=1
|
||||
}
|
||||
|
||||
BEGIN { FS=" " }
|
||||
|
||||
@@ -484,9 +487,11 @@ END {
|
||||
out_rcpts=""
|
||||
if (id in rcpts){
|
||||
for (r in rcpts[id]) {
|
||||
if (r != "") {
|
||||
out_rcpts = (out_rcpts=="" ? r : out_rcpts ", " r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf "[%s] ID=%s | First=%s | From=%s | Rcpts=%s | Delivered=%d Deferred=%d Failed=%d\n",
|
||||
status_txt, id, first_ts[id], (from_addr[id] ? from_addr[id] : "(?)"), (out_rcpts=="" ? "(?)" : out_rcpts), d, e, f
|
||||
|
||||
Reference in New Issue
Block a user