minix/lib/other/_sbrk.c
2006-06-30 14:40:29 +00:00

20 lines
368 B
C
Executable file

#include <lib.h>
#define sbrk _sbrk
#include <unistd.h>
extern char *_brksize;
PUBLIC char *sbrk(incr)
int incr;
{
char *newsize, *oldsize;
oldsize = _brksize;
newsize = _brksize + incr;
if ((incr > 0 && newsize < oldsize) || (incr < 0 && newsize > oldsize))
return( (char *) -1);
if (brk(newsize) == 0)
return(oldsize);
else
return( (char *) -1);
}