check_line_len.awk 264 B

12345678910111213141516171819202122
  1. #!/usr/bin/awk -f
  2. BEGIN {
  3. max = 100;
  4. }
  5. # Expand tabs to 4 spaces.
  6. {
  7. gsub(/\t/, " ");
  8. }
  9. length() > max {
  10. errors++;
  11. print FILENAME ":" FNR ": Line too long (" length() "/" max ")";
  12. }
  13. END {
  14. if (errors >= 125) {
  15. errors = 125;
  16. }
  17. exit errors;
  18. }