newlib/libgloss/libnosys/sbrk.c

28 lines
479 B
C
Raw Normal View History

2000-03-17 23:48:54 +01:00
/*
* Version of sbrk for no operating system.
*/
#include "config.h"
#include <_ansi.h>
#include <_syslist.h>
#include <sys/types.h>
#include <errno.h>
#undef errno
extern int errno;
caddr_t
_DEFUN (_sbrk, (incr),
int incr)
{
extern char end; /* set by linker */
static char *heap_end;
char *prev_heap_end;
if (heap_end == 0) {
heap_end = &end;
}
prev_heap_end = heap_end;
heap_end += incr;
return (caddr_t) prev_heap_end;
}