Fix compiling with g++.

This commit is contained in:
Arnold D. Robbins 2021-02-15 20:33:15 +02:00
parent 178f660b5a
commit c0f4e97e45
3 changed files with 7 additions and 3 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.
February 15, 2021:
Small fix so that awk will compile again with g++. Thanks to
Arnold Robbins.
January 06, 2021: January 06, 2021:
Fix a decision bug with trailing stuff in lib.c:is_valid_number Fix a decision bug with trailing stuff in lib.c:is_valid_number
after recent changes. Thanks to Ozan Yigit. after recent changes. Thanks to Ozan Yigit.

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

4
tran.c
View File

@ -418,7 +418,7 @@ Awkfloat getfval(Cell *vp) /* get float val of a Cell */
return(vp->fval); return(vp->fval);
} }
static char *get_inf_nan(double d) static const char *get_inf_nan(double d)
{ {
if (isinf(d)) { if (isinf(d)) {
return (d < 0 ? "-inf" : "+inf"); return (d < 0 ? "-inf" : "+inf");
@ -432,7 +432,7 @@ static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cel
{ {
char s[256]; char s[256];
double dtemp; double dtemp;
char *p; const char *p;
if ((vp->tval & (NUM | STR)) == 0) if ((vp->tval & (NUM | STR)) == 0)
funnyvar(vp, "read value of"); funnyvar(vp, "read value of");