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

Last change on this file since 6099cac 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
RevLine 
[f40a309]1/*
2 =============================================================================
3 sprintf.c -- sprintf function
4 Version 2 -- 1987-06-11 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
[b28a12e]8#include "ram.h"
[f40a309]9
[7258c6a]10static int8_t *buff;
[7af8be4]11static int16_t spsub(int16_t c);
[f40a309]12
13/*
14 =============================================================================
15 sprintf(str, fmt, args) -- format args into str according to fmt
16 =============================================================================
17*/
18
[8973acd]19int16_t sprintf(int8_t *str, int8_t *fmt, ...)
[f40a309]20{
[8973acd]21 register int16_t count;
[f40a309]22 va_list aptr;
23
24 buff = str;
[bfc0072]25 va_start(aptr, fmt);
[f40a309]26 count = dofmt_(spsub, fmt, aptr);
[bfc0072]27 va_end(aptr);
[f40a309]28 *buff = '\0';
29 return(count);
30}
31
32/*
33 =============================================================================
34 spsub(c) - put c into the output string
35 =============================================================================
36*/
37
[7af8be4]38static int16_t spsub(int16_t c)
[f40a309]39{
[e102943]40 return((*buff++ = (int8_t)c) & 0xFF);
[f40a309]41}
Note: See TracBrowser for help on using the repository browser.