checkhelp.awk 941 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/awk -f
  2. # AWK script to check for missing help entries for config options
  3. #
  4. # Copyright (C) 2006 Bernhard Reutner-Fischer
  5. #
  6. # This file is distributed under the terms and conditions of the
  7. # MIT/X public licenses. See http://opensource.org/licenses/mit-license.html
  8. # and notice http://www.gnu.org/licenses/license-list.html#X11License
  9. /^choice/ { is_choice = 1; }
  10. /^endchoice/ { is_choice = 0; }
  11. /^config/ {
  12. pos++;
  13. conf[pos] = $2;
  14. file[pos] = FILENAME;
  15. if (is_choice) {
  16. help[pos] = 1; # do not warn about 'choice' config entries.
  17. } else {
  18. help[pos] = 0;
  19. }
  20. }
  21. /^[ \t]*help[ \t]*$/ {
  22. help[pos] = 1;
  23. }
  24. /^[ \t]*bool[ \t]*$/ {
  25. help[pos] = 1; # ignore options which are not selectable
  26. }
  27. BEGIN {
  28. pos = -1;
  29. is_choice = 0;
  30. }
  31. END {
  32. for (i = 0; i <= pos; i++) {
  33. # printf("%s: help for #%i '%s' == %i\n", file[i], i, conf[i], help[i]);
  34. if (help[i] == 0) {
  35. printf("%s: No helptext for '%s'\n", file[i], conf[i]);
  36. }
  37. }
  38. }