source: buchla-68k/orig/IOLIB/SPRINTF.C@ 66b48e7

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

Imported original source code.

  • Property mode set to 100755
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 "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.