In fldbld(), check that inputFS is set.

This commit is contained in:
Arnold D. Robbins 2020-06-05 12:25:15 +03:00
parent 1107437dce
commit 754cf93645
3 changed files with 8 additions and 1 deletions

5
FIXES
View File

@ -25,6 +25,11 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987. was sent to the printers in August, 1987.
June 5, 2020:
In fldbld(), make sure that inputFS is set before trying to
use it. Thanks to Steffen Nurpmeso <steffen@sdaoden.eu>
for the report.
May 5, 2020: May 5, 2020:
Fix checks for compilers that can handle noreturn. Thanks to Fix checks for compilers that can handle noreturn. Thanks to
GitHub user enh-google for pointing it out. Closes Issue #79. GitHub user enh-google for pointing it out. Closes Issue #79.

2
lib.c
View File

@ -332,6 +332,8 @@ void fldbld(void) /* create fields from current record */
} }
fr = fields; fr = fields;
i = 0; /* number of fields accumulated here */ i = 0; /* number of fields accumulated here */
if (inputFS == NULL) /* make sure we have a copy of FS */
savefs();
if (strlen(inputFS) > 1) { /* it's a regular expression */ if (strlen(inputFS) > 1) { /* it's a regular expression */
i = refldbld(r, inputFS); i = refldbld(r, inputFS);
} else if ((sep = *inputFS) == ' ') { /* default whitespace */ } else if ((sep = *inputFS) == ' ') { /* default whitespace */

2
main.c
View File

@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE. THIS SOFTWARE.
****************************************************************/ ****************************************************************/
const char *version = "version 20200515"; const char *version = "version 20200605";
#define DEBUG #define DEBUG
#include <stdio.h> #include <stdio.h>