mirror of
https://salsa.debian.org/debian/dash.git
synced 2026-01-26 15:39:05 +00:00
[ARITH] If imaxdiv() isn't available, use / and % operators
Although in posix, imaxdiv() isn't implemented on Debian/alpha, causing dash to fail to build. So use / and % operators if imaxdiv() isn't available. http://bugs.debian.org/456398 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
1b212d313d
commit
469fad8670
@ -1,3 +1,7 @@
|
||||
2007-12-23 Gerrit Pape <pape@smarden.org>
|
||||
|
||||
* If imaxdiv() isn't available, use / and % operators.
|
||||
|
||||
2007-12-23 Richard M Kreuter <kreuter@progn.net>
|
||||
|
||||
* Add set +o support.
|
||||
|
||||
@ -33,8 +33,9 @@ dnl Checks for libraries.
|
||||
dnl Checks for header files.
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(bsearch getpwnam getrlimit isalpha killpg mempcpy sigsetmask \
|
||||
stpcpy strchrnul strsignal strtod strtoimax strtoumax sysconf)
|
||||
AC_CHECK_FUNCS(bsearch getpwnam getrlimit imaxdiv isalpha killpg mempcpy \
|
||||
sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
|
||||
strtoumax sysconf)
|
||||
|
||||
if test "$enable_fnmatch" = yes; then
|
||||
use_fnmatch=
|
||||
|
||||
@ -88,7 +88,9 @@ static inline int higher_prec(int op1, int op2)
|
||||
|
||||
static intmax_t do_binop(int op, intmax_t a, intmax_t b)
|
||||
{
|
||||
#ifdef HAVE_IMAXDIV
|
||||
imaxdiv_t div;
|
||||
#endif
|
||||
|
||||
switch (op) {
|
||||
default:
|
||||
@ -96,8 +98,12 @@ static intmax_t do_binop(int op, intmax_t a, intmax_t b)
|
||||
case ARITH_DIV:
|
||||
if (!b)
|
||||
yyerror("division by zero");
|
||||
#ifdef HAVE_IMAXDIV
|
||||
div = imaxdiv(a, b);
|
||||
return op == ARITH_REM ? div.rem : div.quot;
|
||||
#else
|
||||
return op == ARITH_REM ? a % b : a / b;
|
||||
#endif
|
||||
case ARITH_MUL:
|
||||
return a * b;
|
||||
case ARITH_ADD:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user