some fixes: calloc was wrong; catch traps, and let divides
by 0 generate a signal, if on a unix machine
This commit is contained in:
parent
8aee01de95
commit
30959cd73f
3 changed files with 44 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* $Header$ */
|
/* $Header$ */
|
||||||
#define ALIGN(sz) (((sz) + (sizeof(long) - 1) / sizeof(long)) * sizeof(long))
|
#define ALIGN(sz) ((((sz) + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long))
|
||||||
char *
|
char *
|
||||||
calloc(nelem, elsize)
|
calloc(nelem, elsize)
|
||||||
unsigned int nelem, elsize;
|
unsigned int nelem, elsize;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#
|
#
|
||||||
|
#include "em_abs.h"
|
||||||
/*
|
/*
|
||||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
*
|
*
|
||||||
|
@ -43,6 +44,11 @@ _penvp
|
||||||
loi EM_PSIZE
|
loi EM_PSIZE
|
||||||
lae _penvp
|
lae _penvp
|
||||||
sti EM_PSIZE
|
sti EM_PSIZE
|
||||||
|
#if unix && ! (em22 || em24 || em44)
|
||||||
|
lpi $_ctch_
|
||||||
|
sig
|
||||||
|
asp EM_PSIZE
|
||||||
|
#endif
|
||||||
lal EM_WSIZE+EM_PSIZE
|
lal EM_WSIZE+EM_PSIZE
|
||||||
loi EM_PSIZE
|
loi EM_PSIZE
|
||||||
lal EM_WSIZE
|
lal EM_WSIZE
|
||||||
|
@ -54,3 +60,31 @@ _penvp
|
||||||
lfr EM_WSIZE
|
lfr EM_WSIZE
|
||||||
cal $exit
|
cal $exit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#if unix && ! (em22 || em24 || em44)
|
||||||
|
exp $_ctch_
|
||||||
|
pro $_ctch_,0
|
||||||
|
lol 0
|
||||||
|
loc EIDIVZ
|
||||||
|
beq *1
|
||||||
|
lol 0
|
||||||
|
loc EFDIVZ
|
||||||
|
beq *1
|
||||||
|
bra *2
|
||||||
|
2
|
||||||
|
lol 0
|
||||||
|
trp
|
||||||
|
bra *3
|
||||||
|
1
|
||||||
|
loc 8
|
||||||
|
cal $getpid
|
||||||
|
lfr EM_WSIZE
|
||||||
|
cal $kill
|
||||||
|
asp 2*EM_WSIZE
|
||||||
|
3
|
||||||
|
lpi $_ctch_
|
||||||
|
sig
|
||||||
|
asp EM_WSIZE
|
||||||
|
rtt
|
||||||
|
end 0
|
||||||
|
#endif
|
||||||
|
|
9
lang/cem/libcc/gen/rename.c
Normal file
9
lang/cem/libcc/gen/rename.c
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
int
|
||||||
|
rename(from, to)
|
||||||
|
char *from, *to;
|
||||||
|
{
|
||||||
|
(void) unlink(to);
|
||||||
|
if (link(from, to) < 0) return -1;
|
||||||
|
(void) unlink(from);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue