While updating games/recoil-rts I notice portcheck did not report the correct
number of lines > 80. I did not find an easy solution with awk, expand fits 
nicely.

Index: portcheck
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portcheck,v
diff -u -p -r1.147 portcheck
--- portcheck   10 Jun 2024 05:10:08 -0000      1.147
+++ portcheck   15 Jun 2024 14:32:44 -0000
@@ -1747,16 +1747,16 @@ check_rcscript() {
 }

 # Checks made:
-#   * There are no lines longer than 80 characters that have at least
-#     one space (avoids warnings on long URLs etc.).
+#   * There are no lines longer than 80 columns (including tabulation size)
+#     that have at least one space (avoids warnings on long URLs etc.).
 check_long_lines() {
        $debugging && echo "CALLED: check_long_lines($*)" >&2
        local file=$1; shift

-       local n=$(awk <"$file" \
+       local n=$(expand <"$file" | awk \
                  '/[[:space:]]/ && length > 80 { n++ } END { print n+0 }')
        (($n > 0 )) &&
-               err "$n line(s) longer than 80 chars in $file"
+               err "$n line(s) longer than 80 columns in $file"
 }

 # Checks made:

Reply via email to