aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
Diffstat (limited to 'field.c')
-rw-r--r--field.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/field.c b/field.c
index 17dce9b6..fa7dc3e9 100644
--- a/field.c
+++ b/field.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1995 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Progamming Language.
@@ -298,6 +298,16 @@ NODE *n;
if (len == 0)
return nf;
+ /*
+ * Nasty special case. If FS set to "", return whole record
+ * as first field. This is not worth a separate function.
+ */
+ if (fs->stlen == 0) {
+ (*set)(++nf, *buf, len, n);
+ *buf += len;
+ return nf;
+ }
+
/* before doing anything save the char at *end */
sav = *end;
/* because it will be destroyed now: */
@@ -676,3 +686,10 @@ set_FIELDWIDTHS()
}
FIELDWIDTHS[i] = -1;
}
+
+void
+set_FS_if_not_FIELDWIDTHS()
+{
+ if (parse_field != fw_parse_field)
+ set_FS();
+}