diff mbox

gawk: fix gensub usage

Message ID 1439092119-24256-1-git-send-email-vapier@gentoo.org
State Committed
Delegated to: Mike Frysinger
Headers show

Commit Message

Mike Frysinger Aug. 9, 2015, 3:48 a.m. UTC
The third arg can either be a string with "g" or "G", or it is a number.
The empty string elicits a warning with newer versions like so:
gawk: scripts/sysd-rules.awk:56: warning: gensub: third argument `' treated as 1

2015-08-09  Mike Frysinger  <vapier@gentoo.org>

	* nptl/tst-cancel-wrappers.sh: Change 3rd arg to gensub to 1.
	* scripts/sysd-rules.awk: Likewise.
---
 nptl/tst-cancel-wrappers.sh | 2 +-
 scripts/sysd-rules.awk      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Andreas Schwab Aug. 9, 2015, 6:45 a.m. UTC | #1
Mike Frysinger <vapier@gentoo.org> writes:

> 2015-08-09  Mike Frysinger  <vapier@gentoo.org>
>
> 	* nptl/tst-cancel-wrappers.sh: Change 3rd arg to gensub to 1.
> 	* scripts/sysd-rules.awk: Likewise.

Ok.

Andreas.
diff mbox

Patch

diff --git a/nptl/tst-cancel-wrappers.sh b/nptl/tst-cancel-wrappers.sh
index b2d8302..d492a54 100644
--- a/nptl/tst-cancel-wrappers.sh
+++ b/nptl/tst-cancel-wrappers.sh
@@ -74,7 +74,7 @@  C["__xpg_sigpause"]=1
   seen=""
   seen_enable=""
   seen_disable=""
-  object=gensub(/^.*\[(.*)\]:$/,"\\1","",$0)
+  object=gensub(/^.*\[(.*)\]:$/, "\\1", 1, $0)
   next
 }
 {
diff --git a/scripts/sysd-rules.awk b/scripts/sysd-rules.awk
index cc14334..cebc9d3 100644
--- a/scripts/sysd-rules.awk
+++ b/scripts/sysd-rules.awk
@@ -53,7 +53,7 @@  BEGIN {
         if (target_pattern == "%") {
           command_suffix = "";
         } else {
-          prefix = gensub(/%/, "", "", target_pattern);
+          prefix = gensub(/%/, "", 1, target_pattern);
           command_suffix = " $(" prefix  "CPPFLAGS)";
         }
         target = "$(objpfx)" target_pattern o ":";