mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-24 23:32:06 +00:00
22 lines
309 B
C
22 lines
309 B
C
extern end;
|
|
|
|
static void *curbrk = (char*)&end;
|
|
|
|
void *
|
|
sbrk(incr)
|
|
int incr; {
|
|
extern int errno;
|
|
extern int _brk(void *);
|
|
void *ptr = curbrk;
|
|
int t;
|
|
|
|
if (incr == 0)
|
|
return curbrk;
|
|
t = _brk (curbrk + incr);
|
|
if (t == -1 && errno)
|
|
return (void *)-1;
|
|
curbrk = ((char *)curbrk) + incr;
|
|
return ptr;
|
|
}
|
|
|