From 2251281027ea099874927bec18107aa3d1512451 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 16 Oct 1999 09:51:59 -0700 Subject: [PATCH] Release calc version 2.11.0t7.4 --- CHANGES | 6 +++++ Makefile | 68 +++++++++++++++++-------------------------------- sample/Makefile | 31 +++++++++++----------- seed.c | 14 +++++++--- version.c | 2 +- 5 files changed, 56 insertions(+), 65 deletions(-) diff --git a/CHANGES b/CHANGES index bb23973..4f53255 100644 --- a/CHANGES +++ b/CHANGES @@ -133,6 +133,12 @@ Following is the change from calc version 2.11.0t7 to date: Fixed memory leaks realted to srandom(). + Fixed compilation warnings and problems on BSDI. + + Removed ${CCMAIN} as a variable from the Makefile. Now files + use either ${CFLAGS} for general C source and ${ICFLAGS} for + intermediate C source (e.g., special code for building hsrc files). + Misc calc man page fixes. diff --git a/Makefile b/Makefile index 7f98db3..baff166 100644 --- a/Makefile +++ b/Makefile @@ -516,8 +516,6 @@ ALLOW_CUSTOM= -DCUSTOM # CFLAGS are all flags given to ${CC} [[often includes CCOPT, CCWARN, CCMISC]] # ICFLAGS are given to ${CC} for intermediate progs # -# CCMAIN are flags for ${CC} when files with main() instead of CFLAGS -# # LCFLAGS are CC-style flags for ${LINT} # LDFLAGS are flags given to ${CC} for linking .o files # ILDFLAGS are flags given to ${CC} for linking .o files for intermediate progs @@ -541,8 +539,6 @@ CCMISC= CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} ICFLAGS= ${CCWARN} ${CCMISC} # -CCMAIN= ${ICFLAGS} -# LCFLAGS= LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} ILDFLAGS= @@ -564,8 +560,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -585,8 +579,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -617,8 +609,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -643,8 +633,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -663,8 +651,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -689,8 +675,6 @@ CC= ${PURIFY} ${LCC} #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} #ICFLAGS= ${CCWARN} ${CCMISC} # -#CCMAIN= ${ICFLAGS} -# #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} #ILDFLAGS= @@ -710,9 +694,7 @@ CC= ${PURIFY} ${LCC} #CCMISC= # #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} -#ICFLAGS= ${CCWARN} ${CCMISC} -# -#CCMAIN= ${ICFLAGS} +#ICFLAGS= ${CCWARN} ${CCMISC} -Wno-unused # #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} @@ -733,9 +715,7 @@ CC= ${PURIFY} ${LCC} #CCMISC= # #CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} -#ICFLAGS= ${CCWARN} ${CCMISC} -# -#CCMAIN= ${ICFLAGS} +#ICFLAGS= ${CCWARN} ${CCMISC} -Wno-unused # #LCFLAGS= #LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} @@ -920,7 +900,6 @@ SAMPLE_PASSDOWN= Q="${Q}" \ CCMISC="${CCMISC}" \ CFLAGS="${CFLAGS} ${ALLOW_CUSTOM}" \ ICFLAGS="${ICFLAGS}" \ - CCMAIN="${CCMAIN}" \ LCFLAGS="${LCFLAGS}" \ LDFLAGS="${LDFLAGS}" \ ILDFLAGS="${ILDFLAGS}" \ @@ -993,7 +972,7 @@ calc.1: calc.man ${MAKE_FILE} ## calc.o: calc.c ${MAKE_FILE} - ${CC} ${CCMAIN} ${CCOPT} ${ALLOW_CUSTOM} -c calc.c + ${CC} ${CFLAGS} ${CCOPT} ${ALLOW_CUSTOM} -c calc.c custom.o: custom.c ${MAKE_FILE} ${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c custom.c @@ -1391,7 +1370,7 @@ longlong.h: longlong.c have_stdlib.h have_string.h ${MAKE_FILE} ${Q}echo '' >> longlong.h ${Q}echo '/* do we have/want to use a long long type? */' >> longlong.h -${Q}rm -f longlong.o longlong - -${Q}${LCC} ${CCMAIN} longlong.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} longlong.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} longlong.o -o longlong 2>/dev/null; true -${Q}${SHELL} -c "./longlong ${LONGLONG_BITS} > ll_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1430,7 +1409,7 @@ have_fpos.h: have_fpos.c ${MAKE_FILE} ${Q}echo '' >> have_fpos.h ${Q}echo '/* do we have fgetpos & fsetpos functions? */' >> have_fpos.h -${Q}rm -f have_fpos.o have_fpos - -${Q}${LCC} ${HAVE_FPOS} ${CCMAIN} have_fpos.c -c 2>/dev/null; true + -${Q}${LCC} ${HAVE_FPOS} ${ICFLAGS} have_fpos.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_fpos.o -o have_fpos 2>/dev/null; true -${Q}${SHELL} -c "./have_fpos > fpos_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1471,7 +1450,7 @@ fposval.h: fposval.c have_fpos.h have_offscl.h have_posscl.h \ ${Q}echo '' >> fposval.h ${Q}echo '/* what are our file position & size types? */' >> fposval.h -${Q}rm -f fposval.o fposval - -${Q}${LCC} ${CCMAIN} fposval.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} fposval.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} fposval.o -o fposval 2>/dev/null; true ${Q}${SHELL} -c "./fposval fposv_tmp >> fposval.h 2>/dev/null" \ >/dev/null 2>&1; true @@ -1504,7 +1483,7 @@ have_const.h: have_const.c ${MAKE_FILE} ${Q}echo '' >> have_const.h ${Q}echo '/* do we have or want const? */' >> have_const.h -${Q}rm -f have_const.o have_const - -${Q}${LCC} ${CCMAIN} ${HAVE_CONST} have_const.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_CONST} have_const.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_const.o -o have_const 2>/dev/null; true -${Q}${SHELL} -c "./have_const > const_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1543,7 +1522,7 @@ have_offscl.h: have_offscl.c ${MAKE_FILE} ${Q}echo '' >> have_offscl.h ${Q}echo '' >> have_offscl.h -${Q}rm -f have_offscl.o have_offscl - -${Q}${LCC} ${CCMAIN} ${HAVE_OFFSCL} have_offscl.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_OFFSCL} have_offscl.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_offscl.o -o have_offscl 2>/dev/null; true -${Q}${SHELL} -c "./have_offscl > offscl_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1581,7 +1560,7 @@ have_posscl.h: have_posscl.c have_fpos.h ${MAKE_FILE} ${Q}echo '' >> have_posscl.h ${Q}echo '' >> have_posscl.h -${Q}rm -f have_posscl.o have_posscl - -${Q}${LCC} ${CCMAIN} ${HAVE_POSSCL} have_posscl.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_POSSCL} have_posscl.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_posscl.o -o have_posscl 2>/dev/null; true -${Q}${SHELL} -c "./have_posscl > posscl_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1633,7 +1612,7 @@ align32.h: align32.c longbits.h have_unistd.h ${MAKE_FILE} fi -${Q}if [ X = X${ALIGN32} ]; then \ rm -f align32.o align32; \ - ${LCC} ${CCMAIN} ${ALIGN32} align32.c -c 2>/dev/null; \ + ${LCC} ${ICFLAGS} ${ALIGN32} align32.c -c 2>/dev/null; \ ${LCC} ${ILDFLAGS} align32.o -o align32 2>/dev/null; \ ${SHELL} -c "./align32 >align32_tmp 2>/dev/null" >/dev/null 2>&1; \ if [ -s align32_tmp ]; then \ @@ -1674,7 +1653,7 @@ have_uid_t.h: have_uid_t.c have_unistd.h ${MAKE_FILE} ${Q}echo '' >> have_uid_t.h ${Q}echo '/* do we have or want uid_t? */' >> have_uid_t.h -${Q}rm -f have_uid_t.o have_uid_t - -${Q}${LCC} ${CCMAIN} ${HAVE_UID_T} have_uid_t.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_UID_T} have_uid_t.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_uid_t.o -o have_uid_t 2>/dev/null; true -${Q}${SHELL} -c "./have_uid_t > uid_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1713,7 +1692,7 @@ have_newstr.h: have_newstr.c ${MAKE_FILE} ${Q}echo '/* do we have or want memcpy(), memset() & strchr()? */' \ >> have_newstr.h -${Q}rm -f have_newstr.o have_newstr - -${Q}${LCC} ${CCMAIN} ${HAVE_NEWSTR} have_newstr.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_NEWSTR} have_newstr.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_newstr.o -o have_newstr 2>/dev/null; true -${Q}${SHELL} -c "./have_newstr > newstr_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1751,7 +1730,7 @@ have_memmv.h: have_memmv.c ${MAKE_FILE} ${Q}echo '' >> have_memmv.h ${Q}echo '/* do we have or want memmove()? */' >> have_memmv.h -${Q}rm -f have_memmv.o have_memmv - -${Q}${LCC} ${CCMAIN} ${HAVE_MEMMOVE} have_memmv.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_MEMMOVE} have_memmv.c -c 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_memmv.o -o have_memmv 2>/dev/null; true -${Q}${SHELL} -c "./have_memmv > newstr_tmp 2>/dev/null" \ >/dev/null 2>&1; true @@ -1788,7 +1767,8 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h ${Q}echo '' >> args.h ${Q}echo '' >> args.h -${Q}rm -f have_stdvs.o have_stdvs - -${Q}${LCC} ${CCMAIN} ${HAVE_VSPRINTF} have_stdvs.c -c 2>/dev/null; true + -${Q}${LCC} ${ICFLAGS} ${HAVE_VSPRINTF} have_stdvs.c -c \ + 2>/dev/null; true -${Q}${LCC} ${ILDFLAGS} have_stdvs.o -o have_stdvs 2>/dev/null; true -${Q}if ./have_stdvs >>args.h 2>/dev/null; then \ touch have_args; \ @@ -1797,7 +1777,8 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h fi -${Q}if [ ! -f have_args ] && [ X"${HAVE_VSPRINTF}" = X ]; then \ rm -f have_stdvs.o have_stdvs have_varvs.o have_varvs; \ - ${LCC} ${CCMAIN} -DDONT_HAVE_VSPRINTF have_varvs.c -c 2>/dev/null; \ + ${LCC} ${ICFLAGS} -DDONT_HAVE_VSPRINTF have_varvs.c -c \ + 2>/dev/null; \ ${LCC} ${ILDFLAGS} have_varvs.o -o have_varvs 2>/dev/null; \ if ./have_varvs >>args.h 2>/dev/null; then \ touch have_args; \ @@ -1877,17 +1858,17 @@ calc_errno.h: calc_errno.c ${MAKE_FILE} echo 'extern int sys_nerr; ' \ '/* number of system errors */' >> calc_errno.h; \ else \ - ${LCC} ${CCMAIN} -DTRY_ERRNO_NO_DECL \ + ${LCC} ${ICFLAGS} -DTRY_ERRNO_NO_DECL \ calc_errno.c -o calc_errno 2>calc_errno_tmp; \ if [ -x ./calc_errno ]; then \ ./calc_errno >> calc_errno.h; \ else \ - ${LCC} ${CCMAIN} -DTRY_ERRNO_STD_DECL \ + ${LCC} ${ICFLAGS} -DTRY_ERRNO_STD_DECL \ calc_errno.c -o calc_errno 2>calc_errno_tmp; \ if [ -x ./calc_errno ]; then \ ./calc_errno >> calc_errno.h; \ else \ - ${LCC} ${CCMAIN} -DTRY_ERRNO_OLD_DECL \ + ${LCC} ${ICFLAGS} -DTRY_ERRNO_OLD_DECL \ calc_errno.c -o calc_errno 2>calc_errno_tmp; \ if [ -x ./calc_errno ]; then \ ./calc_errno >> calc_errno.h; \ @@ -1983,16 +1964,16 @@ calcerr.c: calcerr.tbl calcerr_c.sed calcerr_c.awk ${MAKE_FILE} ## endian.o: endian.c have_unistd.h - ${LCC} ${CCMAIN} endian.c -c + ${LCC} ${ICFLAGS} endian.c -c endian: endian.o - ${LCC} ${ILDFLAGS} endian.o -o endian + ${LCC} ${ICFLAGS} endian.o -o endian longbits.o: longbits.c longlong.h have_unistd.h - ${LCC} ${CCMAIN} longbits.c -c + ${LCC} ${ICFLAGS} longbits.c -c longbits: longbits.o - ${LCC} ${ILDFLAGS} longbits.o -o longbits + ${LCC} ${ICFLAGS} longbits.o -o longbits ## # @@ -2344,7 +2325,6 @@ env: @echo "CCMISC=${CCMISC}"; echo "" @echo "CFLAGS=${CFLAGS}"; echo "" @echo "ICFLAGS=${ICFLAGS}"; echo "" - @echo "CCMAIN=${CCMAIN}"; echo "" @echo "LCFLAGS=${LCFLAGS}"; echo "" @echo "LDFLAGS=${LDFLAGS}"; echo "" @echo "ILDFLAGS=${ILDFLAGS}"; echo "" diff --git a/sample/Makefile b/sample/Makefile index 46d9584..5d980d1 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -208,11 +208,6 @@ CALC_LIBS= ../libcalc.a ../custom/libcustcalc.a ### # -# Normally, the upper level makefile will set these values. We provide -# a default here just in case you want to build from this directory. -# -# Select your compiler type by commenting out one of the cc sets below: -# # CCOPT are flags given to ${CC} for optimization # CCWARN are flags given to ${CC} for warning message control # CCMISC are misc flags given to ${CC} @@ -220,32 +215,36 @@ CALC_LIBS= ../libcalc.a ../custom/libcustcalc.a # CFLAGS are all flags given to ${CC} [[often includes CCOPT, CCWARN, CCMISC]] # ICFLAGS are given to ${CC} for intermediate progs # -# CCMAIN are flags for ${CC} when files with main() instead of CFLAGS -# # LCFLAGS are CC-style flags for ${LINT} # LDFLAGS are flags given to ${CC} for linking .o files # ILDFLAGS are flags given to ${CC} for linking .o files for intermediate progs # -# CC is how the the C compiler is invoked +# LCC how the the C compiler is invoked on locally executed intermediate progs +# CC is how the the C compiler is invoked (with an optional Purify) # ### # -# common cc set +# default set # -CCWARN= +# Normally these values are passed in from the upper level Makefile. +# Change these as needed if you intend to build directly in this directory. +# +# for better performance, set the following above: +# DEBUG= -O2 +# +CCWARN= -Wall -Wno-implicit -Wno-comment CCOPT= ${DEBUG} ${NO_SHARED} CCMISC= # -CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} ${ALLOW_CUSTOM} +CFLAGS= ${CCWARN} ${CCOPT} ${CCMISC} ICFLAGS= ${CCWARN} ${CCMISC} # -CCMAIN= ${ICFLAGS} -# LCFLAGS= LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} ILDFLAGS= # -CC= ${PURIFY} cc +LCC= gcc +CC= ${PURIFY} ${LCC} ############################################################################## #-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-# @@ -286,13 +285,13 @@ SORT= sort all: ${TARGETS} .all test_random.o: test_random.c - ${CC} ${CCMAIN} ${CCOPT} ${ALLOW_CUSTOM} test_random.c -c + ${CC} ${CFLAGS} ${ALLOW_CUSTOM} test_random.c -c test_random: test_random.o ../libcalc.a ${CC} ${LDFLAGS} test_random.o ${CALC_LIBS} ${LD_DEBUG} -o test_random many_random.o: many_random.c - ${CC} ${CCMAIN} ${CCOPT} ${ALLOW_CUSTOM} many_random.c -c + ${CC} ${CFLAGS} ${ALLOW_CUSTOM} many_random.c -c many_random: many_random.o ../libcalc.a ${CC} ${LDFLAGS} many_random.o ${CALC_LIBS} ${LD_DEBUG} -o many_random diff --git a/seed.c b/seed.c index 5d1ce06..067171a 100644 --- a/seed.c +++ b/seed.c @@ -52,7 +52,9 @@ #include #include #include +#if !defined(__bsdi) #include +#endif /* __bsdi */ #if defined(__linux) # include # define DEV_URANDOM "/dev/urandom" @@ -214,8 +216,6 @@ pseudo_seed(void) char urandom_pool[DEV_URANDOM_POOL]; /* /dev/urandom data pool */ #endif /* __linux */ struct timeval tp; /* time of day */ - pid_t getsid; /* session ID */ - pid_t getpgid; /* process group ID */ pid_t getpid; /* process ID */ pid_t getppid; /* parent process ID */ uid_t getuid; /* real user ID */ @@ -229,6 +229,7 @@ pseudo_seed(void) struct stat fstat_stdin; /* stat of stdin */ struct stat fstat_stdout; /* stat of stdout */ struct stat fstat_stderr; /* stat of stderr */ +#if !defined(__bsdi) struct ustat ustat_dot; /* usage stat of "." */ struct ustat ustat_dotdot; /* usage stat of ".." */ struct ustat ustat_tmp; /* usage stat of "/tmp" */ @@ -236,6 +237,9 @@ pseudo_seed(void) struct ustat ustat_stdin; /* usage stat of stdin */ struct ustat ustat_stdout; /* usage stat of stdout */ struct ustat ustat_stderr; /* usage stat of stderr */ + pid_t getsid; /* session ID */ + pid_t getpgid; /* process group ID */ +#endif /* __bsdi */ struct rusage rusage; /* resource utilization */ struct rusage rusage_chld; /* resource utilization of children */ struct timeval tp2; /* time of day again */ @@ -271,8 +275,6 @@ pseudo_seed(void) } #endif /* __linux */ (void) gettimeofday(&sdata.tp, NULL); - sdata.getsid = getsid((pid_t)0); - sdata.getpgid = getpgid((pid_t)0); sdata.getpid = getpid(); sdata.getppid = getppid(); sdata.getuid = getuid(); @@ -286,6 +288,7 @@ pseudo_seed(void) (void) fstat(0, &sdata.fstat_stdin); (void) fstat(1, &sdata.fstat_stdout); (void) fstat(2, &sdata.fstat_stderr); +#if !defined(__bsdi) (void) ustat(sdata.stat_dotdot.st_dev, &sdata.ustat_dotdot); (void) ustat(sdata.stat_dot.st_dev, &sdata.ustat_dot); (void) ustat(sdata.stat_tmp.st_dev, &sdata.ustat_tmp); @@ -293,6 +296,9 @@ pseudo_seed(void) (void) ustat(sdata.fstat_stdin.st_dev, &sdata.ustat_stdin); (void) ustat(sdata.fstat_stdout.st_dev, &sdata.ustat_stdout); (void) ustat(sdata.fstat_stderr.st_dev, &sdata.ustat_stderr); + sdata.getsid = getsid((pid_t)0); + sdata.getpgid = getpgid((pid_t)0); +#endif /* __bsdi */ (void) getrusage(RUSAGE_SELF, &sdata.rusage); (void) getrusage(RUSAGE_CHILDREN, &sdata.rusage_chld); (void) gettimeofday(&sdata.tp2, NULL); diff --git a/version.c b/version.c index c5b1c9e..f723ce7 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 "7.3" /* test number or empty string if no patch */ +#define MINOR_PATCH "7.4" /* test number or empty string if no patch */ /* * calc version constants