Cygwin: Add new APIs tc[gs]etwinsize()
[newlib-cygwin.git] / newlib / libc / sys / sysvi386 / sbrk.c
blob8ae3ed12b5df3fdc6dab96517acd01aff535ca06
1 extern end;
3 static void *curbrk = (char*)&end;
5 void *
6 sbrk(incr)
7 int incr; {
8 extern int errno;
9 extern int _brk(void *);
10 void *ptr = curbrk;
11 int t;
13 if (incr == 0)
14 return curbrk;
15 t = _brk (curbrk + incr);
16 if (t == -1 && errno)
17 return (void *)-1;
18 curbrk = ((char *)curbrk) + incr;
19 return ptr;