shithub: trueawk

Download patch

ref: 0b82bc6eb4533552d12ca7dd817203dfb53a6b80
parent: a96aebbbd601a619318312e835b76c3cd7816518
author: Arnold D. Robbins <arnold@skeeve.com>
date: Wed Dec 11 04:24:38 EST 2019

Small edits, update version and FIXES.

--- a/FIXES
+++ b/FIXES
@@ -25,6 +25,10 @@
 This file lists all bug fixes, changes, etc., made since the AWK book
 was sent to the printers in August, 1987.
 
+December 11, 2019:
+	Further printf-related fixes for 32 bit systems.
+	Thanks again to Christos Zoulas.
+
 December 8, 2019:
 	Fix the return value of sprintf("%d") on 32 bit systems.
 	Thanks to Jim Lowe for the report and to Christos Zoulas
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
 THIS SOFTWARE.
 ****************************************************************/
 
-const char	*version = "version 20191208";
+const char	*version = "version 20191211";
 
 #define DEBUG
 #include <stdio.h>
--- a/run.c
+++ b/run.c
@@ -856,12 +856,12 @@
 			if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3"))
 				FATAL("format item %.30s... ran format() out of memory", os);
 			/* Ignore size specifiers */
-			if (strchr("hjLlqtz", *s)) {
+			if (strchr("hjLlqtz", *s) != NULL) {	/* the ansi panoply */
 				t--;
 				continue;
 			}
 			if (isalpha((uschar)*s))
-				break;	/* the ansi panoply */
+				break;
 			if (*s == '$') {
 				FATAL("'$' not permitted in awk formats");
 			}
@@ -895,7 +895,7 @@
 			flag = 'f';
 			break;
 		case 'd': case 'i': case 'o': case 'x': case 'X': case 'u':
-			flag = *s == 'd' || *s == 'i' ? 'd' : 'u';
+			flag = (*s == 'd' || *s == 'i') ? 'd' : 'u';
 			*(t-1) = 'j';
 			*t = *s;
 			*++t = '\0';
--