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

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

Added include files for global functions and variables.

  • 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 "all.h"
16
17extern int32_t dofmt_(int16_t (*putsub)(), int8_t *format, va_list args);
18
19 static int16_t fpsub(int16_t c);
20
21/*
22 =============================================================================
23 printf(fmt, args) -- output 'args' according to 'fmt' on CON_DEV
24 =============================================================================
25*/
26
27int32_t printf(int8_t *fmt, ...)
28{
29 register int32_t count;
30 va_list aptr;
31
32 va_start(aptr, fmt);
33 count = dofmt_(fpsub, fmt, aptr);
34 va_end(aptr);
35 return(count);
36}
37
38/*
39 =============================================================================
40 fpsub(c) -- output 'c' to CON_DEV
41 =============================================================================
42*/
43
44static int16_t fpsub(int16_t c)
45{
46 /* KLUDGE: since we aren't Unix(tm) we prepend a CR to LF's */
47
48 if (c EQ '\n')
49 BIOS(B_PUTC, CON_DEV, '\r');
50
51 BIOS(B_PUTC, CON_DEV, c);
52 return(c);
53}
54
Note: See TracBrowser for help on using the repository browser.