1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-23 17:46:23 -05:00

Return error if &div or &mod by 0.

This commit is contained in:
Renaud 2015-03-17 09:04:22 +08:00
parent f97746a87b
commit d01649bf3a

6
eval.c
View File

@ -401,10 +401,12 @@ static char *gtfun( char *fname) {
retstr = i_to_a( atoi( arg1) * atoi( argx)) ; retstr = i_to_a( atoi( arg1) * atoi( argx)) ;
break ; break ;
case UFDIV: case UFDIV:
retstr = i_to_a( atoi( arg1) / atoi( argx)) ; sz = atoi( argx) ;
retstr = (sz == 0) ? errorm : i_to_a( atoi( arg1) / sz) ;
break ; break ;
case UFMOD: case UFMOD:
retstr = i_to_a( atoi( arg1) % atoi( argx)) ; sz = atoi( argx) ;
retstr = (sz == 0) ? errorm : i_to_a( atoi( arg1) % sz) ;
break ; break ;
case UFNEG: case UFNEG:
retstr = i_to_a( -atoi( argx)) ; retstr = i_to_a( -atoi( argx)) ;