pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk If the first word after the "#" is a variable name,...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/05f9ef98e5b4
branches:  trunk
changeset: 516965:05f9ef98e5b4
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Aug 02 10:50:00 2006 +0000

description:
If the first word after the "#" is a variable name, the line above must
have been empty to qualify as a comment. Otherwise "make help
TOPIC=configure" shows a lot of misleading contents.

Removed the duplicate appearance of RCS Ids in the help texts, which
often occured when the help text was the header comment of a file.

diffstat:

 mk/bsd.pkg.help.mk |  25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 6bd22d1b9d4b -r 05f9ef98e5b4 mk/bsd.pkg.help.mk
--- a/mk/bsd.pkg.help.mk        Wed Aug 02 10:37:34 2006 +0000
+++ b/mk/bsd.pkg.help.mk        Wed Aug 02 10:50:00 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.help.mk,v 1.2 2006/08/02 10:29:47 rillig Exp $
+# $NetBSD: bsd.pkg.help.mk,v 1.3 2006/08/02 10:50:00 rillig Exp $
 #
 
 # This is the integrated pkgsrc online help system. To query for the
@@ -22,15 +22,22 @@
                hline = hline hline hline hline hline;                  \
                found = no; var = no; comment = no; n = 0;              \
                rcsid = "";                                             \
+               last_line_was_rcsid = no;                               \
+               last_line_was_empty = yes;                              \
        }                                                               \
        /./ {                                                           \
-               lines[n++] = $$0;                                       \
-       }                                                               \
-       /^\\#.*\$$.*\$$$$/ {                                            \
-               rcsid = $$0;                                            \
+               if ($$0 ~ /^\\#.*\$$.*\$$$$/) {                         \
+                       rcsid = $$0;                                    \
+                       last_line_was_rcsid = yes;                      \
+               } else {                                                \
+                       if (!(last_line_was_rcsid && $$0 == "\#")) {    \
+                               lines[n++] = $$0;                       \
+                       }                                               \
+                       last_line_was_rcsid = no;                       \
+               }                                                       \
        }                                                               \
        ($$1 == VARNAME"?=") || ($$1 == "\#"VARNAME"=")                 \
-       || ($$1 == "\#" && $$2 == VARNAME) {                            \
+       || ($$1 == "\#" && $$2 == VARNAME && last_line_was_empty) {     \
                var = 1;                                                \
        }                                                               \
        /^\#/ {                                                         \
@@ -45,6 +52,12 @@
                }                                                       \
                var = no; comment = no; n = 0;                          \
        }                                                               \
+       /./ {                                                           \
+               last_line_was_empty = no;                               \
+       }                                                               \
+       /^\\#$$/ || /^$$/ {                                             \
+               last_line_was_empty = yes;                              \
+       }                                                               \
        END {                                                           \
                if (found) {                                            \
                        print hline;                                    \



Home | Main Index | Thread Index | Old Index