diff options
author | rillig <rillig@pkgsrc.org> | 2007-01-09 04:28:23 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-01-09 04:28:23 +0000 |
commit | 871cdd10b73aa5134b522bc80a7f6ad45b3e871b (patch) | |
tree | dde340428b6fd9a6919dbfef7f6c69e043641a2e /mk/help/help.awk | |
parent | 1fc4e0bd3283cf0063808f7620746492ceef9e78 (diff) | |
download | pkgsrc-871cdd10b73aa5134b522bc80a7f6ad45b3e871b.tar.gz |
The help topic at the very end of the last file must also be considered.
Diffstat (limited to 'mk/help/help.awk')
-rw-r--r-- | mk/help/help.awk | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/mk/help/help.awk b/mk/help/help.awk index 02c5c34e264..3b84e4ce07f 100644 --- a/mk/help/help.awk +++ b/mk/help/help.awk @@ -1,4 +1,4 @@ -# $NetBSD: help.awk,v 1.7 2007/01/08 02:27:05 rillig Exp $ +# $NetBSD: help.awk,v 1.8 2007/01/09 04:28:23 rillig Exp $ # # This program extracts the inline documentation from *.mk files. @@ -26,6 +26,28 @@ BEGIN { print_noncomment_lines = yes; # for make targets, this isn't useful } +# Help topics are separated by either completely empty lines or by the +# end of a file or by the end of all files. When here have been enough +# comment lines, the topic is considered worth printing. +# +function end_of_topic() { + if (relevant && comment_lines > 2) { + found_anything = yes; + print "===> "last_fname":"; + for (i = 0; i < nlines; i++) { + if (!print_noncomment_lines || (lines[i] ~ /^#/)) + print lines[i]; + } + } + + ignore_next_empty_line = yes; + delete lines; + relevant = no; + nlines = 0; + comment_lines = 0; + print_noncomment_lines = yes; +} + always { ignore_this_line = (ignore_next_empty_line && $0 == "#"); } @@ -87,26 +109,8 @@ $1 == "#" { comment_lines++; } -# Help topics are separated by either completely empty lines or by the -# end of a file. When here have been enough comment lines, the topic is -# considered worth printing. -# /^$/ || last_fname != FILENAME { - if (relevant && comment_lines > 2) { - found_anything = yes; - print "===> "last_fname":"; - for (i = 0; i < nlines; i++) { - if (!print_noncomment_lines || (lines[i] ~ /^#/)) - print lines[i]; - } - } - - ignore_next_empty_line = yes; - delete lines; - relevant = no; - nlines = 0; - comment_lines = 0; - print_noncomment_lines = yes; + end_of_topic(); } always { @@ -115,6 +119,7 @@ always { } END { + end_of_topic(); if (!found_anything) { print "No help found for "topic"."; } |