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

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

Compiled full ROM in Hatari.

  • Property mode set to 100644
File size: 1.5 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
21/*
22 =============================================================================
23 printf(fmt, args) -- output 'args' according to 'fmt' on CON_DEV
24 =============================================================================
25*/
26
27long
28printf(fmt, va_alist)
29char *fmt;
30va_dcl
31{
32 register long count;
33 int fpsub();
34 va_list aptr;
35
36 va_start(aptr);
37 count = dofmt_(fpsub, fmt, aptr);
38 va_end(aptr);
39 return(count);
40}
41
42/*
43 =============================================================================
44 fpsub(c) -- output 'c' to CON_DEV
45 =============================================================================
46*/
47
48static
49int
50fpsub(c)
51int c;
52{
53 /* KLUDGE: since we aren't Unix(tm) we prepend a CR to LF's */
54
55 if (c EQ '\n')
56 BIOS(B_PUTC, CON_DEV, '\r');
57
58 BIOS(B_PUTC, CON_DEV, c);
59 return(c);
60}
Note: See TracBrowser for help on using the repository browser.