mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t9.4.3
This commit is contained in:
12
CHANGES
12
CHANGES
@@ -212,6 +212,18 @@ Following is the change from calc version 2.11.0t8.9.1 to date:
|
|||||||
is not defined, then calc will use calc_strdup() to simulate
|
is not defined, then calc will use calc_strdup() to simulate
|
||||||
the real strdup() function.
|
the real strdup() function.
|
||||||
|
|
||||||
|
Calc no longer makes use of sys_errlist and sys_nerr. Some systems
|
||||||
|
no longer suppor these values (even though they should from a
|
||||||
|
legacy prospective). Calc now relies on the fact that strerror()
|
||||||
|
will return NULL of no such system error exists. System errors >=
|
||||||
|
10000 will be considered calc errors instead. The Makefile symbol
|
||||||
|
ERRNO_DECL has gone away as well as calc_errno.c and calc_errno.h.
|
||||||
|
|
||||||
|
On system errors are are not known to to the libc strerror() function,
|
||||||
|
strerror() will now print something such as:
|
||||||
|
|
||||||
|
Unknown error 9999
|
||||||
|
|
||||||
|
|
||||||
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:
|
Following is the change from calc version 2.11.0t8 to 2.11.0t8.9:
|
||||||
|
|
||||||
|
140
Makefile
140
Makefile
@@ -302,39 +302,6 @@ HAVE_STRDUP=
|
|||||||
ALIGN32= -DMUST_ALIGN32
|
ALIGN32= -DMUST_ALIGN32
|
||||||
#ALIGN32= -UMUST_ALIGN32
|
#ALIGN32= -UMUST_ALIGN32
|
||||||
|
|
||||||
# On most machines: errno sys_errlist and sys_nerr are declared
|
|
||||||
# by either <stdio.h> and/or <errno.h>. But some systems declare
|
|
||||||
# them somewhere else or do not declare them at all!
|
|
||||||
#
|
|
||||||
# If the system were doing a proper job in headers, this should declare them:
|
|
||||||
#
|
|
||||||
# #include <stdio.h>
|
|
||||||
# #include <errno.h>
|
|
||||||
#
|
|
||||||
# But one some systems one must explicitly declare them as:
|
|
||||||
#
|
|
||||||
# extern int errno;
|
|
||||||
# extern const char *const sys_errlist[];
|
|
||||||
# extern int sys_nerr;
|
|
||||||
#
|
|
||||||
# and on some old systems they must be explicitly and incorrectly declared as:
|
|
||||||
#
|
|
||||||
# extern int errno;
|
|
||||||
# extern char *sys_errlist[];
|
|
||||||
# extern int sys_nerr;
|
|
||||||
#
|
|
||||||
# ERRNO_DECL= let calc_errno.c determine how to declare them
|
|
||||||
# ERRNO_DECL= -DERRNO_NO_DECL headers declare them correctly
|
|
||||||
# ERRNO_DECL= -DERRNO_STD_DECL one must explicitly declare then
|
|
||||||
# ERRNO_DECL= -DERRNO_OLD_DECL one must explicitly & incorrectly declare them
|
|
||||||
#
|
|
||||||
# When in doubt, be safe leave ERRNO_DECL empty.
|
|
||||||
#
|
|
||||||
ERRNO_DECL=
|
|
||||||
#ERRNO_DECL= -DERRNO_NO_DECL
|
|
||||||
#ERRNO_DECL= -DERRNO_STD_DECL
|
|
||||||
#ERRNO_DECL= -DERRNO_OLD_DECL
|
|
||||||
|
|
||||||
# where to install binary files
|
# where to install binary files
|
||||||
#
|
#
|
||||||
BINDIR= /usr/local/bin
|
BINDIR= /usr/local/bin
|
||||||
@@ -942,7 +909,7 @@ 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 \
|
fposval.h have_const.h have_fpos.h have_malloc.h \
|
||||||
have_memmv.h have_newstr.h have_offscl.h have_posscl.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_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 \
|
||||||
have_ustat.h have_getsid.h have_getpgid.h \
|
have_ustat.h have_getsid.h have_getpgid.h \
|
||||||
have_gettime.h have_getprid.h have_urandom.h have_rusage.h \
|
have_gettime.h have_getprid.h have_urandom.h have_rusage.h \
|
||||||
have_strdup.h
|
have_strdup.h
|
||||||
@@ -957,7 +924,7 @@ BUILD_C_SRC= calcerr.c
|
|||||||
#
|
#
|
||||||
UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.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 \
|
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 \
|
||||||
have_ustat.c have_getsid.c have_getpgid.c \
|
have_ustat.c have_getsid.c have_getpgid.c \
|
||||||
have_gettime.c have_getprid.c have_rusage.c have_strdup.c
|
have_gettime.c have_getprid.c have_rusage.c have_strdup.c
|
||||||
|
|
||||||
@@ -973,20 +940,20 @@ 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 \
|
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_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 \
|
||||||
have_ustat.o have_getsid.o have_getpgid.o \
|
have_ustat.o have_getsid.o have_getpgid.o \
|
||||||
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o
|
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.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 \
|
UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \
|
||||||
calc_errno_tmp memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
|
memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
|
||||||
getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
|
getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
|
||||||
|
|
||||||
# these utility progs may be used in the process of building BUILD_H_SRC
|
# these utility progs may be used in the process of building BUILD_H_SRC
|
||||||
#
|
#
|
||||||
UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
|
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 \
|
||||||
have_ustat have_getsid have_getpgid \
|
have_ustat have_getsid have_getpgid \
|
||||||
have_gettime have_getprid ver_calc have_strdup
|
have_gettime have_getprid ver_calc have_strdup
|
||||||
|
|
||||||
@@ -2288,98 +2255,6 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h
|
|||||||
true; \
|
true; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
calc_errno.h: calc_errno.c ${MAKE_FILE}
|
|
||||||
-${Q}rm -f calc_errno.h calc_errno calc_errno_tmp
|
|
||||||
${Q}echo 'forming calc_errno.h'
|
|
||||||
${Q}echo '/*' > calc_errno.h
|
|
||||||
${Q}echo ' * DO NOT EDIT -- generated by the Makefile' >> calc_errno.h
|
|
||||||
${Q}echo ' */' >> calc_errno.h
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
${Q}echo '#if !defined(__CALC_ERRNO_H__)' >> calc_errno.h
|
|
||||||
${Q}echo '#define __CALC_ERRNO_H__' >> calc_errno.h
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
-${Q}if [ X"${ERRNO_DECL}" = X"-DERRNO_NO_DECL" ]; then \
|
|
||||||
echo '/*' >> calc_errno.h; \
|
|
||||||
echo ' * The calc Makefile explicitly told us' >> calc_errno.h; \
|
|
||||||
echo ' * how to declare errno and friends.' >> calc_errno.h; \
|
|
||||||
echo ' */' >> calc_errno.h; \
|
|
||||||
echo '' >> calc_errno.h; \
|
|
||||||
echo '#include <stdio.h>' >> calc_errno.h; \
|
|
||||||
echo '#include <errno.h>' >> calc_errno.h; \
|
|
||||||
elif [ X"${ERRNO_DECL}" = X"-DERRNO_STD_DECL" ]; then \
|
|
||||||
echo '/*' >> calc_errno.h; \
|
|
||||||
echo ' * The calc Makefile explicitly told us' >> calc_errno.h; \
|
|
||||||
echo ' * how to declare errno and friends.' >> calc_errno.h; \
|
|
||||||
echo ' */' >> calc_errno.h; \
|
|
||||||
echo '' >> calc_errno.h; \
|
|
||||||
echo 'extern int errno; ' \
|
|
||||||
'/* last system error */' >> calc_errno.h; \
|
|
||||||
echo 'extern const char *const sys_errlist[];' \
|
|
||||||
' /* system error messages*/' >> calc_errno.h; \
|
|
||||||
echo 'extern int sys_nerr; ' \
|
|
||||||
'/* number of system errors */' >> calc_errno.h; \
|
|
||||||
elif [ X"${ERRNO_DECL}" = X"-DERRNO_OLD_DECL" ]; then \
|
|
||||||
echo '/*' >> calc_errno.h; \
|
|
||||||
echo ' * The calc Makefile explicitly told us' >> calc_errno.h; \
|
|
||||||
echo ' * how to declare errno and friends.' >> calc_errno.h; \
|
|
||||||
echo ' */' >> calc_errno.h; \
|
|
||||||
echo '' >> calc_errno.h; \
|
|
||||||
echo 'extern int errno; ' \
|
|
||||||
'/* last system error */' >> calc_errno.h; \
|
|
||||||
echo 'extern char *sys_errlist[];' \
|
|
||||||
' /* system error messages*/' >> calc_errno.h; \
|
|
||||||
echo 'extern int sys_nerr; ' \
|
|
||||||
'/* number of system errors */' >> calc_errno.h; \
|
|
||||||
else \
|
|
||||||
${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} ${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} ${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; \
|
|
||||||
else \
|
|
||||||
echo '/*' >> calc_errno.h; \
|
|
||||||
echo ' * We were unable to to determine' >> calc_errno.h; \
|
|
||||||
echo ' * how to declare errno and friends.' >> calc_errno.h; \
|
|
||||||
echo ' * So we will guess this will work' >> calc_errno.h; \
|
|
||||||
echo ' * and hope for the best.' >> calc_errno.h; \
|
|
||||||
echo ' */' >> calc_errno.h; \
|
|
||||||
echo '' >> calc_errno.h; \
|
|
||||||
echo 'extern int errno; ' \
|
|
||||||
'/* last system error */' >> calc_errno.h; \
|
|
||||||
echo 'extern const char *const sys_errlist[];' \
|
|
||||||
' /* system error messages*/' >> calc_errno.h; \
|
|
||||||
echo 'extern int sys_nerr; ' \
|
|
||||||
'/* number of system errors */' >> calc_errno.h; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
|
||||||
fi
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
${Q}echo '' >> calc_errno.h
|
|
||||||
${Q}echo '#endif /* !__CALC_ERRNO_H__ */' >> calc_errno.h
|
|
||||||
-${Q}rm -f calc_errno calc_errno_tmp
|
|
||||||
${Q}echo 'calc_errno.h formed'
|
|
||||||
-@if [ -z "${Q}" ]; then \
|
|
||||||
echo ''; \
|
|
||||||
echo '=-=-= start of $@ =-=-='; \
|
|
||||||
cat $@; \
|
|
||||||
echo '=-=-= end of $@ =-=-='; \
|
|
||||||
echo ''; \
|
|
||||||
else \
|
|
||||||
true; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
calcerr.h: calcerr.tbl calcerr_h.sed calcerr_h.awk ${MAKE_FILE}
|
calcerr.h: calcerr.tbl calcerr_h.sed calcerr_h.awk ${MAKE_FILE}
|
||||||
-${Q}rm -f calerr.h
|
-${Q}rm -f calerr.h
|
||||||
${Q}echo 'forming calcerr.h'
|
${Q}echo 'forming calcerr.h'
|
||||||
@@ -2755,7 +2630,6 @@ env:
|
|||||||
@echo "HAVE_GETPRID=${HAVE_GETPRID}"; echo ""
|
@echo "HAVE_GETPRID=${HAVE_GETPRID}"; echo ""
|
||||||
@echo "HAVE_URANDOM=${HAVE_URANDOM}"; echo ""
|
@echo "HAVE_URANDOM=${HAVE_URANDOM}"; echo ""
|
||||||
@echo "ALIGN32=${ALIGN32}"; echo ""
|
@echo "ALIGN32=${ALIGN32}"; echo ""
|
||||||
@echo "ERRNO_DECL=${ERRNO_DECL}"; echo ""
|
|
||||||
@echo "BINDIR=${BINDIR}"; echo ""
|
@echo "BINDIR=${BINDIR}"; echo ""
|
||||||
@echo "TOPDIR=${TOPDIR}"; echo ""
|
@echo "TOPDIR=${TOPDIR}"; echo ""
|
||||||
@echo "LIBDIR=${LIBDIR}"; echo ""
|
@echo "LIBDIR=${LIBDIR}"; echo ""
|
||||||
@@ -3082,6 +2956,8 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
|
|||||||
-rm -f ${LIBDIR}/stdarg.h stdarg.h
|
-rm -f ${LIBDIR}/stdarg.h stdarg.h
|
||||||
-rm -f ${LIBDIR}/prototype.h prototype.h
|
-rm -f ${LIBDIR}/prototype.h prototype.h
|
||||||
-rm -f ${LIBDIR}/libcalcerr.a libcalcerr.a
|
-rm -f ${LIBDIR}/libcalcerr.a libcalcerr.a
|
||||||
|
-rm -f ${LIBDIR}/calc_errno.h calc_errno.h ${INCDIRCALC}/calc_errno.h
|
||||||
|
-rm -f calc_errno.c calc_errno.o calc_errno
|
||||||
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -3249,7 +3125,6 @@ calc.o: symbol.h
|
|||||||
calc.o: token.h
|
calc.o: token.h
|
||||||
calc.o: value.h
|
calc.o: value.h
|
||||||
calc.o: zmath.h
|
calc.o: zmath.h
|
||||||
calc_errno.o: calc_errno.c
|
|
||||||
calcerr.o: calcerr.c
|
calcerr.o: calcerr.c
|
||||||
calcerr.o: calcerr.h
|
calcerr.o: calcerr.h
|
||||||
calcerr.o: have_const.h
|
calcerr.o: have_const.h
|
||||||
@@ -3430,7 +3305,6 @@ func.o: alloc.h
|
|||||||
func.o: block.h
|
func.o: block.h
|
||||||
func.o: byteswap.h
|
func.o: byteswap.h
|
||||||
func.o: calc.h
|
func.o: calc.h
|
||||||
func.o: calc_errno.h
|
|
||||||
func.o: calcerr.h
|
func.o: calcerr.h
|
||||||
func.o: cmath.h
|
func.o: cmath.h
|
||||||
func.o: config.h
|
func.o: config.h
|
||||||
|
123
calc_errno.c
123
calc_errno.c
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* errno - Determine how to declare errno, sys_errlist and sys_nerr
|
|
||||||
*
|
|
||||||
* On most machines: errno sys_errlist and sys_nerr are declared
|
|
||||||
* by either <stdio.h> and/or <errno.h>. But some systems declare
|
|
||||||
* them somewhere else or do not declare them at all!
|
|
||||||
*
|
|
||||||
* If the system were doing a proper job in headers, this should declare them:
|
|
||||||
*
|
|
||||||
* #include <stdio.h>
|
|
||||||
* #include <errno.h>
|
|
||||||
*
|
|
||||||
* But one some systems one must explicitly declare them as:
|
|
||||||
*
|
|
||||||
* extern int errno;
|
|
||||||
* extern const char *const sys_errlist[];
|
|
||||||
* extern int sys_nerr;
|
|
||||||
*
|
|
||||||
* and on some old systems they must be explicitly and incorrectly declared as:
|
|
||||||
*
|
|
||||||
* extern int errno;
|
|
||||||
* extern char *sys_errlist[];
|
|
||||||
* extern int sys_nerr;
|
|
||||||
*
|
|
||||||
* The purpose of this utility is try and find the right way to declare
|
|
||||||
* them and to output the middle of a header file called calc_errno.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 <stdio.h>
|
|
||||||
#if defined(TRY_ERRNO_NO_DECL)
|
|
||||||
# include <errno.h>
|
|
||||||
#endif /* TRY_ERRNO_NO_DECL */
|
|
||||||
|
|
||||||
int
|
|
||||||
main(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
#if defined(TRY_ERRNO_NO_DECL)
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * The following comments were produced by calc_errno\n");
|
|
||||||
printf(" * in an effort to see if these values were correctly\n");
|
|
||||||
printf(" * declared when calc_errno.c was compiled.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("/* Initially errno is %d */\n", errno);
|
|
||||||
printf("/* There are %d entries in sys_errlist[] */\n", sys_nerr);
|
|
||||||
printf("/* The 2nd sys_errlist entry is \"%s\" */\n\n", sys_errlist[1]);
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * Based on the above, calc_errno now knows\n");
|
|
||||||
printf(" * how to declare errno and friends.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("#include <stdio.h>\n");
|
|
||||||
printf("#include <errno.h>\n");
|
|
||||||
#elif defined(TRY_ERRNO_OLD_DECL)
|
|
||||||
extern int errno; /* last system error */
|
|
||||||
extern char *sys_errlist[]; /* system error messages */
|
|
||||||
extern int sys_nerr; /* number of system errors*/
|
|
||||||
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * The following comments were produced by calc_errno\n");
|
|
||||||
printf(" * in an effort to see if these values were correctly\n");
|
|
||||||
printf(" * declared when calc_errno.c was compiled.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("/* Initially errno is %d */\n", errno);
|
|
||||||
printf("/* There are %d entries in sys_errlist[] */\n", sys_nerr);
|
|
||||||
printf("/* The 2nd sys_errlist entry is \"%s\" */\n\n", sys_errlist[1]);
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * Based on the above, calc_errno now knows\n");
|
|
||||||
printf(" * how to declare errno and friends.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("extern int errno;\t\t/* last system error */\n");
|
|
||||||
printf("extern char *sys_errlist[];\t"
|
|
||||||
"/* system error messages */\n");
|
|
||||||
printf("extern int sys_nerr;\t\t/* number of system errors*/\n");
|
|
||||||
#else /* assume defined(TRY_ERRNO_STD_DECL) */
|
|
||||||
extern int errno; /* last system error */
|
|
||||||
extern const char *const sys_errlist[]; /* system error messages */
|
|
||||||
extern int sys_nerr; /* number of system errors*/
|
|
||||||
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * The following comments were produced by calc_errno\n");
|
|
||||||
printf(" * in an effort to see if these values were correctly\n");
|
|
||||||
printf(" * declared when calc_errno.c was compiled.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("/* Initially errno is %d */\n", errno);
|
|
||||||
printf("/* There are %d entries in sys_errlist[] */\n", sys_nerr);
|
|
||||||
printf("/* The 2nd sys_errlist entry is \"%s\" */\n\n", sys_errlist[1]);
|
|
||||||
printf("/*\n");
|
|
||||||
printf(" * Based on the above, calc_errno now knows\n");
|
|
||||||
printf(" * how to declare errno and friends.\n");
|
|
||||||
printf(" */\n\n");
|
|
||||||
printf("extern int errno;\t\t\t/* last system error */\n");
|
|
||||||
printf("extern const char *const sys_errlist[];\t"
|
|
||||||
"/* system error messages */\n");
|
|
||||||
printf("extern int sys_nerr;\t\t\t/* number of system errors*/\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* exit(0); */
|
|
||||||
return 0;
|
|
||||||
}
|
|
38
func.c
38
func.c
@@ -10,6 +10,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(FUNCLIST)
|
#if defined(FUNCLIST)
|
||||||
|
|
||||||
@@ -17,8 +18,6 @@
|
|||||||
|
|
||||||
#else /* FUNCLIST */
|
#else /* FUNCLIST */
|
||||||
|
|
||||||
#include "calc_errno.h"
|
|
||||||
|
|
||||||
#include "have_unistd.h"
|
#include "have_unistd.h"
|
||||||
#if defined(HAVE_UNISTD_H)
|
#if defined(HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -29,16 +28,24 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "have_string.h"
|
||||||
|
#if defined(HAVE_STRING_H)
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "have_times.h"
|
#include "have_times.h"
|
||||||
#if defined(HAVE_TIME_H)
|
#if defined(HAVE_TIME_H)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_TIMES_H)
|
#if defined(HAVE_TIMES_H)
|
||||||
#include <times.h>
|
#include <times.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SYS_TIME_H)
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SYS_TIMES_H)
|
#if defined(HAVE_SYS_TIMES_H)
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -4628,6 +4635,7 @@ f_strerror(int count, VALUE **vals)
|
|||||||
long i;
|
long i;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
|
/* parse args */
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
vp = vals[0];
|
vp = vals[0];
|
||||||
if (vp->v_type < 0) {
|
if (vp->v_type < 0) {
|
||||||
@@ -4639,36 +4647,44 @@ f_strerror(int count, VALUE **vals)
|
|||||||
if (i < 0 || i > 32767)
|
if (i < 0 || i > 32767)
|
||||||
return error_value(E_STRERROR2);
|
return error_value(E_STRERROR2);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
i = set_errno(-1);
|
i = set_errno(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* setup return type */
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
|
|
||||||
|
/* change the meaning of error 0 */
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
i = E__BASE;
|
i = E__BASE;
|
||||||
|
|
||||||
|
/* firewall - return generic error string if it is not assigned */
|
||||||
if (i >= nexterrnum || (i > E__HIGHEST && i < E_USERDEF)
|
if (i >= nexterrnum || (i > E__HIGHEST && i < E_USERDEF)
|
||||||
|| (i < E__BASE && i >= sys_nerr)) {
|
|| (i < E__BASE && strerror(i) == NULL)) {
|
||||||
cp = (char *) malloc(12);
|
cp = (char *) malloc(sizeof("Error 1234567890")+1);
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
math_error("Out of memory for strerror");
|
math_error("Out of memory for strerror");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
sprintf(cp, "Error %ld", i);
|
sprintf(cp, "Unknown error %ld", i);
|
||||||
result.v_str = makestring(cp);
|
result.v_str = makestring(cp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < E__BASE) /* system error */
|
/* system error */
|
||||||
cp = (char *) sys_errlist[i];
|
if (i < E__BASE) {
|
||||||
|
cp = strerror(i);
|
||||||
|
|
||||||
else if (i >= E_USERDEF) /* user-described error */
|
/* user-described error */
|
||||||
|
} else if (i >= E_USERDEF) {
|
||||||
cp = namestr(&newerrorstr, i - E_USERDEF);
|
cp = namestr(&newerrorstr, i - E_USERDEF);
|
||||||
|
|
||||||
else /* calc-described error */
|
/* calc-described error */
|
||||||
|
} else {
|
||||||
cp = (char *)error_table[i - E__BASE];
|
cp = (char *)error_table[i - E__BASE];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return result as a V_STR */
|
||||||
result.v_str = makenewstring(cp);
|
result.v_str = makenewstring(cp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -2871,7 +2871,7 @@ print '053: parsed test_frem()';
|
|||||||
*/
|
*/
|
||||||
define test_error()
|
define test_error()
|
||||||
{
|
{
|
||||||
local strx, e99, list1, e999;
|
local strx, e99, list1, e9999;
|
||||||
local a, b, c, n, x; /* used by newerror() */
|
local a, b, c, n, x; /* used by newerror() */
|
||||||
|
|
||||||
print '3600: Beginning test_error';
|
print '3600: Beginning test_error';
|
||||||
@@ -3044,11 +3044,12 @@ define test_error()
|
|||||||
'3710: newerror() == newerror("???")');
|
'3710: newerror() == newerror("???")');
|
||||||
vrfy(newerror("") == newerror(),
|
vrfy(newerror("") == newerror(),
|
||||||
'3711: newerror("") == newerror()');
|
'3711: newerror("") == newerror()');
|
||||||
e999 = error(999);
|
e9999 = error(9999);
|
||||||
print '3712: e999 = error(999)';
|
print '3712: e9999 = error(9999)';
|
||||||
vrfy(errno() == 999, '3713: errno() == 999');
|
vrfy(errno() == 9999, '3713: errno() == 9999');
|
||||||
vrfy(error() == e999, '3714: error() == e999');
|
vrfy(error() == e9999, '3714: error() == e9999');
|
||||||
vrfy(strerror() == "Error 999", '3715: strerror() == "Error 999"');
|
vrfy(strerror() == "Unknown error 9999",
|
||||||
|
'3715: strerror() == "Unknown error 9999"');
|
||||||
x = newerror("Alpha");
|
x = newerror("Alpha");
|
||||||
print '3716: x = newerror("Alpha")';
|
print '3716: x = newerror("Alpha")';
|
||||||
n = iserror(x);
|
n = iserror(x);
|
||||||
@@ -3056,10 +3057,11 @@ define test_error()
|
|||||||
vrfy(errno() == n, '3718: errno() == n');
|
vrfy(errno() == n, '3718: errno() == n');
|
||||||
vrfy(error() == x, '3719: error() == x');
|
vrfy(error() == x, '3719: error() == x');
|
||||||
vrfy(strerror() == "Alpha", '3720: strerror() == "Alpha"');
|
vrfy(strerror() == "Alpha", '3720: strerror() == "Alpha"');
|
||||||
vrfy(errno(999) == n, '3721: errno() == n');
|
vrfy(errno(9999) == n, '3721: errno() == n');
|
||||||
vrfy(errno() == 999, '3722: errno() == 999');
|
vrfy(errno() == 9999, '3722: errno() == 9999');
|
||||||
vrfy(error() == e999, '3723: error() == e999');
|
vrfy(error() == e9999, '3723: error() == e9999');
|
||||||
vrfy(strerror() == "Error 999", '3724: strerror() == "Error 999"');
|
vrfy(strerror() == "Unknown error 9999",
|
||||||
|
'3724: strerror() == "Unknown error 9999"');
|
||||||
a = 1/0;
|
a = 1/0;
|
||||||
print '3725: a = 1/0';
|
print '3725: a = 1/0';
|
||||||
vrfy(strerror() == "Division by zero",
|
vrfy(strerror() == "Division by zero",
|
||||||
|
4
value.c
4
value.c
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#define LINELEN 80 /* length of a typical tty line */
|
#define LINELEN 80 /* length of a typical tty line */
|
||||||
|
|
||||||
extern int sys_nerr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free a value and set its type to undefined.
|
* Free a value and set its type to undefined.
|
||||||
*
|
*
|
||||||
@@ -2694,7 +2692,7 @@ printvalue(VALUE *vp, int flags)
|
|||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
if (userfunc("error_print", vp))
|
if (userfunc("error_print", vp))
|
||||||
return;
|
return;
|
||||||
if (-type >= sys_nerr)
|
if (-type >= E__BASE)
|
||||||
printf("Error %d", -type);
|
printf("Error %d", -type);
|
||||||
else
|
else
|
||||||
printf("System error %d", -type);
|
printf("System error %d", -type);
|
||||||
|
@@ -18,7 +18,7 @@ static char *program;
|
|||||||
#define MAJOR_VER 2 /* major version */
|
#define MAJOR_VER 2 /* major version */
|
||||||
#define MINOR_VER 11 /* minor version */
|
#define MINOR_VER 11 /* minor version */
|
||||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH "9.4.2" /* test number or empty string if no patch */
|
#define MINOR_PATCH "9.4.3" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
|
Reference in New Issue
Block a user