Received: by mail.netbsd.org (Postfix, from userid 605) id 2D83F84D95; Sun, 3 May 2020 09:07:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id A980F84D71 for ; Sun, 3 May 2020 09:07:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id HH0dRDPbcZ-r for ; Sun, 3 May 2020 09:07:00 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 3614F84D2C for ; Sun, 3 May 2020 09:07:00 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 3011BFB27; Sun, 3 May 2020 09:07:00 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1588496820289530" MIME-Version: 1.0 Date: Sun, 3 May 2020 09:07:00 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/mk/help To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20200503090700.3011BFB27@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: pkgsrc-changes.NetBSD.org Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1588496820289530 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Sun May 3 09:07:00 UTC 2020 Modified Files: pkgsrc/mk/help: help.awk Log Message: mk/help: clean up code for selecting relevant help topics To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 pkgsrc/mk/help/help.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1588496820289530 Content-Disposition: inline Content-Length: 1821 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/mk/help/help.awk diff -u pkgsrc/mk/help/help.awk:1.36 pkgsrc/mk/help/help.awk:1.37 --- pkgsrc/mk/help/help.awk:1.36 Sun May 3 08:49:16 2020 +++ pkgsrc/mk/help/help.awk Sun May 3 09:06:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: help.awk,v 1.36 2020/05/03 08:49:16 rillig Exp $ +# $NetBSD: help.awk,v 1.37 2020/05/03 09:06:59 rillig Exp $ # # This program extracts the inline documentation from *.mk files. @@ -35,16 +35,19 @@ BEGIN { # end of a file or by the end of all files. When there have been enough # comment lines, the topic is considered worth printing. # -function end_of_topic( relevant, has_keywords) { +function end_of_topic( relevant, has_keywords, skip_reason) { - if (comment_lines <= 2 || ignore_this_section) { - if (array_is_empty(keywords)) { - dprint("Ignoring section because of missing keywords."); - } else if (comment_lines <= 2) { - dprint("Ignoring section because of too small comment."); - } else { - dprint("Ignoring section because of a previous decision."); - } + skip_reason = \ + array_is_empty(keywords) \ + ? "Ignoring section because of missing keywords." \ + : comment_lines <= 2 \ + ? "Ignoring section because of too small comment." \ + : ignore_this_section \ + ? "Ignoring section because of a previous decision." \ + : ""; + + if (skip_reason != "") { + dprint(skip_reason); cleanup(); return; } @@ -52,12 +55,8 @@ function end_of_topic( relevant, has_k for (k in keywords) all_keywords[k]++; - relevant = no; - if (topic == ":all") - for (k in keywords) - relevant = yes; - if (topic in keywords || lctopic in keywords || uctopic in keywords) - relevant = yes; + relevant = topic in keywords || lctopic in keywords || + uctopic in keywords || topic == ":all"; if (relevant && !print_index) { --_----------=_1588496820289530--