Last change
on this file since cbe2c15 was df097bf, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Code compiles, doesn't link.
|
-
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 |
|
---|
| 8 | #include "varargs.h"
|
---|
| 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 |
|
---|
| 21 | long
|
---|
| 22 | sprintf(str, fmt, va_alist)
|
---|
| 23 | char *str, *fmt;
|
---|
| 24 | va_dcl
|
---|
| 25 | {
|
---|
| 26 | register long count;
|
---|
| 27 | va_list aptr;
|
---|
| 28 |
|
---|
| 29 | va_start(aptr);
|
---|
| 30 | buff = str;
|
---|
| 31 | count = dofmt_(spsub, fmt, aptr);
|
---|
| 32 | *buff = '\0';
|
---|
| 33 | return(count);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | /*
|
---|
| 37 | =============================================================================
|
---|
| 38 | spsub(c) - put c into the output string
|
---|
| 39 | =============================================================================
|
---|
| 40 | */
|
---|
| 41 |
|
---|
| 42 | static
|
---|
| 43 | int
|
---|
| 44 | spsub(c)
|
---|
| 45 | {
|
---|
| 46 | return((*buff++ = c) & 0xFF);
|
---|
| 47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.