diff --git a/CHANGES b/CHANGES index a3e0549..e32a1a9 100644 --- a/CHANGES +++ b/CHANGES @@ -26,6 +26,18 @@ Following is the change from calc version 2.11.0t8 to date: Fixed some of the old EMail addresses found in calc documentation. + Added HAVE_USTAT, HAVE_GETSID, HAVE_GETPGID, HAVE_GETTIME, HAVE_GETPRID + and HAVE_URANDOM symbols to the Makefile. These symbols, along with + have_ustat.c, have_getsid.c, have_getpgid.c, have_gettime.c and + have_getprid.c form: have_ustat.h, have_getsid.h, have_getpgid.h, + have_gettime.h, have_getprid.h and have_urandom.h which in turn + are used by pseudo_seed() in seed.c to determine what types of + system services can be used to form a pseudo-random seed. + + Fixed the lower level make depend rules. + + Misc cleanup on the have_*.c support source files. + Following is the change from calc version 2.11.0t7 to 2.11.0t7.5: diff --git a/Makefile b/Makefile index baff166..ba33d89 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,7 @@ LONGLONG_BITS= # to determine if there is are fgetpos and fsetpos functions. If HAVE_FPOS # is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek(). # -# If in doubt, leave HAVE_FPOS empty. +# If in doubt, leave HAVE_FPOS empty and this Makefile will figure it out. # HAVE_FPOS= #HAVE_FPOS= -DHAVE_NO_FPOS @@ -120,7 +120,7 @@ HAVE_FPOS= # -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of # union or struct which. # -# If in doubt, leave HAVE_OFFSCL empty. +# If in doubt, leave HAVE_OFFSCL empty and this Makefile will figure it out. # HAVE_OFFSCL= #HAVE_OFFSCL= -DOFF_T_NON_SCALAR @@ -136,7 +136,7 @@ HAVE_OFFSCL= # -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is # some sort of union or struct which. # -# If in doubt, leave HAVE_POSSCL empty. +# If in doubt, leave HAVE_POSSCL empty and this Makefile will figure it out. # HAVE_POSSCL= #HAVE_POSSCL= -DFILEPOS_NON_SCALAR @@ -147,7 +147,7 @@ HAVE_POSSCL= # to determine if const is supported. If HAVE_CONST is set to -DHAVE_NO_CONST, # then calc will not use const. # -# If in doubt, leave HAVE_CONST empty. +# If in doubt, leave HAVE_CONST empty and this Makefile will figure it out. # HAVE_CONST= #HAVE_CONST= -DHAVE_NO_CONST @@ -159,7 +159,7 @@ HAVE_CONST= # then calc will treat uid_t as an unsigned short. This only matters if # $HOME is not set and calc must look up the home directory in /etc/passwd. # -# If in doubt, leave HAVE_UID_T empty. +# If in doubt, leave HAVE_UID_T empty and this Makefile will figure it out. # HAVE_UID_T= #HAVE_UID_T= -DHAVE_NO_UID_T @@ -172,7 +172,7 @@ HAVE_UID_T= # of memcpy(), use bfill() instead of memset(), and use index() instead of # strchr(). # -# If in doubt, leave HAVE_NEWSTR empty. +# If in doubt, leave HAVE_NEWSTR empty and this Makefile will figure it out. # HAVE_NEWSTR= #HAVE_NEWSTR= -DHAVE_NO_NEWSTR @@ -184,11 +184,83 @@ HAVE_NEWSTR= # -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate # the memory move function that does correct overlapping memory modes. # -# If in doubt, leave HAVE_MEMMOVE empty. +# If in doubt, leave HAVE_MEMMOVE empty and this Makefile will figure it out. # HAVE_MEMMOVE= #HAVE_MEMMOVE= -DHAVE_NO_MEMMOVE +# Determine if we have ustat() +# +# If HAVE_USTAT is empty, this makefile will run the have_memmv program +# to determine if ustat() is supported. If HAVE_USTAT is set to +# -DHAVE_NO_USTAT, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_USTAT empty and this Makefile will figure it out. +# +HAVE_USTAT= +#HAVE_USTAT= -DHAVE_NO_USTAT + +# Determine if we have getsid() +# +# If HAVE_GETSID is empty, this makefile will run the have_memmv program +# to determine if getsid() is supported. If HAVE_GETSID is set to +# -DHAVE_NO_GETSID, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_GETSID empty and this Makefile will figure it out. +# +HAVE_GETSID= +#HAVE_GETSID= -DHAVE_NO_GETSID + +# Determine if we have getpgid() +# +# If HAVE_GETPGID is empty, this makefile will run the have_memmv program +# to determine if getpgid() is supported. If HAVE_GETPGID is set to +# -DHAVE_NO_GETPGID, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_GETPGID empty and this Makefile will figure it out. +# +HAVE_GETPGID= +#HAVE_GETPGID= -DHAVE_NO_GETPGID + +# Determine if we have clock_gettime() +# +# If HAVE_GETTIME is empty, this makefile will run the have_memmv program +# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to +# -DHAVE_NO_GETTIME, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_GETTIME empty and this Makefile will figure it out. +# +HAVE_GETTIME= +#HAVE_GETTIME= -DHAVE_NO_GETTIME + +# Determine if we have getprid() +# +# If HAVE_GETPRID is empty, this makefile will run the have_memmv program +# to determine if getprid() is supported. If HAVE_GETPRID is set to +# -DHAVE_NO_GETPRID, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_GETPRID empty and this Makefile will figure it out. +# +HAVE_GETPRID= +#HAVE_GETPRID= -DHAVE_NO_GETPRID + +# Determine if we have /dev/urandom +# +# If HAVE_URANDOM is empty, this makefile will run the have_memmv program +# to determine if /dev/urandom is supported. If HAVE_URANDOM is set to +# -DHAVE_NO_URANDOM, then calc will use internal functions to simulate +# the memory move function that does correct overlapping memory modes. +# +# If in doubt, leave HAVE_URANDOM empty and this Makefile will figure it out. +# +HAVE_URANDOM= +#HAVE_URANDOM= -DHAVE_NO_URANDOM + # Some architectures such as Sparc do not allow one to access 32 bit values # that are not alligned on a 32 bit boundary. # @@ -809,7 +881,9 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \ fposval.h have_const.h have_fpos.h have_malloc.h \ have_memmv.h have_newstr.h have_offscl.h have_posscl.h \ have_stdlib.h have_string.h have_times.h have_uid_t.h \ - have_unistd.h longbits.h longlong.h terminal.h calc_errno.h + have_unistd.h longbits.h longlong.h terminal.h calc_errno.h \ + have_ustat.h have_getsid.h have_getpgid.h \ + have_gettime.h have_getprid.h have_urandom.h # we build these .c files during the make # @@ -821,7 +895,9 @@ BUILD_C_SRC= calcerr.c # UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \ have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \ - longlong.c have_offscl.c have_posscl.c have_memmv.c calc_errno.c + longlong.c have_offscl.c have_posscl.c have_memmv.c calc_errno.c \ + have_ustat.c have_getsid.c have_getpgid.c \ + have_gettime.c have_getprid.c # these awk and sed tools are used in the process of building BUILD_H_SRC # and BUILD_C_SRC @@ -835,17 +911,22 @@ UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \ # UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \ have_const.o fposval.o have_fpos.o longlong.o try_strarg.o \ - have_stdvs.o have_varvs.o have_posscl.o have_memmv.o calc_errno.o + have_stdvs.o have_varvs.o have_posscl.o have_memmv.o calc_errno.o \ + have_ustat.o have_getsid.o have_getpgid.o \ + have_gettime.o have_getprid.o -# these temp files may be created (and removed) during the build of BUILD_C_SRC +# these temp files may be created (and removed) during the build of BUILD_C_SRC # UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \ - calc_errno_tmp + calc_errno_tmp memmv_tmp offscl_tmp posscl_tmp newstr_tmp \ + getsid_tmp gettime_tmp getprid_tmp # these utility progs may be used in the process of building BUILD_H_SRC # UTIL_PROGS= align32 fposval have_uid_t longlong have_const \ - endian longbits have_newstr have_stdvs have_varvs calc_errno + endian longbits have_newstr have_stdvs have_varvs calc_errno \ + have_ustat have_getsid have_getpgid \ + have_gettime have_getprid # These files are required by the regress.cal regression test. # @@ -1717,7 +1798,7 @@ have_newstr.h: have_newstr.c ${MAKE_FILE} fi have_memmv.h: have_memmv.c ${MAKE_FILE} - -${Q}rm -f have_memmv have_memmv.o newstr_tmp have_memmv.h + -${Q}rm -f have_memmv have_memmv.o memmv_tmp have_memmv.h ${Q}echo 'forming have_memmv.h' ${Q}echo '/*' > have_memmv.h ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_memmv.h @@ -1732,17 +1813,17 @@ have_memmv.h: have_memmv.c ${MAKE_FILE} -${Q}rm -f have_memmv.o have_memmv -${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" \ + -${Q}${SHELL} -c "./have_memmv > memmv_tmp 2>/dev/null" \ >/dev/null 2>&1; true - -${Q}if [ -s newstr_tmp ]; then \ - cat newstr_tmp >> have_memmv.h; \ + -${Q}if [ -s memmv_tmp ]; then \ + cat memmv_tmp >> have_memmv.h; \ else \ echo '#undef HAVE_MEMMOVE /* no */' >> have_memmv.h; \ fi ${Q}echo '' >> have_memmv.h ${Q}echo '' >> have_memmv.h ${Q}echo '#endif /* !__HAVE_MEMMV_H__ */' >> have_memmv.h - -${Q}rm -f have_memmv have_memmv.o newstr_tmp + -${Q}rm -f have_memmv have_memmv.o memmv_tmp ${Q}echo 'have_memmv.h formed' -@if [ -z "${Q}" ]; then \ echo ''; \ @@ -1754,6 +1835,231 @@ have_memmv.h: have_memmv.c ${MAKE_FILE} true; \ fi +have_ustat.h: have_ustat.c ${MAKE_FILE} + -${Q}rm -f have_ustat have_ustat.o ustat_tmp have_ustat.h + ${Q}echo 'forming have_ustat.h' + ${Q}echo '/*' > have_ustat.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_ustat.h + ${Q}echo ' */' >> have_ustat.h + ${Q}echo '' >> have_ustat.h + ${Q}echo '' >> have_ustat.h + ${Q}echo '#if !defined(__HAVE_USTAT_H__)' >> have_ustat.h + ${Q}echo '#define __HAVE_USTAT_H__' >> have_ustat.h + ${Q}echo '' >> have_ustat.h + ${Q}echo '' >> have_ustat.h + ${Q}echo '/* do we have or want ustat()? */' >> have_ustat.h + -${Q}rm -f have_ustat.o have_ustat + -${Q}${LCC} ${ICFLAGS} ${HAVE_USTAT} have_ustat.c -c 2>/dev/null; true + -${Q}${LCC} ${ILDFLAGS} have_ustat.o -o have_ustat 2>/dev/null; true + -${Q}${SHELL} -c "./have_ustat > ustat_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s ustat_tmp ]; then \ + cat ustat_tmp >> have_ustat.h; \ + else \ + echo '#undef HAVE_USTAT /* no */' >> have_ustat.h; \ + fi + ${Q}echo '' >> have_ustat.h + ${Q}echo '' >> have_ustat.h + ${Q}echo '#endif /* !__HAVE_USTAT_H__ */' >> have_ustat.h + -${Q}rm -f have_ustat have_ustat.o ustat_tmp + ${Q}echo 'have_ustat.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + +have_getsid.h: have_getsid.c ${MAKE_FILE} + -${Q}rm -f have_getsid have_getsid.o getsid_tmp have_getsid.h + ${Q}echo 'forming have_getsid.h' + ${Q}echo '/*' > have_getsid.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_getsid.h + ${Q}echo ' */' >> have_getsid.h + ${Q}echo '' >> have_getsid.h + ${Q}echo '' >> have_getsid.h + ${Q}echo '#if !defined(__HAVE_GETSID_H__)' >> have_getsid.h + ${Q}echo '#define __HAVE_GETSID_H__' >> have_getsid.h + ${Q}echo '' >> have_getsid.h + ${Q}echo '' >> have_getsid.h + ${Q}echo '/* do we have or want getsid()? */' >> have_getsid.h + -${Q}rm -f have_getsid.o have_getsid + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETSID} have_getsid.c -c 2>/dev/null; true + -${Q}${LCC} ${ILDFLAGS} have_getsid.o -o have_getsid 2>/dev/null; true + -${Q}${SHELL} -c "./have_getsid > getsid_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s getsid_tmp ]; then \ + cat getsid_tmp >> have_getsid.h; \ + else \ + echo '#undef HAVE_GETSID /* no */' >> have_getsid.h; \ + fi + ${Q}echo '' >> have_getsid.h + ${Q}echo '' >> have_getsid.h + ${Q}echo '#endif /* !__HAVE_GETSID_H__ */' >> have_getsid.h + -${Q}rm -f have_getsid have_getsid.o getsid_tmp + ${Q}echo 'have_getsid.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + +have_getpgid.h: have_getpgid.c ${MAKE_FILE} + -${Q}rm -f have_getpgid have_getpgid.o getpgid_tmp have_getpgid.h + ${Q}echo 'forming have_getpgid.h' + ${Q}echo '/*' > have_getpgid.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_getpgid.h + ${Q}echo ' */' >> have_getpgid.h + ${Q}echo '' >> have_getpgid.h + ${Q}echo '' >> have_getpgid.h + ${Q}echo '#if !defined(__HAVE_GETPGID_H__)' >> have_getpgid.h + ${Q}echo '#define __HAVE_GETPGID_H__' >> have_getpgid.h + ${Q}echo '' >> have_getpgid.h + ${Q}echo '' >> have_getpgid.h + ${Q}echo '/* do we have or want getpgid()? */' >> have_getpgid.h + -${Q}rm -f have_getpgid.o have_getpgid + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPGID} have_getpgid.c -c 2>/dev/null; \ + true + -${Q}${LCC} ${ILDFLAGS} have_getpgid.o -o have_getpgid 2>/dev/null; true + -${Q}${SHELL} -c "./have_getpgid > getpgid_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s getpgid_tmp ]; then \ + cat getpgid_tmp >> have_getpgid.h; \ + else \ + echo '#undef HAVE_GETPGID /* no */' >> have_getpgid.h; \ + fi + ${Q}echo '' >> have_getpgid.h + ${Q}echo '' >> have_getpgid.h + ${Q}echo '#endif /* !__HAVE_GETPGID_H__ */' >> have_getpgid.h + -${Q}rm -f have_getpgid have_getpgid.o getpgid_tmp + ${Q}echo 'have_getpgid.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + +have_gettime.h: have_gettime.c ${MAKE_FILE} + -${Q}rm -f have_gettime have_gettime.o gettime_tmp have_gettime.h + ${Q}echo 'forming have_gettime.h' + ${Q}echo '/*' > have_gettime.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_gettime.h + ${Q}echo ' */' >> have_gettime.h + ${Q}echo '' >> have_gettime.h + ${Q}echo '' >> have_gettime.h + ${Q}echo '#if !defined(__HAVE_GETTIME_H__)' >> have_gettime.h + ${Q}echo '#define __HAVE_GETTIME_H__' >> have_gettime.h + ${Q}echo '' >> have_gettime.h + ${Q}echo '' >> have_gettime.h + ${Q}echo '/* do we have or want clock_gettime()? */' >> have_gettime.h + -${Q}rm -f have_gettime.o have_gettime + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETTIME} have_gettime.c -c 2>/dev/null; \ + true + -${Q}${LCC} ${ILDFLAGS} have_gettime.o -o have_gettime 2>/dev/null; true + -${Q}${SHELL} -c "./have_gettime > gettime_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s gettime_tmp ]; then \ + cat gettime_tmp >> have_gettime.h; \ + else \ + echo '#undef HAVE_GETTIME /* no */' >> have_gettime.h; \ + fi + ${Q}echo '' >> have_gettime.h + ${Q}echo '' >> have_gettime.h + ${Q}echo '#endif /* !__HAVE_GETTIME_H__ */' >> have_gettime.h + -${Q}rm -f have_gettime have_gettime.o gettime_tmp + ${Q}echo 'have_gettime.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + +have_getprid.h: have_getprid.c ${MAKE_FILE} + -${Q}rm -f have_getprid have_getprid.o getprid_tmp have_getprid.h + ${Q}echo 'forming have_getprid.h' + ${Q}echo '/*' > have_getprid.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_getprid.h + ${Q}echo ' */' >> have_getprid.h + ${Q}echo '' >> have_getprid.h + ${Q}echo '' >> have_getprid.h + ${Q}echo '#if !defined(__HAVE_GETPRID_H__)' >> have_getprid.h + ${Q}echo '#define __HAVE_GETPRID_H__' >> have_getprid.h + ${Q}echo '' >> have_getprid.h + ${Q}echo '' >> have_getprid.h + ${Q}echo '/* do we have or want getprid()? */' >> have_getprid.h + -${Q}rm -f have_getprid.o have_getprid + -${Q}${LCC} ${ICFLAGS} ${HAVE_GETPRID} have_getprid.c -c 2>/dev/null; \ + true + -${Q}${LCC} ${ILDFLAGS} have_getprid.o -o have_getprid 2>/dev/null; true + -${Q}${SHELL} -c "./have_getprid > getprid_tmp 2>/dev/null" \ + >/dev/null 2>&1; true + -${Q}if [ -s getprid_tmp ]; then \ + cat getprid_tmp >> have_getprid.h; \ + else \ + echo '#undef HAVE_GETPRID /* no */' >> have_getprid.h; \ + fi + ${Q}echo '' >> have_getprid.h + ${Q}echo '' >> have_getprid.h + ${Q}echo '#endif /* !__HAVE_GETPRID_H__ */' >> have_getprid.h + -${Q}rm -f have_getprid have_getprid.o getprid_tmp + ${Q}echo 'have_getprid.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + +have_urandom.h: ${MAKE_FILE} + -${Q}rm -f have_urandom.h + ${Q}echo 'forming have_urandom.h' + ${Q}echo '/*' > have_urandom.h + ${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> have_urandom.h + ${Q}echo ' */' >> have_urandom.h + ${Q}echo '' >> have_urandom.h + ${Q}echo '' >> have_urandom.h + ${Q}echo '#if !defined(__HAVE_URANDOM_H__)' >> have_urandom.h + ${Q}echo '#define __HAVE_URANDOM_H__' >> have_urandom.h + ${Q}echo '' >> have_urandom.h + ${Q}echo '' >> have_urandom.h + ${Q}echo '/* do we have /dev/urandom? */' >> have_urandom.h + -${Q}if [ -c /dev/urandom ]; then \ + echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \ + else \ + echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \ + fi + ${Q}echo '' >> have_urandom.h + ${Q}echo '' >> have_urandom.h + ${Q}echo '#endif /* !__HAVE_URANDOM_H__ */' >> have_urandom.h + ${Q}echo 'have_urandom.h formed' + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= start of $@ =-=-='; \ + cat $@; \ + echo '=-=-= end of $@ =-=-='; \ + echo ''; \ + else \ + true; \ + fi + args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h -${Q}rm -f args.h have_args ${Q}echo 'forming args.h' @@ -2290,6 +2596,12 @@ env: @echo "HAVE_CONST=${HAVE_CONST}"; echo "" @echo "HAVE_UID_T=${HAVE_UID_T}"; echo "" @echo "HAVE_NEWSTR=${HAVE_NEWSTR}"; echo "" + @echo "HAVE_USTAT=${HAVE_USTAT}"; echo "" + @echo "HAVE_GETSID=${HAVE_GETSID}"; echo "" + @echo "HAVE_GETPGID=${HAVE_GETPGID}"; echo "" + @echo "HAVE_GETTIME=${HAVE_GETTIME}"; echo "" + @echo "HAVE_GETPRID=${HAVE_GETPRID}"; echo "" + @echo "HAVE_URANDOM=${HAVE_URANDOM}"; echo "" @echo "ALIGN32=${ALIGN32}"; echo "" @echo "ERRNO_DECL=${ERRNO_DECL}"; echo "" @echo "BINDIR=${BINDIR}"; echo "" @@ -3020,6 +3332,10 @@ hash.o: zrand.h hash.o: zrandom.h have_const.o: have_const.c have_fpos.o: have_fpos.c +have_getpgid.o: have_getpgid.c +have_getprid.o: have_getprid.c +have_getsid.o: have_getsid.c +have_gettime.o: have_gettime.c have_memmv.o: have_memmv.c have_newstr.o: have_newstr.c have_offscl.o: have_offscl.c @@ -3030,6 +3346,7 @@ have_stdvs.o: have_string.h have_stdvs.o: have_unistd.h have_uid_t.o: have_uid_t.c have_uid_t.o: have_unistd.h +have_ustat.o: have_ustat.c have_varvs.o: have_string.h have_varvs.o: have_unistd.h have_varvs.o: have_varvs.c @@ -3510,11 +3827,17 @@ quickhash.o: zrandom.h seed.o: alloc.h seed.o: byteswap.h seed.o: endian_calc.h +seed.o: have_getpgid.h +seed.o: have_getprid.h +seed.o: have_getsid.h +seed.o: have_gettime.h seed.o: have_malloc.h seed.o: have_memmv.h seed.o: have_newstr.h seed.o: have_stdlib.h seed.o: have_string.h +seed.o: have_urandom.h +seed.o: have_ustat.h seed.o: longbits.h seed.o: qmath.h seed.o: seed.c diff --git a/custom/Makefile b/custom/Makefile index 4d0118e..92bbcbc 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -419,9 +419,13 @@ depend: else \ rm -f Makefile.tmp; \ mv Makefile Makefile.tmp; \ - sccs edit Makefile; \ + if [ -d RCS ]; then; \ + co -l Makefile; \ + fi ;\ mv Makefile.tmp Makefile; \ - echo new 'custom Makefile formed -- you need to check it in'; \ + if [ -d RCS ]; then; \ + echo new custom Makefile formed '--' you need to check it in'; \ + fi; \ fi ## @@ -588,8 +592,28 @@ c_help.o: ../string.h c_help.o: ../value.h c_help.o: ../zmath.h c_help.o: c_help.c +c_pzasusb8.o: ../alloc.h +c_pzasusb8.o: ../block.h +c_pzasusb8.o: ../byteswap.h +c_pzasusb8.o: ../calcerr.h +c_pzasusb8.o: ../cmath.h +c_pzasusb8.o: ../config.h c_pzasusb8.o: ../custom.h +c_pzasusb8.o: ../endian_calc.h +c_pzasusb8.o: ../hash.h c_pzasusb8.o: ../have_const.h +c_pzasusb8.o: ../have_malloc.h +c_pzasusb8.o: ../have_memmv.h +c_pzasusb8.o: ../have_newstr.h +c_pzasusb8.o: ../have_stdlib.h +c_pzasusb8.o: ../have_string.h +c_pzasusb8.o: ../longbits.h +c_pzasusb8.o: ../md5.h +c_pzasusb8.o: ../nametype.h +c_pzasusb8.o: ../qmath.h +c_pzasusb8.o: ../shs.h +c_pzasusb8.o: ../shs1.h +c_pzasusb8.o: ../string.h c_pzasusb8.o: ../value.h c_pzasusb8.o: ../zmath.h c_pzasusb8.o: c_pzasusb8.c diff --git a/have_const.c b/have_const.c index eaa585f..777f766 100644 --- a/have_const.c +++ b/have_const.c @@ -46,16 +46,21 @@ int main(void) { #if defined(HAVE_NO_CONST) + printf("#undef HAVE_CONST /* no */\n"); printf("#undef CONST\n"); printf("#define CONST /* no */\n"); + #else /* HAVE_NO_CONST */ + const char * const str = "const"; printf("#define HAVE_CONST /* yes */\n"); printf("#undef CONST\n"); printf("#define CONST %s /* yes */\n", str); + #endif /* HAVE_NO_CONST */ + /* exit(0); */ return 0; } diff --git a/have_getpgid.c b/have_getpgid.c new file mode 100644 index 0000000..01fa6db --- /dev/null +++ b/have_getpgid.c @@ -0,0 +1,60 @@ +/* + * have_getpgid - Determine if we getpgid() + * + * usage: + * have_getpgid + * + * Not all systems have the getpgid() function, so this may not + * compile on your system. + * + * This prog outputs several defines: + * + * HAVE_GETPGID + * defined ==> use getpgid() + * undefined ==> do not or cannot call getpgid() + */ +/* + * Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright, this permission notice and text + * this comment, and the disclaimer below appear in all of the following: + * + * supporting documentation + * source copies + * source works derived from this source + * binaries derived from this source or from derived source + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * chongo was here /\../\ + */ + +#include +#include + +int +main(void) +{ +#if defined(HAVE_NO_GETPGID) + + printf("#undef HAVE_GETPGID /* no */\n"); + +#else /* HAVE_NO_GETPGID */ + + (void) getpgid((pid_t)0); + + printf("#define HAVE_GETPGID /* yes */\n"); + +#endif /* HAVE_NO_GETPGID */ + + /* exit(0); */ + return 0; +} diff --git a/have_getprid.c b/have_getprid.c new file mode 100644 index 0000000..9d433f6 --- /dev/null +++ b/have_getprid.c @@ -0,0 +1,59 @@ +/* + * have_getprid - Determine if we getprid() + * + * usage: + * have_getprid + * + * Not all systems have the getprid() function, so this may not + * compile on your system. + * + * This prog outputs several defines: + * + * HAVE_GETPRID + * defined ==> use getprid() + * undefined ==> do not or cannot call getprid() + */ +/* + * Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright, this permission notice and text + * this comment, and the disclaimer below appear in all of the following: + * + * supporting documentation + * source copies + * source works derived from this source + * binaries derived from this source or from derived source + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * chongo was here /\../\ + */ + +#include +#include + +int +main(void) +{ +#if defined(HAVE_NO_GETPRID) + + printf("#undef HAVE_GETPRID /* no */\n"); + +#else /* HAVE_NO_GETPRID */ + + (void) getprid(); + printf("#define HAVE_GETPRID /* yes */\n"); + +#endif /* HAVE_NO_GETPRID */ + + /* exit(0); */ + return 0; +} diff --git a/have_getsid.c b/have_getsid.c new file mode 100644 index 0000000..96c904c --- /dev/null +++ b/have_getsid.c @@ -0,0 +1,59 @@ +/* + * have_getsid - Determine if we getsid() + * + * usage: + * have_getsid + * + * Not all systems have the getsid() function, so this may not + * compile on your system. + * + * This prog outputs several defines: + * + * HAVE_GETSID + * defined ==> use getsid() + * undefined ==> do not call or cannot call getsid() + */ +/* + * Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright, this permission notice and text + * this comment, and the disclaimer below appear in all of the following: + * + * supporting documentation + * source copies + * source works derived from this source + * binaries derived from this source or from derived source + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * chongo was here /\../\ + */ + +#include + +int +main(void) +{ +#if defined(HAVE_NO_GETSID) + + printf("#undef HAVE_GETSID /* no */\n"); + +#else /* HAVE_NO_GETSID */ + + (void) getsid((pid_t)0); + + printf("#define HAVE_GETSID /* yes */\n"); + +#endif /* HAVE_NO_GETSID */ + + /* exit(0); */ + return 0; +} diff --git a/have_gettime.c b/have_gettime.c new file mode 100644 index 0000000..5144ea7 --- /dev/null +++ b/have_gettime.c @@ -0,0 +1,74 @@ +/* + * have_gettime - Determine if we clock_gettime() + * + * usage: + * have_gettime + * + * Not all systems have the clock_gettime() function, so this may not + * compile on your system. + * + * This prog outputs several defines: + * + * HAVE_GETTIME + * defined ==> use clock_gettime() for either CLOCK_SGI_CYCLE + * and/or CLOCK_REALTIME + * undefined ==> clock_gettime() is not available for both + * CLOCK_SGI_CYCLE and CLOCK_REALTIME + */ +/* + * Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright, this permission notice and text + * this comment, and the disclaimer below appear in all of the following: + * + * supporting documentation + * source copies + * source works derived from this source + * binaries derived from this source or from derived source + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * chongo was here /\../\ + */ + +#include + +int +main(void) +{ +#if defined(HAVE_NO_GETTIME) + + printf("#undef HAVE_GETTIME /* no */\n"); + +#else /* HAVE_NO_GETTIME */ + +# if defined(CLOCK_SGI_CYCLE) + + struct timespec sgi_cycle; /* SGI hardware clock */ + (void) clock_gettime(CLOCK_SGI_CYCLE, &sgi_cycle); + printf("#define HAVE_GETTIME /* yes - w/CLOCK_SGI_CYCLE */\n"); + +# elif defined(CLOCK_REALTIME) + + struct timespec realtime; /* POSIX realtime clock */ + (void) clock_gettime(CLOCK_REALTIME, &realtime); + printf("#define HAVE_GETTIME /* yes - CLOCK_REALTIME only */\n"); + +# else + + printf("#undef HAVE_GETTIME /* no - no SGI_CYCLE and no REALTIME */\n"); + +# endif /* CLOCK_REALTIME */ + +#endif /* HAVE_NO_GETTIME */ + /* exit(0); */ + return 0; +} diff --git a/have_memmv.c b/have_memmv.c index 72a48ca..a9d3354 100644 --- a/have_memmv.c +++ b/have_memmv.c @@ -2,7 +2,7 @@ * have_memmv - Determine if we memmove() * * usage: - * have_newstr + * have_memmv * * Not all systems with memcpy() have memmove() functions, so this may not * compile on your system. @@ -48,12 +48,17 @@ int main(void) { #if defined(HAVE_NO_MEMMOVE) + printf("#undef HAVE_MEMMOVE /* no */\n"); + #else /* HAVE_NO_MEMMOVE */ + (void) memmove(dest, src, MOVELEN); printf("#define HAVE_MEMMOVE /* yes */\n"); + #endif /* HAVE_NO_MEMMOVE */ + /* exit(0); */ return 0; } diff --git a/have_newstr.c b/have_newstr.c index e3261a5..0d49c6b 100644 --- a/have_newstr.c +++ b/have_newstr.c @@ -50,14 +50,19 @@ int main(void) { #if defined(HAVE_NO_NEWSTR) + printf("#undef HAVE_NEWSTR /* no */\n"); + #else /* HAVE_NO_NEWSTR */ + (void) memcpy(dest, src, MOVELEN); (void) memset(dest, 0, MOVELEN); (void) strchr(src, 'e'); printf("#define HAVE_NEWSTR /* yes */\n"); + #endif /* HAVE_NO_NEWSTR */ + /* exit(0); */ return 0; } diff --git a/have_uid_t.c b/have_uid_t.c index cf253ea..6e70263 100644 --- a/have_uid_t.c +++ b/have_uid_t.c @@ -51,15 +51,20 @@ int main(void) { #if defined(HAVE_NO_UID_T) + printf("#undef HAVE_UID_T /* no */\n"); + #else /* HAVE_NO_UID_T */ + uid_t curds; extern uid_t geteuid(); curds = geteuid(); printf("#define HAVE_UID_T /* yes */\n"); + #endif /* HAVE_NO_UID_T */ + /* exit(0); */ return 0; } diff --git a/have_ustat.c b/have_ustat.c new file mode 100644 index 0000000..c361601 --- /dev/null +++ b/have_ustat.c @@ -0,0 +1,65 @@ +/* + * have_ustat - Determine if we ustat() + * + * usage: + * have_ustat + * + * Not all systems have the ustat() function, so this may not + * compile on your system. + * + * This prog outputs several defines: + * + * HAVE_USTAT + * defined ==> use ustat() + * undefined ==> do not call or cannot call ustat() + */ +/* + * Copyright (c) 1999 by Landon Curt Noll. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright, this permission notice and text + * this comment, and the disclaimer below appear in all of the following: + * + * supporting documentation + * source copies + * source works derived from this source + * binaries derived from this source or from derived source + * + * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF + * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * chongo was here /\../\ + */ + +#include +#include +#include + +int +main(void) +{ +#if defined(HAVE_NO_USTAT) + + printf("#undef HAVE_USTAT /* no */\n"); + +#else /* HAVE_NO_USTAT */ + + struct stat stat_dot; /* stat of "." */ + struct ustat ustat_dot; /* usage stat of "." */ + + (void) stat(".", &stat_dot); + (void) ustat(stat_dot.st_dev, &ustat_dot); + + printf("#define HAVE_USTAT /* yes */\n"); + +#endif /* HAVE_NO_USTAT */ + + /* exit(0); */ + return 0; +} diff --git a/have_varvs.c b/have_varvs.c index 1fdfa01..2b13202 100644 --- a/have_varvs.c +++ b/have_varvs.c @@ -57,11 +57,13 @@ try_this(char *fmt, ...) va_list ap; va_start(ap); + #if !defined(DONT_HAVE_VSPRINTF) vsprintf(buf, fmt, ap); #else sprintf(buf, fmt, ap); #endif + va_end(ap); } diff --git a/sample/Makefile b/sample/Makefile index e8d8431..80228ef 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -402,9 +402,13 @@ depend: else \ rm -f Makefile.tmp; \ mv Makefile Makefile.tmp; \ - sccs edit Makefile; \ + if [ -d RCS ]; then; \ + co -l Makefile; \ + fi; \ mv Makefile.tmp Makefile; \ - echo new 'sample Makefile formed -- you need to check it in'; \ + if [ -d RCS ]; then; \ + echo new sample Makefile formed, you need to check it in; \ + fi; \ fi ## diff --git a/seed.c b/seed.c index c991fc6..7eb32c2 100644 --- a/seed.c +++ b/seed.c @@ -65,6 +65,12 @@ #endif /* __linux */ #include "qmath.h" #include "longbits.h" +#include "have_ustat.h" +#include "have_getsid.h" +#include "have_getpgid.h" +#include "have_gettime.h" +#include "have_getprid.h" +#include "have_urandom.h" /* @@ -208,16 +214,22 @@ NUMBER * pseudo_seed(void) { struct { /* data used for quasi-random seed */ -#if defined(__sgi) +#if defined(HAVE_GETTIME) +# if defined(CLOCK_SGI_CYCLE) struct timespec sgi_cycle; /* SGI hardware clock */ - prid_t getprid; /* project ID */ +# endif /* CLOCK_SGI_CYCLE */ +# if defined(CLOCK_REALTIME) struct timespec realtime; /* POSIX realtime clock */ -#endif /* __sgi */ -#if defined(__linux) +# endif /* CLOCK_REALTIME */ +#endif /* HAVE_GETTIME */ +#if defined(HAVE_GETPRID) + prid_t getprid; /* project ID */ +#endif /* HAVE_GETPRID */ +#if defined(HAVE_URANDOM) int urandom_fd; /* open scriptor for /dev/urandom */ int urandom_ret; /* read() of /dev/random */ char urandom_pool[DEV_URANDOM_POOL]; /* /dev/urandom data pool */ -#endif /* __linux */ +#endif /* HAVE_URANDOM */ struct timeval tp; /* time of day */ pid_t getpid; /* process ID */ pid_t getppid; /* parent process ID */ @@ -232,7 +244,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) +#if defined(HAVE_USTAT) struct ustat ustat_dot; /* usage stat of "." */ struct ustat ustat_dotdot; /* usage stat of ".." */ struct ustat ustat_tmp; /* usage stat of "/tmp" */ @@ -240,9 +252,13 @@ 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 */ +#endif /* HAVE_USTAT */ +#if defined(HAVE_GETSID) pid_t getsid; /* session ID */ +#endif /* HAVE_GETSID */ +#if defined(HAVE_GETPGID) pid_t getpgid; /* process group ID */ -#endif /* __bsdi */ +#endif /* HAVE_GETPGID */ struct rusage rusage; /* resource utilization */ struct rusage rusage_chld; /* resource utilization of children */ struct timeval tp2; /* time of day again */ @@ -261,12 +277,18 @@ pseudo_seed(void) * We do care (that much) if these calls fail. We do not * need to process any data in the 'sdata' structure. */ -#if defined(__sgi) +#if defined(HAVE_GETTIME) +# if defined(CLOCK_SGI_CYCLE) (void) clock_gettime(CLOCK_SGI_CYCLE, &sdata.sgi_cycle); - sdata.getprid = getprid(); +# endif /* CLOCK_SGI_CYCLE */ +# if defined(CLOCK_REALTIME) (void) clock_gettime(CLOCK_REALTIME, &sdata.realtime); -#endif /* __sgi */ -#if defined(__linux) +# endif /* CLOCK_REALTIME */ +#endif /* HAVE_GETTIME */ +#if defined(HAVE_GETPRID) + sdata.getprid = getprid(); +#endif /* HAVE_GETPRID */ +#if defined(HAVE_URANDOM) sdata.urandom_fd = open(DEV_URANDOM, O_NONBLOCK|O_RDONLY); if (sdata.urandom_fd >= 0) { sdata.urandom_ret = read(sdata.urandom_fd, @@ -276,7 +298,7 @@ pseudo_seed(void) memset(&sdata.urandom_pool, EOF, DEV_URANDOM_POOL); sdata.urandom_ret = EOF; } -#endif /* __linux */ +#endif /* HAVE_URANDOM */ (void) gettimeofday(&sdata.tp, NULL); sdata.getpid = getpid(); sdata.getppid = getppid(); @@ -291,7 +313,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) +#if defined(HAVE_USTAT) (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); @@ -299,9 +321,13 @@ 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); +#endif /* HAVE_USTAT */ +#if defined(HAVE_GETSID) sdata.getsid = getsid((pid_t)0); +#endif /* HAVE_GETSID */ +#if defined(HAVE_GETPGID) sdata.getpgid = getpgid((pid_t)0); -#endif /* __bsdi */ +#endif /* HAVE_GETPGID */ (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 247388f..6a80678 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 "8" /* test number or empty string if no patch */ +#define MINOR_PATCH "8.1" /* test number or empty string if no patch */ /* * calc version constants