2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Fix compatibility with older versions of (new) awk.

Do not rely on awk supporting "-f -" to read the program from stdin.
Avoid using POSIX character classes in regular expressions.
This commit is contained in:
Todd C. Miller 2023-10-02 10:31:55 -06:00
parent 3141f63b25
commit 9a715b6941

View File

@ -25,7 +25,7 @@ if [ $# -eq 0 ]; then
set -- def_data.in set -- def_data.in
fi fi
${AWK-awk} -f - -v outfile=$OUTFILE "$@" <<'EOF' ${AWK-awk} -v outfile=$OUTFILE '
BEGIN { BEGIN {
tuple_values[0] = "never" tuple_values[0] = "never"
tuple_keys["never"] = 0 tuple_keys["never"] = 0
@ -49,8 +49,8 @@ BEGIN {
} }
{ {
sub(/#.*/, "", $0) sub(/#.*/, "", $0)
if (/^[[:blank:]]*$/) next if (/^[ \t]*$/) next
if (/^[[:alpha:]]/) { if (/^[a-zA-Z]/) {
# Store previous record and begin new one # Store previous record and begin new one
if (var) if (var)
records[count++] = sprintf("%s\n%s\n%s\n%s\n%s\n", var, type, desc, values, callback) records[count++] = sprintf("%s\n%s\n%s\n%s\n%s\n", var, type, desc, values, callback)
@ -160,4 +160,4 @@ function print_record(rec, recnum) {
} }
print " }, {" > cfile print " }, {" > cfile
} }
EOF ' "$@"