Small edits, update version and FIXES.

This commit is contained in:
Arnold D. Robbins 2019-12-11 09:24:38 +02:00
parent a96aebbbd6
commit 0b82bc6eb4
3 changed files with 8 additions and 4 deletions

4
FIXES
View File

@ -25,6 +25,10 @@ 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.
December 11, 2019:
Further printf-related fixes for 32 bit systems.
Thanks again to Christos Zoulas.
December 8, 2019: December 8, 2019:
Fix the return value of sprintf("%d") on 32 bit systems. Fix the return value of sprintf("%d") on 32 bit systems.
Thanks to Jim Lowe for the report and to Christos Zoulas Thanks to Jim Lowe for the report and to Christos Zoulas

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 20191208"; const char *version = "version 20191211";
#define DEBUG #define DEBUG
#include <stdio.h> #include <stdio.h>

6
run.c
View File

@ -856,12 +856,12 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3")) if (!adjbuf(&fmt, &fmtsz, MAXNUMSIZE+1+t-fmt, recsize, &t, "format3"))
FATAL("format item %.30s... ran format() out of memory", os); FATAL("format item %.30s... ran format() out of memory", os);
/* Ignore size specifiers */ /* Ignore size specifiers */
if (strchr("hjLlqtz", *s)) { if (strchr("hjLlqtz", *s) != NULL) { /* the ansi panoply */
t--; t--;
continue; continue;
} }
if (isalpha((uschar)*s)) if (isalpha((uschar)*s))
break; /* the ansi panoply */ break;
if (*s == '$') { if (*s == '$') {
FATAL("'$' not permitted in awk formats"); FATAL("'$' not permitted in awk formats");
} }
@ -895,7 +895,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
flag = 'f'; flag = 'f';
break; break;
case 'd': case 'i': case 'o': case 'x': case 'X': case 'u': 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-1) = 'j';
*t = *s; *t = *s;
*++t = '\0'; *++t = '\0';