repo.or.cz
/
mascara-docs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* added compilers lcc and bcc (linux86)
[mascara-docs.git]
/
compilers
/
linux86-0.16.17
/
libc
/
misc
/
ltoa.c
blob
be1c7e21211c36f4ed9c7d2a1f0708be48b079b2
1
/* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
2
* This file is part of the Linux-8086 C library and is distributed
3
* under the GNU Library General Public License.
4
*/
5
6
static char
buf
[
12
];
7
8
extern
char
*
ultoa
();
9
10
char
*
ltoa
(
val
)
11
long
val
;
12
{
13
char
*
p
;
14
int
flg
=
0
;
15
if
(
val
<
0
) {
flg
++;
val
= -
val
; }
16
p
=
ultoa
(
val
);
17
if
(
flg
) *--
p
=
'-'
;
18
return
p
;
19
}
20
21
char
*
ultoa
(
val
)
22
unsigned long
val
;
23
{
24
char
*
p
;
25
26
p
=
buf
+
sizeof
(
buf
);
27
*--
p
=
'\0'
;
28
29
do
30
{
31
*--
p
=
'0'
+
val
%
10
;
32
val
/=
10
;
33
}
34
while
(
val
);
35
return
p
;
36
}
37