[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk-3.1.1 FS bugs for RS==""
From: |
Stepan Kasal |
Subject: |
gawk-3.1.1 FS bugs for RS=="" |
Date: |
Wed, 23 Oct 2002 09:09:39 +0200 |
User-agent: |
Mutt/1.2.5.1i |
Hello,
the following patch fixes these two bugs:
$ ./gawk 'BEGIN{RS="";FS=":";s="a:b\nc:d";print split(s,a);print length(a[2])}'
4
1
$ gawk 'BEGIN{RS="";FS="\\";$0="a\\b";print $1}'
a\b
(I've posted another patch for the first bug to c.l.a, but I think that this
one is better.)
Stepan
Wed Oct 23 09:00:52 CEST 2002 Stepan Kasal <address@hidden>
* field.c (do_split): Don't use parse_field if RS_is_null.
(set_FS): Beware of FS=="\\" even if RS_is_null.
diff -urpN gawk-3.1.1.i2/field.c gawk-3.1.1/field.c
--- gawk-3.1.1.i2/field.c Wed Oct 16 12:54:28 2002
+++ gawk-3.1.1/field.c Wed Oct 23 09:00:32 2002
@@ -840,7 +840,7 @@ do_split(NODE *tree)
goto out;
}
- if ((sep->re_flags & FS_DFLT) != 0 && ! using_FIELDWIDTHS()) {
+ if ((sep->re_flags & FS_DFLT) != 0 && ! using_FIELDWIDTHS() && !
RS_is_null) {
parseit = parse_field;
fs = force_string(FS_node->var_value);
rp = FS_regexp;
@@ -991,7 +991,10 @@ set_FS()
if (fs->stptr[0] == ' ') {
default_FS = TRUE;
strcpy(buf, "[ \t\n]+");
- } else if (fs->stptr[0] != '\n')
+ } else if (fs->stptr[0] == '\\')
+ /* yet another special case */
+ strcpy(buf, "[\\\\\n]");
+ else if (fs->stptr[0] != '\n')
sprintf(buf, "[%c\n]", fs->stptr[0]);
}
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gawk-3.1.1 FS bugs for RS=="",
Stepan Kasal <=