repo.or.cz
/
neatlibc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
stdlib.h: add labs()
[neatlibc.git]
/
stdlib.c
blob
535c415385ed052ae891d4e0494026e7c68d6638
1
#include <stdlib.h>
2
#include <string.h>
3
4
char
**
environ
;
5
6
void
exit
(
int
status
)
7
{
8
_exit
(
status
);
9
}
10
11
int
abs
(
int
n
)
12
{
13
return
n
>=
0
?
n
: -
n
;
14
}
15
16
long
labs
(
long
n
)
17
{
18
return
n
>=
0
?
n
: -
n
;
19
}
20
21
char
*
getenv
(
char
*
name
)
22
{
23
char
**
p
=
environ
;
24
int
len
=
strlen
(
name
);
25
for
(; *
p
;
p
++)
26
if
(!
memcmp
(
name
, *
p
,
len
) && (*
p
)[
len
] ==
'='
)
27
return
*
p
+
len
+
1
;
28
return
NULL
;
29
}