Last change
on this file since cbe2c15 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
1.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | sprintf.c -- sprintf function
|
---|
4 | Version 2 -- 1987-06-11 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "varargs.h"
|
---|
9 |
|
---|
10 | extern long dofmt_();
|
---|
11 |
|
---|
12 | static char *buff;
|
---|
13 |
|
---|
14 | /*
|
---|
15 | =============================================================================
|
---|
16 | sprintf(str, fmt, args) -- format args into str according to fmt
|
---|
17 | =============================================================================
|
---|
18 | */
|
---|
19 |
|
---|
20 | long
|
---|
21 | sprintf(str, fmt, va_alist)
|
---|
22 | char *str, *fmt;
|
---|
23 | va_dcl
|
---|
24 | {
|
---|
25 | int spsub();
|
---|
26 |
|
---|
27 | register long count;
|
---|
28 | va_list aptr;
|
---|
29 |
|
---|
30 | va_start(aptr);
|
---|
31 | buff = str;
|
---|
32 | count = dofmt_(spsub, fmt, aptr);
|
---|
33 | *buff = '\0';
|
---|
34 | return(count);
|
---|
35 | }
|
---|
36 |
|
---|
37 | /*
|
---|
38 | =============================================================================
|
---|
39 | spsub(c) - put c into the output string
|
---|
40 | =============================================================================
|
---|
41 | */
|
---|
42 |
|
---|
43 | static
|
---|
44 | int
|
---|
45 | spsub(c)
|
---|
46 | {
|
---|
47 | return((*buff++ = c) & 0xFF);
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.