summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig>2007-01-09 04:28:23 +0000
committerrillig <rillig>2007-01-09 04:28:23 +0000
commit2a826719281aa5259a94038d381fb63219e60642 (patch)
treedde340428b6fd9a6919dbfef7f6c69e043641a2e
parent85f9ab87b79be51562e2b8249ca9660c7005953d (diff)
downloadpkgsrc-2a826719281aa5259a94038d381fb63219e60642.tar.gz
The help topic at the very end of the last file must also be considered.
-rw-r--r--mk/help/help.awk45
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".";
}