pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/help The help topic at the very end of the last fil...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b16915f85ecb
branches:  trunk
changeset: 523531:b16915f85ecb
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Jan 09 04:28:23 2007 +0000

description:
The help topic at the very end of the last file must also be considered.

diffstat:

 mk/help/help.awk |  45 +++++++++++++++++++++++++--------------------
 1 files changed, 25 insertions(+), 20 deletions(-)

diffs (74 lines):

diff -r dd80defd01ae -r b16915f85ecb mk/help/help.awk
--- a/mk/help/help.awk  Tue Jan 09 04:17:30 2007 +0000
+++ b/mk/help/help.awk  Tue Jan 09 04:28:23 2007 +0000
@@ -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 @@
        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 @@
        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 @@
 }
 
 END {
+       end_of_topic();
        if (!found_anything) {
                print "No help found for "topic".";
        }



Home | Main Index | Thread Index | Old Index