source: buchla-68k/iolib/sprintf.c@ fe7b401

Last change on this file since fe7b401 was 8973acd, checked in by Thomas Lopatic <thomas@…>, 7 years ago

No more warnings in libcio.

  • Property mode set to 100644
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 "ram.h"
9
10static int8_t *buff;
11static int16_t spsub(int16_t c);
12
13/*
14 =============================================================================
15 sprintf(str, fmt, args) -- format args into str according to fmt
16 =============================================================================
17*/
18
19int16_t sprintf(int8_t *str, int8_t *fmt, ...)
20{
21 register int16_t count;
22 va_list aptr;
23
24 buff = str;
25 va_start(aptr, fmt);
26 count = dofmt_(spsub, fmt, aptr);
27 va_end(aptr);
28 *buff = '\0';
29 return(count);
30}
31
32/*
33 =============================================================================
34 spsub(c) - put c into the output string
35 =============================================================================
36*/
37
38static int16_t spsub(int16_t c)
39{
40 return((*buff++ = (int8_t)c) & 0xFF);
41}
Note: See TracBrowser for help on using the repository browser.