pkgsrc/security/libgpg-error/patches/patch-ai
kim 245cd1880b Avoid changing FS as it triggers an odd bug on some awk versions, with
incorrect field calculation for the second field if the first field is
numeric and there are only 2 fields total in the input record (line).

The buggy awk was in 2.99.* and early 3.99.*, and identifies itself as
awk version 20030729.  However, not all awk's with this version number
exhibit the problem (so it could be related to a library used by awk).

Recent 3.99.* builds don't have this problem, and the awk versio on
them is also much more recent.
2005-12-29 16:09:42 +00:00

70 lines
1.5 KiB
Text

$NetBSD: patch-ai,v 1.1 2005/12/29 16:09:42 kim Exp $
Setting FS in some versions of awk makes it null. Make this script
work with the default FS of "whitespace" instead.
--- src/mkheader.awk.orig 2004-03-08 18:44:05.000000000 +0200
+++ src/mkheader.awk 2005-12-24 16:51:38.000000000 +0200
@@ -51,7 +51,7 @@
# at the full path of the files in @srcdir@.
BEGIN {
- FS = "[\t]+";
+ #FS = "[\t]+";
# sources_nr holds the number of error sources.
sources_nr = 0;
# codes_nr holds the number of error codes.
@@ -74,7 +74,7 @@
}
sources_header {
- if ($1 ~ /^[0123456789]+$/)
+ if ($0 ~ /^[0-9]+/)
{
sources_header = 0;
sources_body = 1;
@@ -88,7 +88,7 @@
if (/^$/)
next;
- if ($1 == "")
+ if ($0 !~ /^[0-9]+/)
{
sources_body = 0;
between_sources_and_codes = 1;
@@ -103,7 +103,7 @@
}
between_sources_and_codes {
- if ($1 ~ /^[0123456789]+$/)
+ if ($0 ~ /^[0-9]+/)
{
between_sources_and_codes = 0;
codes_body = 1;
@@ -117,7 +117,7 @@
if (/^$/)
next;
- if ($1 == "")
+ if ($0 !~ /^[0-9]+/)
{
codes_body = 0;
between_codes_and_errnos = 1;
@@ -132,7 +132,7 @@
}
between_codes_and_errnos {
- if ($1 ~ /^[0-9]/)
+ if ($0 ~ /^[0-9]+/)
{
between_codes_and_errnos = 0;
errnos_body = 1;
@@ -146,7 +146,7 @@
if (/^$/)
next;
- if ($1 !~ /^[0-9]/)
+ if ($0 !~ /^[0-9]+/)
{
# Note that this assumes that gpg-error.h.in doesn't start with a digit.
errnos_body = 0;