diff --git a/CHANGES b/CHANGES index cf35442..fab8e50 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,24 @@ -Following is the change from calc version 2.10.3t5.38 to date: +Following is the change from calc version 2.11.0t1 to date: + + Fixed BSDI compile problems related to sys_errlist. + + Removed the makefile symbol MAIN. Now forcing all funcions to correctly + be reclared main. To passify some old broken compilers, a return 0; + (instead of an exit(0);) is used at the end of main(). + + A few of files that were added to calc used 4 character indentation + whereas most of calc uses 8 character indentation. These imported + sources have been changed to conform better with the calc style. + + Fixed misc compile warnings. + + +Following is the change from calc version 2.10.3t5.38 to 2.11.0t0: + + Fixed a few compile problems found under Red Hat 6.0 Linux. + + +Following is the change from calc version 2.10.3t5.38 to 2.11.3t5.46: Fixed a bug discovered by Ernest Bowen related to matrix-to-matrix copies. diff --git a/Makefile b/Makefile index a7d6e36..fd480df 100644 --- a/Makefile +++ b/Makefile @@ -206,18 +206,6 @@ HAVE_MEMMOVE= ALIGN32= -DMUST_ALIGN32 #ALIGN32= -UMUST_ALIGN32 -# The return value type of main() differs from platform to platform. -# In some cases, a compiler warning is issued because main() does -# or does not return a value. -# -# MAIN= -DMAIN=void main() is of type void -# MAIN= -DMAIN=int main() is of type int -# -# When in doubt, try MAIN= -DMAIN=int. If you get a warning try the other. -# -#MAIN= -DMAIN=void -MAIN= -DMAIN=int - # where to install binary files # BINDIR= /usr/local/bin @@ -514,7 +502,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -545,7 +533,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -577,7 +565,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= # #LCFLAGS= @@ -603,7 +591,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -623,7 +611,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -646,7 +634,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -669,7 +657,7 @@ ALLOW_CUSTOM= -DCUSTOM #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -692,7 +680,7 @@ CCMISC= CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} ICFLAGS= ${CCWARN} ${CCMISC} # -CCMAIN= ${ICFLAGS} ${MAIN} +CCMAIN= ${ICFLAGS} CCSHS= ${CFLAGS} # LCFLAGS= @@ -715,7 +703,7 @@ CC= ${PURIFY} gcc #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} ${MAIN} +#CCMAIN= ${ICFLAGS} #CCSHS= ${CFLAGS} # #LCFLAGS= @@ -889,7 +877,6 @@ SAMPLE_PASSDOWN= Q="${Q}" \ TOPDIR="${TOPDIR}" \ LIBDIR="${LIBDIR}" \ HELPDIR="${HELPDIR}" \ - MAIN="${MAIN}" \ DEBUG="${DEBUG}" \ NO_SHARED="${NO_SHARED}" \ RANLIB="${RANLIB}" \ @@ -2203,7 +2190,6 @@ env: @echo "HAVE_UID_T=${HAVE_UID_T}"; echo "" @echo "HAVE_NEWSTR=${HAVE_NEWSTR}"; echo "" @echo "ALIGN32=${ALIGN32}"; echo "" - @echo "MAIN=${MAIN}"; echo "" @echo "BINDIR=${BINDIR}"; echo "" @echo "TOPDIR=${TOPDIR}"; echo "" @echo "LIBDIR=${LIBDIR}"; echo "" diff --git a/align32.c b/align32.c index 36c3863..172cb71 100644 --- a/align32.c +++ b/align32.c @@ -30,7 +30,7 @@ static void buserr(void); /* catch alignment errors */ -MAIN +int main(void) { char byte[2*sizeof(USB32)]; /* mis-alignment buffer */ @@ -58,7 +58,8 @@ main(void) '/', '/'); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/calc.c b/calc.c index 7357886..03fd214 100644 --- a/calc.c +++ b/calc.c @@ -67,7 +67,7 @@ static void intint(int arg); /* interrupt routine */ /* * Top level calculator routine. */ -MAIN +int main(int argc, char **argv) { static char *str; /* current option string or expression */ @@ -301,8 +301,8 @@ main(int argc, char **argv) * all done */ libcalc_call_me_last(); - exit(0); - /*NOTREACHED*/ + /* exit(0); */ + return 0; } diff --git a/endian.c b/endian.c index 893ea10..da0a32e 100644 --- a/endian.c +++ b/endian.c @@ -39,41 +39,42 @@ char byte[8] = { (char)0x12, (char)0x36, (char)0x48, (char)0x59, (char)0x01, (char)0x23, (char)0x45, (char)0x67 }; -MAIN +int main(void) { - /* pointers into the byte order array */ - int *intp = (int *)byte; + /* pointers into the byte order array */ + int *intp = (int *)byte; #if defined(DEBUG) - short *shortp = (short *)byte; - long *longp = (long *)byte; + short *shortp = (short *)byte; + long *longp = (long *)byte; - printf("byte: %02x %02x %02x %02x %02x %02x %02x %02x\n", - byte[0], byte[1], byte[2], byte[3], - byte[4], byte[5], byte[6], byte[7]); - printf("short: %04x %04x %04x %04x\n", - shortp[0], shortp[1], shortp[2], shortp[3]); - printf("int: %08x %08x\n", - intp[0], intp[1]); - printf("long: %08x %08x\n", - longp[0], longp[1]); + printf("byte: %02x %02x %02x %02x %02x %02x %02x %02x\n", + byte[0], byte[1], byte[2], byte[3], + byte[4], byte[5], byte[6], byte[7]); + printf("short: %04x %04x %04x %04x\n", + shortp[0], shortp[1], shortp[2], shortp[3]); + printf("int: %08x %08x\n", + intp[0], intp[1]); + printf("long: %08x %08x\n", + longp[0], longp[1]); #endif - /* Print the standard defines */ - printf("#define BIG_ENDIAN\t4321\n"); - printf("#define LITTLE_ENDIAN\t1234\n"); + /* Print the standard defines */ + printf("#define BIG_ENDIAN\t4321\n"); + printf("#define LITTLE_ENDIAN\t1234\n"); - /* Determine byte order */ - if (intp[0] == 0x12364859) { - /* Most Significant Byte first */ - printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n"); - } else if (intp[0] == 0x59483612) { - /* Least Significant Byte first */ - printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n"); - } else { - fprintf(stderr, - "Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n"); - exit(1); - } - exit(0); + /* Determine byte order */ + if (intp[0] == 0x12364859) { + /* Most Significant Byte first */ + printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n"); + } else if (intp[0] == 0x59483612) { + /* Least Significant Byte first */ + printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n"); + } else { + fprintf(stderr, + "Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n"); + exit(1); + } + /* exit(0); */ + return 0; } diff --git a/file.c b/file.c index d2d2f22..5d67944 100644 --- a/file.c +++ b/file.c @@ -1980,11 +1980,11 @@ fscanfile(FILE *fp, char *fmt, int count, VALUE **vals) for (;;) { for (;;) { f = *fmt++; - if (isspace(f)) { + if (isspace((int)f)) { getscanwhite(fp,1,0,6,NULL); do { f = *fmt++; - } while (isspace(f)); + } while (isspace((int)f)); } c = fgetc(fp); if (c == EOF) diff --git a/fposval.c b/fposval.c index 658ab3a..dff42df 100644 --- a/fposval.c +++ b/fposval.c @@ -60,7 +60,7 @@ char *program; /* our name */ -MAIN +int main(int argc, char **argv) { int stsizelen; /* bit length of st_size in buf */ @@ -225,5 +225,6 @@ main(int argc, char **argv) printf("#define SWAP_HALF_IN_INODE(dest, src)\t%s%d%s\n", "memcpy((void *)(dest), (void *)(src), sizeof(",inodelen,"))"); #endif /* CALC_BYTE_ORDER == BIG_ENDIAN */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/func.c b/func.c index 1b0b10f..ce8afda 100644 --- a/func.c +++ b/func.c @@ -10,6 +10,7 @@ #include #include #include +#include #if defined(FUNCLIST) @@ -77,9 +78,6 @@ static VALUE f_fsize(VALUE *vp); /* * external declarations */ -extern int errno; /* last system error */ -extern const char *const sys_errlist[]; /* system error messages */ -extern int sys_nerr; /* number of system errors */ extern char cmdbuf[]; /* command line expression */ extern CONST char *error_table[E__COUNT+2]; /* calc coded error messages */ extern void matrandperm(MATRIX *M); @@ -4838,14 +4836,14 @@ strscan(char *s, int count, VALUE **vals) while (*s != '\0') { s--; while ((ch = *++s)) { - if (!isspace(ch)) + if (!isspace((int)ch)) break; } if (ch == '\0' || count-- == 0) return n; s0 = s; while ((ch = *++s)) { - if (isspace(ch)) + if (isspace((int)ch)) break; } chtmp = ch; diff --git a/have_const.c b/have_const.c index 3173d78..eaa585f 100644 --- a/have_const.c +++ b/have_const.c @@ -42,7 +42,7 @@ #include -MAIN +int main(void) { #if defined(HAVE_NO_CONST) @@ -56,5 +56,6 @@ main(void) printf("#undef CONST\n"); printf("#define CONST %s /* yes */\n", str); #endif /* HAVE_NO_CONST */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_fpos.c b/have_fpos.c index 46fcc9a..08f5a0f 100644 --- a/have_fpos.c +++ b/have_fpos.c @@ -32,22 +32,23 @@ #include -MAIN +int main(void) { #if !defined(HAVE_NO_FPOS) - fpos_t pos; /* file position */ + fpos_t pos; /* file position */ - /* get the current position */ - (void) fgetpos(stdin, &pos); + /* get the current position */ + (void) fgetpos(stdin, &pos); - /* set the current position */ - (void) fsetpos(stdin, &pos); + /* set the current position */ + (void) fsetpos(stdin, &pos); - /* print a have_fpos.h body that says we have the functions */ - printf("#undef HAVE_FPOS\n"); - printf("#define HAVE_FPOS 1 /* yes */\n\n"); - printf("typedef fpos_t FILEPOS;\n"); + /* print a have_fpos.h body that says we have the functions */ + printf("#undef HAVE_FPOS\n"); + printf("#define HAVE_FPOS 1 /* yes */\n\n"); + printf("typedef fpos_t FILEPOS;\n"); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_memmv.c b/have_memmv.c index 88bfbe5..72a48ca 100644 --- a/have_memmv.c +++ b/have_memmv.c @@ -44,7 +44,7 @@ char src[] = "chongo was here"; char dest[MOVELEN+1]; -MAIN +int main(void) { #if defined(HAVE_NO_MEMMOVE) @@ -54,5 +54,6 @@ main(void) printf("#define HAVE_MEMMOVE /* yes */\n"); #endif /* HAVE_NO_MEMMOVE */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_newstr.c b/have_newstr.c index 95e4909..e3261a5 100644 --- a/have_newstr.c +++ b/have_newstr.c @@ -46,7 +46,7 @@ char src[] = "chongo was here"; char dest[MOVELEN+1]; -MAIN +int main(void) { #if defined(HAVE_NO_NEWSTR) @@ -58,5 +58,6 @@ main(void) printf("#define HAVE_NEWSTR /* yes */\n"); #endif /* HAVE_NO_NEWSTR */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_offscl.c b/have_offscl.c index 36fb344..e668349 100644 --- a/have_offscl.c +++ b/have_offscl.c @@ -45,7 +45,7 @@ #include #include -MAIN +int main(void) { #if !defined(OFF_T_NON_SCALAR) @@ -79,5 +79,6 @@ main(void) #else printf("#undef HAVE_OFF_T_SCALAR /* off_t is not a simple value */\n"); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_posscl.c b/have_posscl.c index b07034a..6e732e1 100644 --- a/have_posscl.c +++ b/have_posscl.c @@ -46,7 +46,7 @@ #include #include "have_fpos.h" -MAIN +int main(void) { #if !defined(FILEPOS_NON_SCALAR) @@ -80,5 +80,6 @@ main(void) #else printf("#undef HAVE_FILEPOS_SCALAR /* FILEPOS is not a simple value */\n"); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_stdvs.c b/have_stdvs.c index 551e0a6..b50f110 100644 --- a/have_stdvs.c +++ b/have_stdvs.c @@ -56,84 +56,86 @@ char buf[BUFSIZ]; void try(char *fmt, ...) { - va_list ap; + va_list ap; - va_start(ap, fmt); + va_start(ap, fmt); #if !defined(DONT_HAVE_VSPRINTF) - vsprintf(buf, fmt, ap); + vsprintf(buf, fmt, ap); #else - sprintf(buf, fmt, ap); + sprintf(buf, fmt, ap); #endif - va_end(ap); + va_end(ap); } -MAIN +int main(void) { - /* - * setup - */ - buf[0] = '\0'; + /* + * setup + */ + buf[0] = '\0'; - /* - * test variable args and vsprintf/sprintf - */ - try("@%d:%s:%d@", 1, "hi", 2); - if (strcmp(buf, "@1:hi:2@") != 0) { + /* + * test variable args and vsprintf/sprintf + */ + try("@%d:%s:%d@", 1, "hi", 2); + if (strcmp(buf, "@1:hi:2@") != 0) { #if !defined(DONT_HAVE_VSPRINTF) - /* with vsprintf() didn't work */ + /* with vsprintf() didn't work */ #else - /* with sprintf() simulating vsprintf() didn't work */ + /* with sprintf() simulating vsprintf() didn't work */ #endif - exit(1); - } - try("%s %d%s%d%d %s", - "Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime"); - if (strcmp(buf, "Landon Noll 1st proved that 2^23209-1 was prime") != 0) { + exit(1); + } + try("%s %d%s%d%d %s", + "Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime"); + if (strcmp(buf, + "Landon Noll 1st proved that 2^23209-1 was prime") != 0) { #if !defined(DONT_HAVE_VSPRINTF) - /* with vsprintf() didn't work */ + /* with vsprintf() didn't work */ #else - /* with sprintf() simulating vsprintf() didn't work */ + /* with sprintf() simulating vsprintf() didn't work */ #endif - exit(1); - } + exit(1); + } - /* - * report the result - */ - puts("/* what type of variable args do we have? */"); + /* + * report the result + */ + puts("/* what type of variable args do we have? */"); #if defined(DONT_HAVE_VSPRINTF) - puts("/*"); - puts(" * SIMULATE_STDARG"); - puts(" *"); - puts(" * WARNING: This type of stdarg makes assumptions about the stack"); - puts(" * that may not be true on your system. You may want to"); - puts(" * define STDARG (if using ANSI C) or VARARGS."); - puts(" */"); - puts("typedef char *va_list;"); - puts("#define va_start(ap,parmn) (void)((ap) = (char*)(&(parmn) + 1))"); - puts("#define va_end(ap) (void)((ap) = 0)"); - puts("#define va_arg(ap, type) \\"); - puts(" (((type*)((ap) = ((ap) + sizeof(type))))[-1])"); - puts("#define SIMULATE_STDARG /* use std_arg.h to simulate */"); + puts("/*"); + puts(" * SIMULATE_STDARG"); + puts(" *"); + puts(" * WARNING: This type of stdarg makes assumptions about the stack"); + puts(" * that may not be true on your system. You may want to"); + puts(" * define STDARG (if using ANSI C) or VARARGS."); + puts(" */"); + puts("typedef char *va_list;"); + puts("#define va_start(ap,parmn) (void)((ap) = (char*)(&(parmn) + 1))"); + puts("#define va_end(ap) (void)((ap) = 0)"); + puts("#define va_arg(ap, type) \\"); + puts(" (((type*)((ap) = ((ap) + sizeof(type))))[-1])"); + puts("#define SIMULATE_STDARG /* use std_arg.h to simulate */"); #else - puts("#define STDARG /* use */"); - puts("#include "); + puts("#define STDARG /* use */"); + puts("#include "); #endif - puts("\n/* should we use vsprintf()? */"); + puts("\n/* should we use vsprintf()? */"); #if !defined(DONT_HAVE_VSPRINTF) - puts("#define HAVE_VS /* yes */"); + puts("#define HAVE_VS /* yes */"); #else - puts("/*"); - puts(" * Hack aleart!!!"); - puts(" *"); - puts(" * Systems that do not have vsprintf() need something. In some"); - puts(" * cases the sprintf function will deal correctly with the"); - puts(" * va_alist 3rd arg. Hope for the best!"); - puts(" */"); - puts("#define vsprintf sprintf"); - puts("#undef HAVE_VS"); + puts("/*"); + puts(" * Hack aleart!!!"); + puts(" *"); + puts(" * Systems that do not have vsprintf() need something. In some"); + puts(" * cases the sprintf function will deal correctly with the"); + puts(" * va_alist 3rd arg. Hope for the best!"); + puts(" */"); + puts("#define vsprintf sprintf"); + puts("#undef HAVE_VS"); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_uid_t.c b/have_uid_t.c index 88807a4..cf253ea 100644 --- a/have_uid_t.c +++ b/have_uid_t.c @@ -47,7 +47,7 @@ #include #endif /* ! HAVE_NO_UID_T */ -MAIN +int main(void) { #if defined(HAVE_NO_UID_T) @@ -60,5 +60,6 @@ main(void) printf("#define HAVE_UID_T /* yes */\n"); #endif /* HAVE_NO_UID_T */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/have_varvs.c b/have_varvs.c index 58b8fb5..368e96a 100644 --- a/have_varvs.c +++ b/have_varvs.c @@ -76,56 +76,58 @@ try(char *a, int b, char *c, int d) #endif -MAIN +int main(void) { - /* - * setup - */ - buf[0] = '\0'; + /* + * setup + */ + buf[0] = '\0'; - /* - * test variable args and vsprintf/sprintf - */ - try("@%d:%s:%d@", 1, "hi", 2); - if (strcmp(buf, "@1:hi:2@") != 0) { + /* + * test variable args and vsprintf/sprintf + */ + try("@%d:%s:%d@", 1, "hi", 2); + if (strcmp(buf, "@1:hi:2@") != 0) { #if !defined(DONT_HAVE_VSPRINTF) - /* with vsprintf() didn't work */ + /* with vsprintf() didn't work */ #else - /* with sprintf() simulating vsprintf() didn't work */ + /* with sprintf() simulating vsprintf() didn't work */ #endif - exit(1); - } - try("%s %d%s%d%d %s", - "Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime"); - if (strcmp(buf, "Landon Noll 1st proved that 2^23209-1 was prime") != 0) { + exit(1); + } + try("%s %d%s%d%d %s", + "Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime"); + if (strcmp(buf, + "Landon Noll 1st proved that 2^23209-1 was prime") != 0) { #if !defined(DONT_HAVE_VSPRINTF) - /* with vsprintf() didn't work */ + /* with vsprintf() didn't work */ #else - /* with sprintf() simulating vsprintf() didn't work */ + /* with sprintf() simulating vsprintf() didn't work */ #endif - exit(1); - } + exit(1); + } - /* - * report the result - */ - puts("/* what type of variable args do we have? */"); - puts("#define VARARGS /* use */"); - puts("#include "); - puts("\n/* should we use vsprintf()? */"); + /* + * report the result + */ + puts("/* what type of variable args do we have? */"); + puts("#define VARARGS /* use */"); + puts("#include "); + puts("\n/* should we use vsprintf()? */"); #if !defined(DONT_HAVE_VSPRINTF) - puts("#define HAVE_VS /* yes */"); + puts("#define HAVE_VS /* yes */"); #else - puts("/*"); - puts(" * Hack aleart!!!"); - puts(" *"); - puts(" * Systems that do not have vsprintf() need something. In some"); - puts(" * cases the sprintf function will deal correctly with the"); - puts(" * va_alist 3rd arg. Hope for the best!"); - puts(" */"); - puts("#define vsprintf sprintf"); - puts("#undef HAVE_VS"); + puts("/*"); + puts(" * Hack aleart!!!"); + puts(" *"); + puts(" * Systems that do not have vsprintf() need something. In some"); + puts(" * cases the sprintf function will deal correctly with the"); + puts(" * va_alist 3rd arg. Hope for the best!"); + puts(" */"); + puts("#define vsprintf sprintf"); + puts("#undef HAVE_VS"); #endif - exit(0); + /* exit(0); */ + return 0; } diff --git a/hist.c b/hist.c index 0239965..6e99bd1 100644 --- a/hist.c +++ b/hist.c @@ -421,12 +421,12 @@ do_map_line(char *line) char *map_name; cp = line; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; if (*cp == '\0') return NULL; map_name = cp; - while ((*cp != '\0') && !isspace(*cp)) + while ((*cp != '\0') && !isspace((int)*cp)) cp++; *cp = '\0'; return find_map(map_name); @@ -461,7 +461,7 @@ do_bind_line(KEY_MAP *map, char *line) else if (key == '\\') key = *cp++; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; if (*cp == '\0') { unbind_key(map, key); @@ -469,11 +469,11 @@ do_bind_line(KEY_MAP *map, char *line) } func_name = cp; - while ((*cp != '\0') && !isspace(*cp)) + while ((*cp != '\0') && !isspace((int)*cp)) cp++; if (*cp) { *cp++ = '\0'; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; } func = find_func(func_name); @@ -488,11 +488,11 @@ do_bind_line(KEY_MAP *map, char *line) next = base_map; } else { next_name = cp; - while ((*cp != '\0') && !isspace(*cp)) + while ((*cp != '\0') && !isspace((int)*cp)) cp++; if (*cp) { *cp++ = '\0'; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; } next = find_map(next_name); @@ -515,18 +515,18 @@ do_default_line(KEY_MAP *map, char *line) if (map == NULL) return; cp = line; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; if (*cp == '\0') return; func_name = cp; - while ((*cp != '\0') && !isspace(*cp)) + while ((*cp != '\0') && !isspace((int)*cp)) cp++; if (*cp != '\0') { *cp++ = '\0'; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; } func = find_func(func_name); @@ -538,12 +538,12 @@ do_default_line(KEY_MAP *map, char *line) else { next_name = cp; - while ((*cp != '\0') && !isspace(*cp)) + while ((*cp != '\0') && !isspace((int)*cp)) cp++; if (*cp != '\0') { *cp++ = '\0'; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; } next = find_map(next_name); @@ -577,7 +577,7 @@ read_bindings(FILE *fp) while (fgets(line, sizeof(line) - 1, fp)) { cp = line; - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; if ((*cp == '\0') || (*cp == '#') || (*cp == '\n')) diff --git a/longbits.c b/longbits.c index 9b8d6ac..308c684 100644 --- a/longbits.c +++ b/longbits.c @@ -105,7 +105,7 @@ char *program; /* our name */ -MAIN +int main(int argc, char **argv) { int exitcode = 0; /* how we will exit */ @@ -124,7 +124,7 @@ main(int argc, char **argv) case 2: /* ignore empty or leading space args */ if (argv[1][0] == '\0' || - (isascii(argv[1][0]) && isspace(argv[1][0]))) { + (isascii((int)argv[1][0]) && isspace((int)argv[1][0]))) { long_bits = sizeof(long)*8; /* process the forced size arg */ } else { @@ -362,5 +362,6 @@ main(int argc, char **argv) } /* all done */ - exit(exitcode); + /* exit(exitcode); */ + return exitcode; } diff --git a/longlong.c b/longlong.c index 98522eb..f683d7e 100644 --- a/longlong.c +++ b/longlong.c @@ -66,7 +66,7 @@ unsigned long long val = 4294967297ULL; long long val2 = -4294967297LL; -MAIN +int main(int argc, char **argv) { int longlong_bits; /* bits in a long long, or <=0 => dont use */ @@ -100,5 +100,6 @@ main(int argc, char **argv) longlong_bits); } } - exit(0); + /* exit(0); */ + return 0; } diff --git a/sample/Makefile b/sample/Makefile index 42cf4d5..46d9584 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -95,18 +95,6 @@ TOPDIR= /usr/local/lib LIBDIR= ${TOPDIR}/calc HELPDIR= ${LIBDIR}/help -# The return value type of main() differs from platform to platform. -# In some cases, a compiler warning is issued because main() does -# or does not return a value. -# -# MAIN= -DMAIN=void main() is of type void -# MAIN= -DMAIN=int main() is of type int -# -# When in doubt, try MAIN= -DMAIN=void. If you get a warning try the other. -# -MAIN= -DMAIN=void -#MAIN= -DMAIN=int - # Normally, the upper level makefile will set these values. We provide # a default here just in case you want to build from this directory. # @@ -251,7 +239,7 @@ CCMISC= CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} ${ALLOW_CUSTOM} ICFLAGS= ${CCWARN} ${CCMISC} # -CCMAIN= ${ICFLAGS} ${MAIN} +CCMAIN= ${ICFLAGS} # LCFLAGS= LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} diff --git a/sample/many_random.c b/sample/many_random.c index 273d0bc..cae1769 100644 --- a/sample/many_random.c +++ b/sample/many_random.c @@ -59,7 +59,7 @@ typedef struct { extern char *program; /* our name */ -MAIN +int main(int argc, char **argv) { RANDOM *prev_state; /* previous random number state */ @@ -176,5 +176,6 @@ main(int argc, char **argv) /* * all done */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/sample/test_random.c b/sample/test_random.c index ae60410..c1ecb31 100644 --- a/sample/test_random.c +++ b/sample/test_random.c @@ -57,7 +57,7 @@ typedef struct { extern char *program; /* our name */ -MAIN +int main(int argc, char **argv) { RANDOM *prev_state; /* previous random number state */ @@ -121,5 +121,6 @@ main(int argc, char **argv) /* * all done */ - exit(0); + /* exit(0); */ + return 0; } diff --git a/version.c b/version.c index feb9782..681021c 100644 --- a/version.c +++ b/version.c @@ -12,7 +12,7 @@ #define MAJOR_VER 2 /* major version */ #define MINOR_VER 11 /* minor version */ #define MAJOR_PATCH 0 /* patch level or 0 if no patch */ -#define MINOR_PATCH "0" /* test number or empty string if no patch */ +#define MINOR_PATCH "1" /* test number or empty string if no patch */ /* * calc version constants