Skip to content

Commit 6001889

Browse files
committed
improve update_reg.sh debugging
The `sbin/update_reg.sh` tool will call `sbin/who_extract.sh` with `-v level` when the level is > 0. The `sbin/who_email.awk` is more robust on looking for the initial "_who_" line. The `sbin/who_extract.sh` when debug level is >= 5 will run the `sbin/who_email.awk` first with a `-v debug=level` value.
1 parent 4c672d5 commit 6001889

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

sbin/update_reg.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export LC_ALL="C"
122122

123123
# setup
124124
#
125-
export VERSION="2.2.1 2025-11-17"
125+
export VERSION="2.2.2 2025-11-17"
126126
NAME=$(basename "$0")
127127
export NAME
128128
export V_FLAG=0
@@ -1310,8 +1310,13 @@ if [[ -z $NOOP ]]; then
13101310
if [[ $V_FLAG -ge 1 ]]; then
13111311
echo "$0: debug[1]: about to: $WHO_EXTRACT_SH $WHO_IOCCC $TMP_FREELISTS_LST 2>$TMP_STDERR" 1>&2
13121312
fi
1313-
"$WHO_EXTRACT_SH" "$WHO_IOCCC" "$TMP_FREELISTS_LST" 2>"$TMP_STDERR"
1314-
status="$?"
1313+
if [[ $V_FLAG -ge 1 ]]; then
1314+
"$WHO_EXTRACT_SH" -v "$V_FLAG" "$WHO_IOCCC" "$TMP_FREELISTS_LST" 2>"$TMP_STDERR"
1315+
status="$?"
1316+
else
1317+
"$WHO_EXTRACT_SH" "$WHO_IOCCC" "$TMP_FREELISTS_LST" 2>"$TMP_STDERR"
1318+
status="$?"
1319+
fi
13151320
if [[ $status -ne 0 ]]; then
13161321
git_exit 1 "$0: ERROR: $WHO_EXTRACT_SH $WHO_IOCCC $TMP_FREELISTS_LST 2>$TMP_STDERR failed, error: $status"
13171322
fi

sbin/who_email.awk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#
99
# About modes:
1010
#
11-
# 0 - waiting for '>> who' line
12-
# 1 - read '>> who' line, now waiting for line that starts with 'Membership of list '
11+
# 0 - waiting for '>> who' or 'who' line
12+
# 1 - read '>> who' or 'who' line, now waiting for line that starts with 'Membership of list '
1313
# 2 - read line that starts with 'Membership of list ', now reading email lines, waiting for empty/blank line
1414
#
1515
# NOTE: When mode == 2 and a empty/blank line is read, mode will return to 0.
@@ -21,7 +21,7 @@ BEGIN {
2121

2222
# setup
2323
#
24-
VERSION="2.0.0 2025-02-28";
24+
VERSION="2.0.1 2025-11-17";
2525

2626
# if debug is empty, set debug to 0
2727
#
@@ -38,9 +38,9 @@ BEGIN {
3838
}
3939

4040

41-
# case mode 0: waiting for '>> who' line
41+
# case mode 0: waiting for '>> who' or 'who' line
4242
#
43-
mode == 0 && $0 !~ /^>> who/ {
43+
mode == 0 && $0 !~ /^[> \t]*who[ \t]*$/ {
4444
line = substr($0, 1, length($0)-1);
4545
if (debug > 0) {
4646
print "DEBUG: mode 0: waiting for who line: ((" line "))";
@@ -49,11 +49,11 @@ mode == 0 && $0 !~ /^>> who/ {
4949
}
5050

5151

52-
# case mode 0: read '>> who' line
52+
# case mode 0: read '>> who' or 'who' line
5353
#
5454
# enter mode 1
5555
#
56-
mode == 0 && $0 ~ /^>> who/ {
56+
mode == 0 && $0 ~ /^[> \t]*who[ \t]*$/ {
5757
line = substr($0, 1, length($0)-1);
5858
if (debug > 0) {
5959
print "DEBUG: mode 0: read who line: ((" line "))";
@@ -64,7 +64,7 @@ mode == 0 && $0 ~ /^>> who/ {
6464
}
6565

6666

67-
# case mode 1: read '>> who' line, now waiting for line that starts with 'Membership of list '
67+
# case mode 1: read '>> who' or 'who' line, now waiting for line that starts with 'Membership of list '
6868
#
6969
# enter mode 2
7070
#

sbin/who_extract.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export LC_ALL="C"
6464

6565
# setup
6666
#
67-
export VERSION="2.2.0 2025-03-13"
67+
export VERSION="2.2.1 2025-11-17"
6868
NAME=$(basename "$0")
6969
export NAME
7070
export V_FLAG=0
@@ -360,6 +360,11 @@ fi
360360

361361
# extract email address from who-ioccc file
362362
#
363+
if [[ $V_FLAG -ge 5 ]]; then
364+
echo "$0: debug[5]: $AWK_TOOL -f $WHO_EMAIL_AWK -v debug=$V_FLAG $WHO_IOCCC output starts below" 1>&2
365+
"$AWK_TOOL" -f "$WHO_EMAIL_AWK" -v debug="$V_FLAG" "$WHO_IOCCC"
366+
echo "$0: debug[5]: $AWK_TOOL -f $WHO_EMAIL_AWK -v debug=$V_FLAG $WHO_IOCCC output ends above" 1>&2
367+
fi
363368
if [[ $V_FLAG -ge 1 ]]; then
364369
echo "$0: debug[1]: about to run: $AWK_TOOL -f $WHO_EMAIL_AWK $WHO_IOCCC > $TMP_OUTPUT" 1>&2
365370
fi

0 commit comments

Comments
 (0)