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