source: buchla-68k/iolib/printf.c@ cbe2c15

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.4 KB
Line 
1/*
2 =============================================================================
3 printf.c -- printf function
4 Version 6 -- 1987-08-13 -- D.N. Lynx Crowe
5
6 RECOVERED From: Version 5 -- 1987-06-16 -- D.N. Lynx Crowe
7
8 "Crufty code" Warning:
9 Since this isn't Unix(tm), we prepend a '\r' when we see a '\n'.
10 We also return a long, since this is a 32 bit address machine.
11 (Well, almost 32 bits. Too big for an Alcyon 16 bit int anyway.)
12 =============================================================================
13*/
14
15#include "stddefs.h"
16#include "biosdefs.h"
17#include "varargs.h"
18
19extern long dofmt_();
20
21static int fpsub();
22
23/*
24 =============================================================================
25 printf(fmt, args) -- output 'args' according to 'fmt' on CON_DEV
26 =============================================================================
27*/
28
29long
30printf(fmt, va_alist)
31char *fmt;
32va_dcl
33{
34 register long count;
35 va_list aptr;
36
37 va_start(aptr);
38 count = dofmt_(fpsub, fmt, aptr);
39 va_end(aptr);
40 return(count);
41}
42
43/*
44 =============================================================================
45 fpsub(c) -- output 'c' to CON_DEV
46 =============================================================================
47*/
48
49static
50int
51fpsub(c)
52int c;
53{
54 /* KLUDGE: since we aren't Unix(tm) we prepend a CR to LF's */
55
56 if (c EQ '\n')
57 BIOS(B_PUTC, CON_DEV, '\r');
58
59 BIOS(B_PUTC, CON_DEV, c);
60 return(c);
61}
Note: See TracBrowser for help on using the repository browser.