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

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

Unix line breaks.

  • Property mode set to 100644
File size: 1020 bytes
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
10extern long dofmt_();
11
12static char *buff;
13
14/*
15 =============================================================================
16 sprintf(str, fmt, args) -- format args into str according to fmt
17 =============================================================================
18*/
19
20long
21sprintf(str, fmt, va_alist)
22char *str, *fmt;
23va_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
43static
44int
45spsub(c)
46{
47 return((*buff++ = c) & 0xFF);
48}
Note: See TracBrowser for help on using the repository browser.